philihp / weblabora

Ora et Labora boardgame simulation library
http://kennerspiel.com
Apache License 2.0
11 stars 2 forks source link

Translate to other languages #116

Open philihp opened 11 years ago

philihp commented 11 years ago

We have the technology.

adambadura commented 11 years ago

I can do translation to Polish. Shouldn't be difficult.

Interesting question is what procedure to take when adding new text so that all translations will be updated ASAP?

philihp commented 11 years ago

So the process is supposed to be easy. I've never done it before though as I only know English... so this will be an experiment.

If you check in /src/main/resources/, there's a main file called MessageResources.properties. These are all of the "default" strings, for when a translation does not exist. If you want to translate any of these, say to French, you'd create a file here called MessageResources_fr.properties, and put the same key= there, and the french translation following it. If perhaps you wanted to further localize it to a dialect (say Canadian french), you would then put it in MessageResources_fr_CA.properties.

These strings are used in error messages, and also in JSPs where instead of just writing the text we want, we use <bean:message key="..." /> tags. If you look up stuff, you might see people use JSTL's fmt:message tag. I'm not sure of the benefits of doing that, but it's supposed to be better? Whenever that tag is encountered, it looks at the locale of the browser. If it's fr_CA, it tries to find the key in MessageResources_fr_CA.properties. If it isn't in there, or that file doesn't exist, it tries MessageResources_fr.properties. If it still doesn't exist, it looks in MessageResources.properties. If it still doesn't, an error comes back I think, or it just displays the key.

TL;DR, you'd need to create a MessageResources_pl_PL.properties file in /src/main/resources, copy the contents of MessageResources.properties, and change the strings around.

adambadura commented 11 years ago

Well, those things more or less I knew.

The question is that once we start doing translation everyone adding some text SHOULD add it the "localizable way" and inform others that new text needs to be translated. Which calls for more self discipline... On the other hand well defined process of integrating branches to final code could make that easier by adding extra effort for the merger.

adambadura commented 11 years ago

Are you sure about that bean:message? As I am unable to find it in the code...