- From: Lieske, Christian <christian.lieske@sap.com>
- Date: Thu, 15 Aug 2013 12:38:12 +0000
- To: "public-i18n-its-ig@w3.org" <public-i18n-its-ig@w3.org>
- Message-ID: <E6CB1ED646F2F54B9A42317B292E4AFB2F4D505D@DEWDFEMB10B.global.corp.sap>
Hi,
Since we discussed HTML's "script" element in https://www.w3.org/Bugs/Public/show_bug.cgi?id=21495#c1 I dare to send this to this list ...
Cheers,
Christian
==
The "script" element in HTML (any flavor) can contain translation-relevant content, and content that should not be changed by adaptations such as translation, or localization (see example below).
I wonder whether relevant recommendations or best practices related to this situation do already exist.
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.
Thus, presumably several recommendations or best practices exist. Examples that I could imagine:
1. Externalize into Java .properties (but be aware of the fact that some languages may require Java-style encoding such as \u00e1).
2. Externalize as JSON; choose a simple key-value JSON
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>";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
function x(){
if (document.getElementById("y").innerHTML != "Please <em>wait</em> ...") { \\ Case 1: Translation-relevant content with HTML markup
alert("Checkbox selected but nothing selected from the drop down menu."); \\ Case 2: Translation-relevant content without HTML markup
alert("www.zzz.com<http://www.zzz.com>"); \\ Case 3: Content that should not be changed by adaptations such as translation, or localization
}
}
</SCRIPT>
</head>
<body>
<p>Test</p>
</body>
</html>
Received on Thursday, 15 August 2013 12:38:46 UTC