4 ms·
The Unicode CLDR has a whole database of formatted strings for each locale, for more or less the reason you describe. Formatting dates or big numbers (12345 ->
by ucarion 9y ago
The Unicode CLDR has a whole database of formatted strings for each locale, for more or less the reason you describe. Formatting dates or big numbers (12345 -> 12.3k) is impossible to achieve without a generic formatting language.
Pluralization is another nightmare of its own. Look into how Russian and similar languages pluralize. It has to do with the value of the number modulo 10, similar to English ordinals.
CLDR: http://cldr.unicode.org/ http://cldr.unicode.org/
- wingerlang 9y agoI went to a presentation by a company that dealt with translation, he mentioned this issue and his recommendation was to simply not try to be smart with it and have separate strings where pluralisation is done properly in each one.
- moses-palmer 9y agoWhat about gettext _N? I have used a library with a similar interface, and we didn't even get complaints for Slavic languages with very complex pluralisation rules.
- jwilk 9y agoGNU gettext has pretty good support for translating messages with numerals: https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html https://www.gnu.org/software/gettext/manual/html_node/Plural... https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html https://www.gnu.org/software/gettext/manual/html_node/Transl...
- asveikau 9y agoThat works when there are a small number of possible numerical values. But cldr has a table of plural rules for each of these languages and it's not bad to solve the problem for arbitrary integers.