Make WordPress Core

Ticket #24183: 24183.me.2.patch

File 24183.me.2.patch, 1.6 KB (added by SergeyBiryukov, 12 years ago)
  • src/js/me-i18n.js

    diff --git src/js/me-i18n.js src/js/me-i18n.js
    index 6c86cfa..a68c324 100644
     
    4545    "use strict";
    4646    var i18n = {
    4747        "locale": {
     48            "language" : '',
    4849            "strings" : {}
    4950        },
    5051        "methods" : {}
     
    5859     * @see: i18n.methods.t()
    5960     */
    6061    i18n.locale.getLanguage = function () {
    61         return i18n.locale || {
    62             "language" : navigator.language
    63         };
     62        return i18n.locale.language || navigator.language;
    6463    };
    6564
     65    if ( typeof mejsL10n != 'undefined' ) {
     66        i18n.locale.language = mejsL10n.language;
     67    }
     68
    6669    /**
    6770     * Store the language the locale object was initialized with
    6871     */
     
    171174
    172175        if (typeof str === 'string' && str.length > 0) {
    173176
    174             // check every time due languge can change for
     177            // check every time due language can change for
    175178            // different reasons (translation, lang switcher ..)
    176             var lang = i18n.locale.getLanguage();
     179            var language = i18n.locale.getLanguage();
    177180
    178181            options = options || {
    179                 "context" : lang.language
     182                "context" : language
    180183            };
    181184
    182185            return i18n.methods.t(str, args, options);
     
    195198
    196199;(function(exports, undefined) {
    197200
    198         "use strict";
     201    "use strict";
    199202
    200         if ( mejs.i18n.locale.language && mejs.i18n.locale.strings ) {
    201                 exports[mejs.i18n.locale.language] = mejs.i18n.locale.strings;
    202         }
     203    if ( typeof mejsL10n != 'undefined' ) {
     204        exports[mejsL10n.language] = mejsL10n.strings;
     205    };
    203206
    204207}(mejs.i18n.locale.strings));