ResourceLoader Module for serving json based localization messages

ApiULSLocalization is still present since we have to provide live
language preview feature.

Moved the loading of json file to includes/JsonMessageLoader.php

Also moved all RL modules to includes folder.

Bug: 56509
Change-Id: Ic39dec1c484982fb07edd167e83794c0b5f470ee
This commit is contained in:
Santhosh Thottingal
2013-11-04 16:15:07 +05:30
committed by Niklas Laxström
parent 03dabe1681
commit 76e82e4a9c
7 changed files with 165 additions and 39 deletions

View File

@@ -34,10 +34,22 @@
// ApiULSLocalization handles fallback in ULS
$.i18n.fallbacks = {};
mw.uls.loadLocalization = function ( locale ) {
/**
* Load localization messags for a locale to the jquery.i18n
* messagestore.
* Also called by RL module ResourceLoaderULSJsonMessageModule
* @param {string} locale the language code
* @param {Object} [messages]
* @return {jQuery.Deferred}
*/
mw.uls.loadLocalization = function ( locale, messages ) {
var i18n = $.i18n();
i18n.locale = locale;
if ( messages ) {
i18n.load( messages, locale );
return $.Deferred().resolve();
}
if ( i18n.messageStore.messages[locale] ) {
return $.Deferred().resolve();
}