Tuesday, March 20, 2007

Localization tips..

These are something that you would need to consider when planning to localize your system.


            Externalize all the hard code strings, that is, move it into a separate resource file.


            Do not move your strings into the forms own resource file (talking about .NET Win forms), this is because every time you add a new language support or even if you change something on the form through the designer, the forms resource file gets regenerated, and your newly added keys are lost !!! , therefore move it into a separate resource file.


Do not use hard code string concatenations, for an example :

String str = “Something ”  + value + “ something more”;

Don’t move only the strings “Something ” and “ something more” into the resource file, try adding a value in the resource file as “Something {0} something more” and in your program code : String str = string.Format(resource.GetString(“the_key”,value));

The reason for this is that in another language, the whole sentence may be in a different order, this helps translators to quickly change the order of the words in the resource file when translating into another language  

No comments:

Post a Comment