https://translatewiki.net/ contains source and translated messages for many projects, including MediaWiki and many extensions.
The source messages often contain syntax that must be preserved in the translated message, per localisation guidelines; checkers are designed to prevent mistakes.
Translators occasionally either omit or corrupt the syntax in the translation.
This task is to find and fix two translated messages in a Wikimedia repository that has incorrect syntax.
UI search
- https://translatewiki.net/wiki/Special:SearchTranslations helps find messages searching either the source or the translation, optionally filtered by language and/or repository.
- https://translatewiki.net/wiki/Special:Search can be used for regex search (via MediaWiki's CirrusSearch extension and can filter for MediaWiki messages.
- https://codesearch.wmflabs.org/ by using some smart regexes. Examples:
- [[ https://codesearch.wmflabs.org/search/?q=%5C%7B%5C%7B%20*(GRAMMAR%7CGENDER%7CPLURAL)%20*%5B%5E%20%3A%5D&i=nope&files=i18n&repos= | \{\{ *(GRAMMAR|GENDER|PLURAL) *[^ :] ]]
- [[ https://codesearch.wmflabs.org/search/?q=%5C%7B%5C%7B%20*PLURAL%20*%3A%20*(%5B%5E%20%24%7D%5D%7C%5C%24%5B%5E0-9%5D%7C%5C%24%5B0-9%5D%2B%20*%5B%5E%20%7C0-9%5D)&i=nope&files=i18n&repos= | \{\{ *PLURAL *: *([^ $}]|\$[^0-9]|\$[0-9]+ *[^ |0-9]) ]]
- [[ https://codesearch.wmflabs.org/search/?q=%5C%7B%5C%7B%20*GENDER%20*%3A%20*(%5B%5E%20%7B%7C%24%5D%7C%5C%24%5B%5E0-9%5D%7C%5C%24%5B0-9%5D%2B%20*%5B%5E%20%7C0-9%5D)&i=nope&files=i18n&repos= | \{\{ *GENDER *: *([^ {|$]|\$[^0-9]|\$[0-9]+ *[^ |0-9]) ]]
- [[ https://codesearch.wmflabs.org/search/?q=%5C%7B%5C%7B%20*GRAMMAR%20*%3A%20*%5B%7C%24%5D&i=nope&files=i18n&repos= | \{\{ *GRAMMAR *: *[|$] ]]
Manual search
To find syntax errors in translated messages, [git clone](https://www.mediawiki.org/wiki/Gerrit/Tutorial) the repository containing the translations.
Then use tools to look for problems. The simplest tools to use are generic text search programs like grep, or a Windows equivalent.
For example, git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git (for an anonymous checkout).
In the languages/i18n, read the en.json (English) and qqq.json (Description) files to learn about each message. Look for syntax which might become broken by a translator.
The variable syntax is $1, $2, etc. Sometimes translators add a space in the middle, like $ 1
$ git grep '\$ 1' azb.json: "blockedtext": "' 'ایستیفاده<U+200C>چی آدی و یا آی پی عنوانینیز قاباغی باغلانیب دیر.'\n\nسیزی باغلایان$ 1. الیله اولوب دیر \nباغلاماق سببی:' $ 2.\n\n* باغلانمانین باشلانان زامانی: $ 8\n* باغلانمانین قورتولان زامانی: $ 6\n* باغلانما مدتی: $ 7\n\nگؤستریلن سببه گؤره ائنگئللئنمئنیزین اویغون اولمادیغینی دوشونورسونوزسه، $ 1 یا دا باشقا بیر [[{{MediaWiki:Grouppage-sysop}}|مدیر]] ایله بو وضعیتی گؤروشه بیلرسینیز. [[Special:Preferences|ترجیح لرینیز]] قیسمینده اعتبارلی بیر ائ-پوچت اونوانی گیرمئدیسئنیز \"ایستیفاده<U+200C>چییه ائ-پوچت گؤندر\" خصوصیتینی ایستیفاده ائده، ترجیهلرینیز ایمیل عنوانینیزی علاوه ایمیل گؤندرمک حقوقونا صاحب اولاجاقسینیز.\nبو آنکی باغلانما عنوانینیز $ 3، ائنگئللئنمئ نؤمره<U+200C>نیز # $ 5.\nبیر ایداره<U+200C>چی<U+200C>لر وضعیتینیز حاقیندا معلومات آلماق ایستدیگینیزده و یا هر هانسی بیر سورگودا بو معلومات<U+200C>لار لازیم اولا<U+200C>جاق، خاهیش ائدیریک نوت ائدین.", azb.json: "autoblockedtext": "\n' 'ایستیفاده<U+200C>چی آدی و یا آی پی عنوانینیز قاباغی باغلانیب دیر.'\n\nسیزی باغلایان$ 1. الیله اولوب دیر \nباغلاماق سببی:' $ 2.\n\n* باغلانمانین باشلانان زامانی: $ 8\n* باغلانمانین قورتولان زامانی: $ 6\n* باغلانما مدتی: $ 7\n\nگؤستریلن سببه گؤره ائنگئللئنمئنیزین اویغون اولمادیغینی دوشونورسونوزسه، $ 1 یا دا باشقا بیر [[{{MediaWiki:Grouppage-sysop}}|مدیر]] ایله بو وضعیتی گؤروشه بیلرسینیز. [[Special:Preferences|ترجیح لرینیز]] قیسمینده اعتبارلی بیر ائ-پوچت اونوانی گیرمئدیسئنیز \"ایستیفاده<U+200C>چییه ائ-پوچت گؤندر\" خصوصیتینی ایستیفاده ائده، ترجیهلرینیز ایمیل عنوانینیزی علاوه ایمیل گؤندرمک حقوقونا صاحب اولاجاقسینیز.\nبو آنکی باغلانما عنوانینیز $ 3، ائنگئللئنمئ نؤمره<U+200C>نیز # $ 5.\nبیر ایداره<U+200C>چی<U+200C>لر وضعیتینیز حاقیندا معلومات آلماق ایستدیگینیزده و یا هر هانسی بیر سورگودا بو معلومات<U+200C>لار لازیم اولا<U+200C>جاق، خاهیش ائدیریک نوت ائدین.", azb.json: "file-info-png-repeat": "$1 {{PLURAL:$ 1|دفعه| دفعه}} اویناتیلدی", khw.json: "databaseerror-function": "فنکشن: $ 1", khw.json: "databaseerror-error": "خرابی: $ 1", luz.json: "copyright": "مطلب دومن $ 1 هس نکه خلاف هونو ذکر وابی.", ses.json: "hiddencategories": "Moɲoo woo {{PLURAL:$1|dumi tugante$ 1}} no m'a may:", sq.json: "databaseerror-query": "\nPyetje: $ 1", sq.json: "no-null-revision": "I pamundur krijimi rishikimi i ri për faqen bosh \"$ 1\"", sw.json: "apihelp-no-such-module": "Moduli \"$ 1\" haikupatikana.", ur.json: "databaseerror-function": "فنکشن: $ 1", ur.json: "databaseerror-error": "خرابی: $ 1",
Another approach is to look for keywords.
For example, the source English message "viewcount" is "This page has been accessed {{PLURAL:$1|once|$1 times}}.", which uses the PLURAL magic word which implements grammatical number. See also Plural.
Using grep we can see all of the translations that have omitted the PLURAL quickly:
$ cd languages/i18n $ grep '"viewcount"' *.json | egrep -v '(qqq.json|PLURAL)' cv.json: "viewcount": "Ку страницăна $1 хут пăхнă.", ff.json: "viewcount": "Ngoo hello yillaama laabi $1.", gan-hans.json: "viewcount": "个页拖人眵嘞$1回。", gan-hant.json: "viewcount": "箇頁拕人眵哩$1回。", gn.json: "viewcount": "Esta página ha sido visitada $1 veces.", hak.json: "viewcount": "邇隻頁面已經分人瀏覽過$1次。", kk-arab.json: "viewcount": "بۇل بەت $1 رەت قاتىنالعان.", kk-latn.json: "viewcount": "Bul bet $1 ret qatınalğan.", lzh.json: "viewcount": "此頁$1閱矣", nan.json: "viewcount": "Chit ia̍h kàu taⁿ, hō͘ lâng khoàⁿ $1 pái.", th.json: "viewcount": "มีการเข้าถึงหน้านี้ $1 ครั้ง", to.json: "viewcount": "Naʻe laua he pēsí ni tuʻo $1.", wuu.json: "viewcount": "箇頁望過$1垡。", yue.json: "viewcount": "呢一頁已經有$1人次睇過。", zh-hans.json: "viewcount": "本页面已经被访问过$1次。", zh-hant.json: "viewcount": "此頁面已被檢視過 $1 次。",
Some of these languages may not have need to use PLURAL support for this message. See http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for the official list of plural rules for all languages.
Unofficial language information
More information about each language can be found on the Wikipedia article about the language.
If Wikipedia doesn't have the answer, you might look for information about languages on the Linguistics StackExchange, such as this discussion about South-East Asian plurals. If you can't find an existing question on Linguistics StackExchange relating to your problem, you can ask a new question on Linguistics StackExchange.
Examples
These are examples of this task being done:
- https://translatewiki.net/w/i.php?title=MediaWiki%3APagetitle-view-mainpage%2Fkri&type=revision&diff=7138660&oldid=3536925
- https://translatewiki.net/w/i.php?title=MediaWiki:Tagline/sat&diff=prev&oldid=7189500
List of tools that can help to find these problems: