falsehoods programmers believe about languages · english and chinese and italian and arabic and...
TRANSCRIPT
![Page 1: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/1.jpg)
Falsehoods programmers believe about languages
Why localizable software is hardRoan Kattouw
CC-BY-SA 4.0
![Page 2: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/2.jpg)
Wikipedia Logos CC-BY-SA 3.0 Wikimedia Foundation
![Page 3: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/3.jpg)
Truth:Languages are hard
![Page 4: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/4.jpg)
https://commons.wikimedia.org/wiki/File:German_definite_article_declension.png
![Page 5: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/5.jpg)
https://commons.wikimedia.org/wiki/File:AMB_Japanese_Verbs.pdf
![Page 6: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/6.jpg)
Falsehood #0:I don’t have to deal with this
![Page 7: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/7.jpg)
“I presume that it would be only the exceptional Web site that gets localized for English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi, to name a few languages that benefit from large numbers of programmers or Web viewers or both.”
Localization Horror Story (Sean M. Burke and Jordan Lachler, 1999)
![Page 8: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/8.jpg)
“I presume that it would be only the exceptional Web site that gets localized for English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi, to name a few languages that benefit from large numbers of programmers or Web viewers or both.”
(top 10 languages, >200M speakers)
Localization Horror Story (Sean M. Burke and Jordan Lachler, 1999)
![Page 9: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/9.jpg)
http://globalbydesign.com/2014/04/07/wikipedia-and-the-internet-language-chasm/
![Page 10: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/10.jpg)
http://globalbydesign.com/2014/04/07/wikipedia-and-the-internet-language-chasm/
![Page 11: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/11.jpg)
Wikipedia Logo CC-BY-SA 3.0 Wikimedia Foundation https://commons.wikimedia.org/wiki/File:Wikipedia-logo-v2-zh.svg
![Page 12: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/12.jpg)
Things that aren’t cool anymore● Two-digit years● 32-bit timestamps● Not using version control● Rolling your own crypto● Not internationalizing your code
![Page 13: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/13.jpg)
Side note: confusing acronymsLocale = language + region (e.g. en-US)
l10n = localization: translating/adapting for a specific locale
i18n = internationalization: infrastructure/code that enables l10n generally
![Page 14: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/14.jpg)
Side note: confusing acronyms numeronymsLocale = language + region (e.g. en-US)
l10n = localization: translating/adapting for a specific locale
i18n = internationalization: infrastructure/code that enables l10n generally
10 chars
18 chars
![Page 15: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/15.jpg)
Falsehood #1:I can still put English strings in my code
![Page 16: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/16.jpg)
GNU gettextIn hello.c:printf(gettext("Hello, world!\n"));
In nl.po:#: src/hello.c:42msgid "Hello, world!\n"msgstr "Hallo, wereld!\n"
(also hello.pot but that one isn’t interesting)
![Page 17: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/17.jpg)
MediaWikiIn SpecialUserLogin.php:
$title = wfMessage( 'loginsuccesstitle' )->text();
In en.json:
"loginsuccesstitle": "Logged in",
In nl.json:
"loginsuccesstitle": "Aangemeld",
![Page 18: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/18.jpg)
Advantages of named messages● Same English text can be translated differently in different contexts● Messages can be reused where it does make sense● Message documentation can be more specific about context● Developers are reminded that i18n is a thing● Hardcoded English is a red flag → harder to forget i18n
![Page 19: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/19.jpg)
Yes really, message documentation!In qqq.json:
"loginsuccesstitle": "The title of the page saying that you are logged in. The content of the page is the message {{msg-mw|Loginsuccess}}.\n{{Identical|Log in}}",
● Fake language code lets us put docs outside the code → more detailed docs● Docs explain context and parameters● CI fails on undocumented messages (grunt-banana-checker)
![Page 20: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/20.jpg)
Falsehood #2:sprintf-style parameters are fine
![Page 21: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/21.jpg)
Parameter orderprintf(gettext("%d matches in %d files"), matches, files);
What if the translation looks like "%d files with %d matches"?
![Page 22: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/22.jpg)
Parameter orderprintf(gettext("%d matches in %d files"), matches, files);
What if the translation looks like "%d files with %d matches"?
MediaWiki uses numbered parameters:"This page was last edited on $1, at $2."
jQuery Globalize uses the ICU message format:"This page was last edited on {1}, at {2}."
"This page was last edited on {date}, at {time}."
![Page 23: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/23.jpg)
Falsehood #3:Displaying/parsing numbers is simple
![Page 24: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/24.jpg)
Decimal and thousand separatorsEnglish: 1,234,567.89
![Page 25: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/25.jpg)
Decimal and thousand separatorsEnglish: 1,234,567.89Spanish: 1.234.567,89
![Page 26: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/26.jpg)
Decimal and thousand separatorsEnglish: 1,234,567.89Spanish: 1.234.567,89French: 1 234 567,89
![Page 27: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/27.jpg)
Decimal and thousand separatorsEnglish: 1,234,567.89Spanish: 1.234.567,89French: 1 234 567,89 (U+00A0 NO-BREAK SPACE)
![Page 28: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/28.jpg)
Decimal and thousand separatorsEnglish: 1,234,567.89Spanish: 1.234.567,89French: 1 234 567,89 (U+00A0 NO-BREAK SPACE)
German(*): 1’234’567,89
![Page 29: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/29.jpg)
Decimal and thousand separatorsEnglish: 1,234,567.89Spanish: 1.234.567,89French: 1 234 567,89 (U+00A0 NO-BREAK SPACE)
German(*): 1’234’567,89
(*) As spoken in Switzerland
![Page 30: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/30.jpg)
Thousand separatorsEnglish: 1,234,567,890
![Page 31: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/31.jpg)
Thousand separatorsEnglish: 1,234,567,890English(*): 1,23,45,67,890
![Page 32: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/32.jpg)
Thousand separatorsEnglish: 1,234,567,890English(*): 1,23,45,67,890(*) As spoken in India
![Page 33: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/33.jpg)
Thousand Group separatorsEnglish: 1,234,567,890English(*): 1,23,45,67,890(*) As spoken in India
● 103 = thousand● 106 = million● 109 = billion
● 103 = thousand● 105 = lakh● 107 = crore
![Page 34: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/34.jpg)
But apart from separators, they’re just numbers, right?
![Page 35: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/35.jpg)
English: 1,234,567,890
![Page 36: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/36.jpg)
English: 1,234,567,890Lao: ໑,໒໓໔,໕໖໗,໘໙໐ (U+0ED1 LAO DIGIT ONE etc)
Burmese: ၁,၂၃၄,၅၆၇,၈၉၀
![Page 37: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/37.jpg)
English: 1,234,567,890Lao: ໑,໒໓໔,໕໖໗,໘໙໐Burmese: ၁,၂၃၄,၅၆၇,၈၉၀Bengali: ১,২৩,৪৫,৬৭,৮৯০
![Page 38: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/38.jpg)
English: 1,234,567,890Lao: ໑,໒໓໔,໕໖໗,໘໙໐Burmese: ၁,၂၃၄,၅၆၇,၈၉၀Bengali: ১,২৩,৪৫,৬৭,৮৯০
Not 8 Not 9
![Page 39: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/39.jpg)
English: 1,234,567,890Lao: ໑,໒໓໔,໕໖໗,໘໙໐Burmese: ၁,၂၃၄,၅၆၇,၈၉၀Bengali: ১,২৩,৪৫,৬৭,৮৯০Arabic: ١،٢٣٤،٥٦٧،٨٩٠
![Page 40: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/40.jpg)
English: 1,234,567,890Lao: ໑,໒໓໔,໕໖໗,໘໙໐Burmese: ၁,၂၃၄,၅၆၇,၈၉၀Bengali: ১,২৩,৪৫,৬৭,৮৯০Arabic: ١،٢٣٤،٥٦٧،٨٩٠ (U+066C ARABIC THOUSANDS SEPARATOR)(U+0660 ARABIC-INDIC DIGIT ZERO)
![Page 41: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/41.jpg)
English: 1,234,567,890Lao: ໑,໒໓໔,໕໖໗,໘໙໐Burmese: ၁,၂၃၄,၅၆၇,၈၉၀Bengali: ১,২৩,৪৫,৬৭,৮৯০Arabic: ١،٢٣٤،٥٦٧،٨٩٠
![Page 42: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/42.jpg)
What this meansSpecial functions for formatting numbers:
wfMessage( 'foo' )->numParams( $bar )->text()
And for parsing them:
$this->getLanguage()->parseFormattedNumber( $foo )
![Page 43: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/43.jpg)
![Page 44: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/44.jpg)
Falsehood #4:“3 file(s) selected” isn’t so bad
![Page 45: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/45.jpg)
![Page 46: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/46.jpg)
Plurals in English
n = 1 singular 1 house
otherwise plural 2 houses, 3 houses, ...
![Page 47: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/47.jpg)
Plurals in Hebrew
http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html is apparently wrong on this
n = 1 singular שנה
n = 2 dual 2 שנתיים
n = 3..10 plural 3 שנים, 4 שנים, ...
otherwise sometimes singular,sometimes plural,sometimes both OK
11 שנה, 20 שנה
![Page 48: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/48.jpg)
Plurals in Welsh
n = 0 zero 0 cŵn, 0 cathod
n = 1 singular 1 ci, 1 gath
n = 2 dual 2 gi, 2 gath
n = 3 “few” 3 chi, 3 cath
n = 6 “many” 6 chi, 6 chath
otherwise “other” 11 ci, 11 cath
http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
![Page 49: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/49.jpg)
Plurals in WelshYes, really: ŵ
U+0175 (LATIN SMALL LETTER W WITH CIRCUMFLEX)
n = 0 zero 0 cŵn, 0 cathod
n = 1 singular 1 ci, 1 gath
n = 2 dual 2 gi, 2 gath
n = 3 “few” 3 chi, 3 cath
n = 6 “many” 6 chi, 6 chath
otherwise “other” 11 ci, 11 cath
http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
![Page 50: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/50.jpg)
Plurals in Icelandic
http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
n mod 10 = 1 &&n mod 100 != 11
singular 1 dagur, 21 dagur
otherwise plural 2 dagar, 11 dagar
![Page 51: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/51.jpg)
Plurals in Polish
http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
n = 1 singular 1 miesiąc
n mod 10 = 2..4 &&n mod 100 != 12..14
“few” 2 miesiące
otherwise “other” 5 miesięcy
(according to CLDR there’s also a fourth form for fractions, but I’m restricting myself to integers here)
![Page 52: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/52.jpg)
Ordinals in English
n mod 10 = 1 &&n mod 100 != 11
-st 1st, 21st, 31st, 101st, 121st
n mod 10 = 2 &&n mod 100 != 12
-nd 2nd, 22nd, 32nd, 102nd, 122nd
n mod 10 = 3 &&n mod 100 != 13
-rd 3rd, 23rd, 33rd, 103rd, 123rd
otherwise -th 4th, 5th, 11th, 12th, 13th, 111th, 112th, 113th
![Page 53: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/53.jpg)
Plural handlingMediaWiki:
"Undelete {{PLURAL:$1|one edit|$1 edits}}",
"odtwórz {{PLURAL:$1|1 wersję|$1 wersje|$1 wersji}}"
"{{PLURAL:$1|one edit|$1 edits|0=no edits}} found"
![Page 54: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/54.jpg)
Plural handlingICU / jQuery Globalize:
"Undelete {edits,plural, one{one edit} plural{# edits}}"
"odtwórz {edits,plural, one{1 wersję} few{# wersje} many{# wersji}}"
"{edits,plural, one{one edit} plural{# edits} =0{no edits}} found"
![Page 55: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/55.jpg)
Falsehood #5:It doesn't matter who the user is
![Page 56: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/56.jpg)
English:
"confirmable-confirm": "Are you sure?",
French:
"confirmable-confirm": "Êtes-vous sûr?",
![Page 57: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/57.jpg)
Gender mattersEnglish:
"confirmable-confirm": "Are you sure?",
French (male):
"confirmable-confirm": "Êtes-vous sûr?",
French (female):
"confirmable-confirm": "Êtes-vous sûre?",
![Page 58: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/58.jpg)
Gender syntax (MediaWiki)English (no-op gender as hint to translators):
"Are {{GENDER:$1|you}} sure?"
French:
"Êtes-vous {{GENDER:$1|sûr|sûre}}?"
![Page 59: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/59.jpg)
Gender syntax (MediaWiki)Useful in English too:
"$1 mentioned {{GENDER:$2|you}} on {{GENDER:$1|his|her|their}} talk page"
French varies on the other user ("you") instead:
"$1 vous a {{GENDER:$2|mentionné|mentionnée}} sur sa page de discussion"
![Page 60: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/60.jpg)
Gender syntax (ICU)Êtes-vous {gender, select, male{sûr} female{sûre} other{sûr}}?
![Page 61: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/61.jpg)
![Page 62: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/62.jpg)
Falsehood #6:I can concatenate messages
![Page 63: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/63.jpg)
"Lego messages" considered harmfulMessages should be full sentences. Don't do things like this:
"born-in-month": "This user was born in the month of","january": "January",..."december": "December",
msg( 'born-in-month' ) + ' ' + msg( month ) + '.'
![Page 64: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/64.jpg)
"Lego messages" considered harmfulString concatenation outside the control of the translator = problem
Use parameters instead:
"born-in-month": "This user was born in the month of $1.",
monthname = msg( month );msg( 'born-in-month', monthname )
![Page 65: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/65.jpg)
Falsehood #7:People write this way --->
![Page 66: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/66.jpg)
![Page 67: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/67.jpg)
![Page 68: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/68.jpg)
Language directionality● Left-to-right (LTR): most languages● Right-to-left (RTL): Arabic, Hebrew, Persian, a few others● Top-to-bottom (TTB): Classical Chinese; sometimes modern Chinese too
○ Restaurant signs etc are often TTBRTL
https://commons.wikimedia.org/wiki/File:浙江姓解1.jpeg
![Page 69: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/69.jpg)
CSS and RTL.foobar {
float: right;margin-left: 5px;padding: 0.5em 1em 0.25em 0;background-position-x: 25%;
}
![Page 70: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/70.jpg)
CSS and RTL.foobar {
float: right;margin-left: 5px;padding: 0.5em 1em 0.25em 0;background-position-x: 25%;
}
![Page 71: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/71.jpg)
CSSJanus
.foobar {float: right;margin-left: 5px;padding: 0.5em 1em 0.25em 0;background-position-x: 25%;
}
.foobar {float: left;margin-right: 5px;padding: 0.5em 0 0.25em 1em;background-position-x: 75%;
}
Tool that flips CSS around
![Page 72: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/72.jpg)
CSSJanus: flip images.icon-bulletList {
background-image: url(bulletList-ltr.svg);}
.icon-bulletList {background-image: url(bulletList-rtl.svg);
}
![Page 74: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/74.jpg)
Keep Calm andi18n all the things
![Page 75: Falsehoods programmers believe about languages · English and Chinese and Italian and Arabic and Russian, [...] to say nothing of German, Spanish, French, Japanese, Finnish, and Hindi,](https://reader034.vdocument.in/reader034/viewer/2022042309/5ed6c43dfef0056b43704db1/html5/thumbnails/75.jpg)
Resources● jQuery Globalize: https://github.com/globalizejs
○ Now with React plugin
● MediaWiki i18n documentation: https://www.mediawiki.org/wiki/Localisation ○ Contains generally applicable advice
● CSSJanus: https://cssjanus.github.io/ ● RTL craziness: http://rtl.wtf