Last modified: 2014-09-25 18:02:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60139, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58139 - ResourceLoader: 'languageScripts' in the file module should look for fallback languages
ResourceLoader: 'languageScripts' in the file module should look for fallback...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
unspecified
All All
: High normal (vote)
: 1.25.0 release
Assigned To: Kunal Mehta (Legoktm)
: i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-07 01:19 UTC by Krinkle
Modified: 2014-09-25 18:02 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Krinkle 2013-12-07 01:19:14 UTC
It is by design that ResourceLoader expects languageScripts to be complete (e.g. no partial fallback) because they are free-form javascript.

However we should still support fallbacks.

e.g. in a case of momentjs, jquery.i18n, or jquery.ui.datepicker like:

	'jquery.ui.datepicker' => array(
		'languageScripts' => array(
			'af' => 'jquery.ui.datepicker-af.js',
			'cs' => 'jquery.ui.datepicker-cs.js',
			'de' => 'jquery.ui.datepicker-de.js',
			'el' => 'jquery.ui.datepicker-el.js',
			'en-gb' => 'jquery.ui.datepicker-en-GB.js',
			'ru' => 'jquery.ui.datepicker-ru.js',

When, for example, using de-formal, since it isn't specified, should result in 'de' being loaded instead. Not falling back straight to 'en'.

Same for 'ab' falling back to 'ru' etc.
Comment 1 Siebrand Mazeland 2013-12-07 01:21:01 UTC
Currently, only $wgExtensionMessagesFiles backed i18n supports proper fallback. jquery.ui.datepicker is just some random library, as far as I know.
Comment 2 Krinkle 2013-12-07 01:51:24 UTC
This isn't about fallback of individual messages, because this is for logic files (as opposed to message blobs, which we already transport as JSON and resolve server-side using MediaWiki's localization framework).

E.g. files such as:

 modules: {
   'jquery.ui.datepicker': {
     languageScripts: {
       af: 'jquery.ui.datepicker-af.js'

   'mediawiki.language': {
     languageScripts: {
       bs: 'languages/bs.js'

   'jquery.i18n': {
     languageScripts: {
       bs: 'src/languages/bs.js'

   'moment': {
     languageScripts: {
       ar: 'lang/ar.js'

In all of these cases, if the library doesn't have a specific file for the current language, wouldn't you want ResourceLoader to look at the fallbacks for that language and see if we can pick another one as fallback?

Right now if there isn't a language script for the specific language code, ResourceLoader will just use the default ('en').
Comment 3 Mark A. Hershberger 2014-05-09 15:37:13 UTC
Krinkle, Has this been worked on at all?  Moving to 1.24
Comment 4 Krinkle 2014-08-29 02:03:27 UTC
We want better i18n for smaller languages with fallbacks other than 'en'. Especially with upstream translations like jquery-ui and moment.js, having fallbacks here is useful to users.
Comment 5 Gerrit Notification Bot 2014-08-29 17:15:27 UTC
Change 157180 had a related patch set uploaded by Legoktm:
ResourceLoaderFileModule: Support fallback in 'languageScripts'

https://gerrit.wikimedia.org/r/157180
Comment 6 Gerrit Notification Bot 2014-09-25 18:01:20 UTC
Change 157180 merged by jenkins-bot:
ResourceLoaderFileModule: Support fallback in 'languageScripts'

https://gerrit.wikimedia.org/r/157180

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links