NB: This document is a *draft*!
General guidelines
Internationalisation aspects
# START NON-TRANSLATABLE
def_sc_js_html_content=<script type\="text/javascript">\n\t\n</script>
# END NON-TRANSLATABLE
If you have a whole block of non-translatable properties (or an entire file), you can just put # START NON-TRANSLATABLE before the first, and # END NON-TRANSLATABLE after the last. (And yes, you can nest NON-TRANSLATABLE blocks if you really want to.)
3. Delete messages which become obsolete. When removing code which has (or might contain) externalised strings, please check whether you can delete the strings from the relevant properties files. This will save translators from translating text which will never be used!
4. Avoid concatenating externalised strings. For instance:
messages.properties:
InvalidFilename1=The filename '
InvalidFilename2=' is not valid.
MyClass.java:
setMessage(Messages.InvalidFilename1 + filename +
Messages.InvalidFilename2);
I'm not a translator, but I understand it's not possible to translate two half-sentences, jam them together with a variable in between, and have the result mean anything useful in most languages. Unless the two languages have the same word-order (eg English -> Pig Latin) the sentence will break.
Instead, use a single string, passed though MessageFormat like this:
messages.properties:
InvalidFilename=The filename ''{0}'' is not valid.
MyClass.java:
setMessage(MessageFormat.format(Messages.InvalidFilename, fileName));
(Note that MessageFormat requires single quotes (apostrophes) to be repeated.)
Comments