I would recommend using l10ns . For any project related to i18n, you need the following:
- A good storage system that stores a localization string.
- A good localization format that can handle complex formatting, not just simple strings. And by complex formatting, I mean a format that can handle multiple formatting, gender / context based formatting, number formatting, date formatting, etc.
There are very few tools that process both of these points. The most common solution is to use gettext with xgettext . xgettext is a tool that moves your source code to synchronize localization keys between source code and localization storage. Although gettext is not so good at handling point 2. For example, you cannot format a string with two plural words. Therefore, strings like I like 2 cats and 1 dog are very difficult to format. Multiple formatting is a very difficult task to solve and has many edge cases. Let's say that instead of loving only two cats, we like 2000. The correct formatted string would be I like 2,000 cats and 1 dog . Have you noticed at 2,000 ? Therefore, to correctly use the multiple gettext solution, we also need to use an external library to handle number formatting.
So, for point 2, which has a good localization format. I believe that ICU MessageFormat handles this best. It is a markup language that deals with l10n formatting and is used by many large companies such as Google, Apple and Yahoo. It handles the boundary cases with the multiple formatting mentioned above. It also handles many other types of complex formatting. For example, gender context, ordinal formatting, number formatting and date formatting, etc.
One tool that supports ICU MessageFormat and has l10ns built-in storage. It also supports xgettext . You write the source code and then synchronize your localization keys.
einstein
source share