Re: Question related to Recommendation/Best Practice/Relevant Discussions for "Translation-relevant content related to 'script' element in HTML"

On 15.8.2013 14:38, Lieske, Christian wrote:

> One way of looking at the situation is the following:
> 
>                 The "script" element in HTML holds code.
>                 Any code should be internationalized.
>                 Internationalized code should externalize translation-relevant content (e.g. store the content in Java .properties files).
> 
> An alternative view, however, is this:
> 
>                 Fragmentation of translation-relevant content - e.g. putting plain HTML into one file, and translation-relevant content of the HTML "script" element into another file - is bad. Contextual information might get lost for example.

Any reasonably large application stores almost all scripting code in
external files so localization mutst be handled there.

> 3.       Do not externalize but use a special approach for allowing automated processing of translation-relevant content (e.g. use a variables with a special syntax to store translation-relevant content; example: var tr_a="Translate ME"; var tr_b="Translate ME TOO";  var b="www.zzz.com<http://www.zzz.com>";

I don't think that we should propose such approch, it's kind of a hack
and if someone needs it he/she should invent his own syntax rules for this.

What we can propose is to separate all such translatable content into
separate script elements marked by ITS as translateable, something like:

<script id="PLEASE_WAIT" type="text/plain" its-translate="yes">Please
<em>wait</em> ...</script>

<script type="text/javascript">
function x(){
if (document.getElementById("y").innerHTML !=
document.getElementById("PLEASE_WAIT").innerText ) { }
}
</script>

That way you can use standard ITS processing even for localizing strings
inside Javascript with little runtime overhead.

    Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@kosek.cz      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
------------------------------------------------------------------
    Bringing you XML Prague conference    http://xmlprague.cz
------------------------------------------------------------------

Received on Tuesday, 20 August 2013 09:15:59 UTC