Sometimes it is necessary to embed some markup in the text so that the translator
can move the marked-up text in a phrase.
Your search, <tt>&terms;</tt>, matched no records.
or
Hello, <strong>&username;</strong>, welcome to our service!
Even simple markup might get mangled a small percentage of the time,
but including a lot of markup can make unintended changes more likely,
which can result in a feature not working.
For example:
<label for="terms">Find</label>
<input type="text" name="terms" id="terms"
onchange="validate(this)" class="text" title="terms" />
in results.
Translators may not know much if anything about coding
and might inadvertently break the code by modifying some markup
or by inadvertently translating some markup.
In the example above, it may not be clear that the only text that
should be translated is the
title attribute "terms",
and that translating other "terms" strings will break the code.
And frankly,
reordering complex HTML to match the target language grammar
might be error prone even for programmers.
Variables like the following might make the translator's job easier:
FindInResults = Find in results:
TermBoxHoverText = terms
and then the code can be hidden from the translator:
<label for="terms">&FindInResults;</label>
<input type="text" name="terms" id="terms"
onchange="validate(this)" class="text" title="&TermBoxHoverText;" />
System-wide variables:
A special case of code to hide from programmers are system-wide variables,
such as locations of files.
These are best defined in one place and inserted as variables
so that if they need to be changed, the change is made in one place, not in many language files,
where they might be mangled by translators.
And if the values of the variables vary by language, then a variable can be used to adapt them
(assuming a regular naming convention; otherwise, there can be a separate store of variables for each language).
For the translator: |
helplabel = Help |
Initialization file: |
helpurl = http://www.oclc.org/worldcat/help/&language;/ |
For the code: |
<a href="&helpurl;">&helplabel;</a> |
If there is any code in translated text, it is a good idea to validate
what comes back from the translator (valid HTML tags, correct syntax for entities).
And from experience, it is a good idea to validate what is sent to the
translators before it is sent, because any errors will probably be dutifully
maintained in all translated languages, and then need to be fixed in many
places.