wikimedia-gadgets / twinkle-core

Core for localised versions of Twinkle
Other
3 stars 5 forks source link

Evaluate use of string i18n library in Twinkle #1

Closed siddharthvp closed 3 years ago

siddharthvp commented 3 years ago

JS string i18n libraries used on MediaWiki are all typically written for use in the wgUserLanguage rather than the wgContentLanguage. This poses a problem for Twinkle since many of our i18n string usages are in edited text; and edits saved to wikis should be in the content language of the wiki.

mediawiki.language is a collection of utilities but doesn't offer a message parser. Also, it's based on wgUserLanguage, whichc can't be changed.

mw.Message and mw.jqueryMsg

jquery.i18n

banana-i18n

i18next

Likely options: jquery.i18n and banana-i18n.

jquery.i18n vs banana-i18n

Issues with banana-i18n:

None of these libraries appear to support the mw.language.listToText-like function in messages. This makes it seemingly impossible to localise strings of the form "Added tag1, tag2 and tag3 to article" (here, the number of tags is variable).

siddharthvp commented 3 years ago

For the numeral translation limitation of https://github.com/wikimedia/banana-i18n, I have submitted a patch: https://github.com/wikimedia/banana-i18n/pull/43

At the moment, however, it doesn't look like there is anyone active over there (the main maintainer is on a long leave). The plan as of now is to create a fork of banana-i18n with the following changes:

siddharthvp commented 3 years ago

Created https://github.com/wikimedia-gadgets/orange-i18n with the above-mentioned changes.

siddharthvp commented 3 years ago

None of these libraries appear to support the mw.language.listToText-like function in messages. This makes it seemingly impossible to localise strings of the form "Added tag1, tag2 and tag3 to article" (here, the number of tags is variable).

Support for this is now implemented in orange-i18n (see README patches # 3).