W3C home > Mailing lists > Public > public-html-comments@w3.org > October 2012

Re: <code translate=no>

From: Gannon Dick <gannon_dick@yahoo.com>
Date: Mon, 15 Oct 2012 12:12:15 -0700 (PDT)
Message-ID: <1350328335.78983.YahooMailNeo@web112603.mail.gq1.yahoo.com>
To: "Jukka K. Korpela" <jukka.k.korpela@kolumbus.fi>, "public-html-comments@w3.org" <public-html-comments@w3.org>
2.  The Language Tag Language tags are used to help identify languages, whether spoken, written, signed, or otherwise signaled, for the purpose of communication.  This includes constructed and artificial languages but *****excludes languages not intended primarily for human communication, such as programming languages*****.


I think the IETF agrees.


----- Original Message -----
From: Jukka K. Korpela <jukka.k.korpela@kolumbus.fi>
To: public-html-comments@w3.org
Sent: Monday, October 15, 2012 1:53 PM
Subject: Re: <code translate=no>

2012-10-15 21:23, Andreas Prilop wrote:
> http://translate.google.com never translates  <code>...</code> .
> It is therefore not necessary to write  <code translate=no>
> or  <code class=notranslate> . I think this is a good idea.

On practical grounds, it might be seen as a good idea. Computer code is generally meant to be language-invariant, and it is better to avoid translating source program code, markup, commands, or other <code> content.

Still, on logical grounds, computer code as such is not non-translatable. I'm thinking of comments mainly, of course.

> Could  <code translate=no>  be made the default in HTML5
> for the  code  element?
I have no strong opinion on this. Pragmatically, it might be a good idea, though perhaps Google and friends will keep doing whatever they are doing, anyway. Logically, it would be odd. The "translate" attribute as such is questionable. An attribute name that is an English verb suggests that it is a command, or at least suggestion. But attributes are supposed to be declarative.

Appropriate markup would say that the content of the element is to be treated as not being in any human language, for the purposes of translation, spelling checks, text concordance analysis, etc., but may still be treated as being in one or more human languages in speech synthesis. If such markup were available, <code> elements could have it set by default, provided that there is a way to switch it off for comments (and maybe for string literals).

But there's a completely different meaning for translate=no, as exemplified by the following code at http://www.w3.org/TR/html5/global-attributes.html#the-translate-attribute:

  <p>The Bee Game is a text adventure game in English.</p>
  <p>When the game launches, the first thing you should do is type
  <kbd*translate=no*>eat honey</kbd>. The game will respond with:</p>
  <pre><samp*translate=no*>Yum yum! That was some good honey!</samp></pre>

Perhaps a better example would be the statement "The plural of 'ox' in English is 'oxen'",
where it would of course be absurd to translate "ox" and "oxen". This is very different
from the <code> case: here the language of the content is certainly a human language,
well identified and mentioned in the context. The content could surely be translated; it
just should normally not be translated. Though this might really seem to call for command-like
markup, the logical structure is that the words "ox" and "oxen" should be taken as
linguistic objects rather than normal words. They could well be translated in a rendering
mode where a document is displayed in its original language but translations to another
language are displayed e.g. on mouseover, as explanations. The same applies to the example
above: normally not translated, but surely translatable, much more than computer language
keywords and variable names are.

-- Yucca, http://www.cs.tut.fi/~jkorpela/
Received on Monday, 15 October 2012 19:12:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:26:28 UTC