Internationalization in your projects

It has been a while, so this is not comprehensive.

Character Sets

Unicode is great, but you can’t get away with ignoring other character sets. The default character set on Windows XP (English) is Cp1252. On the web, you don’t know what a browser will send you (though hopefully your container will handle most of this). And don’t be surprised when there are bugs in whatever implementation you are using. Character sets can have interesting interactions with filenames when they move to between machines.

Translating Strings

Translators are, generally speaking, not coders. If you send a source file to a translator, they will break it. Strings should be extracted to resource files (e.g. properties files in Java or resource DLLs in Visual C++). Translators should be given files that are difficult to break and tools that don’t let them break them.

Translators do not know where strings come from in a product. It is difficult to translate a string without context. If you do not provide guidance, the quality of the translation will suffer.

While on the subject of context, you may see the same string “foo” crop up in multiple times and think it would be more efficient to have all instances in the UI point to the same resource. This is a bad idea. Words may be very context-sensitive in some languages.

Translating strings costs money. If you release a new version of a product, it makes sense to recover the old versions. Have tools to recover strings from your old resource files.

String concatenation and manual manipulation of strings should be minimized. Use the format functions where applicable.

Translators need to be able to modify hotkeys. Ctrl+P is print in English; the Germans use Ctrl+D.

If you have a translation process that requires someone to manually cut and paste strings at any time, you are asking for trouble.

Dates, Times, Calendars, Currency, Number Formats, Time Zones

These can all vary from country to country. A comma may be used to denote decimal places. Times may be in 24hour notation. Not everyone uses the Gregorian calendar. You need to be unambiguous, too. If you take care to display dates as MM/DD/YYYY for the USA and DD/MM/YYYY for the UK on your website, the dates are ambiguous unless the user knows you’ve done it.

Especially Currency

The Locale functions provided in the class libraries will give you the local currency symbol, but you can’t just stick a pound (sterling) or euro symbol in front of a value that gives a price in dollars.

User Interfaces

Layout should be dynamic. Not only are strings likely to double in length on translation, the entire UI may need to be inverted (Hebrew; Arabic) so that the controls run from right to left. And that is before we get to Asia.

Testing Prior To Translation

  • Use static analysis of your code to locate problems. At a bare minimum, leverage the tools built into your IDE. (Eclipse users can go to Window > Preferences > Java > Compiler > Errors/Warnings and check for non-externalised strings.)
  • Smoke test by simulating translation. It isn’t difficult to parse a resource file and replace strings with a pseudo-translated version that doubles the length and inserts funky characters. You don’t have to speak a language to use a foreign operating system. Modern systems should let you log in as a foreign user with translated strings and foreign locale. If you are familiar with your OS, you can figure out what does what without knowing a single word of the language.
  • Keyboard maps and character set references are very useful.
  • Virtualisation would be very useful here.

Non-technical Issues

Sometimes you have to be sensitive to cultural differences (offence or incomprehension may result). A mistake you often see is the use of flags as a visual cue choosing a website language or geography. Unless you want your software to declare sides in global politics, this is a bad idea. If you were French and offered the option for English with St. George’s flag (the flag of England is a red cross on a white field), this might result in confusion for many English speakers – assume similar issues will arise with foreign languages and countries. Icons need to be vetted for cultural relevance. What does a thumbs-up or a green tick mean? Language should be relatively neutral – addressing users in a particular manner may be acceptable in one region, but considered rude in another.


C++ and Java programmers may find the ICU website useful:

Leave a Comment