Localization: Tips & Tricks
Localizing your product is a great way to reach new markets and generate more revenue. However, it will only be beneficial if you avoid the most common problems with localization. There are some simple and easy-to-follow tips that you can utilize to make sure that your localization process is successful.
Give your texts enough space
If you have tight layouts, a rough rule of thumb is to double the English text and make sure it fits.
Then you will usually have enough space for translations.
Russian and German tend to have the longest translations, and the longest words. Get familiar with the shy-hyphen ­
character. You put it in the word's HTML, and it will only break the word/show the hyphen when necessary.
You can also Google: "online hyphenation tool"
so you know the appropriate places to break the word. Here are some example applications:
Number translations
You need to translate numbers with decimals and commas because they are reversed in some languages. For example: period appears as a comma, comma as a period.
If you are a JavaScript developer, then you can simply use Number object to format numbers. See example below:
var exampleNumber = 123456.789;
exampleNumber.toLocaleString('pl-PL');
// output: 123.456,789
number.toLocaleString('ar-EG');
// output: ١٢٣٤٥٦٫٧٨٩
Percent sign problem
The same goes for percent signs. Sometimes the % shows before the number, and not after also there might be a space between the number and percentage sign. English style guides recommend writing the percent sign (%) following the number with no space between (e.g., 50%) however this might differ for different languages.
- In Turkish and some other Turkic languages, the % sign precedes rather than follows the number without an intervening space.
- In Persian the % sign may appear before or after the numeric value, in either case without a space.
- In Arabic, the % sign is to the left of numbers, as numbers are written from right-to-left. This means that the % sign is to the left of a number. Usually, there will not be a space between this % sign and the number.
Watch out for Greek question marks
The Greek question mark (;) is often mistaken for a semicolon (;). The former marks the end of a sentence or phrase, while the latter is used to separate clauses in the same sentence.
Keep datetime in UTC
- Always keep datetime in database in UTC.
- Always return datetime from backend in UTC.
- Adjust datetime on UI layer using timezone information from user or web browser.
- Accept datetime in backend with any timezone.
You don't need any special library to format time from UTC to local for users. You can use standard JavaScript Date object like below:
new Date('2010-10-04T09:48:11.000000Z').toLocaleString('en-US', {
timeZone: 'Asia/Calcutta'
});
The main benefit to that is that the time is always guaranteed to be consistent. However, if you would like to reproduce some bug for a user in different timezone, it might be more challenging. You will be forced to change timezone in your web browser to get the same data as your users sees.