dojo/i18n.js

  • Provides:

    • dojo.i18n
  • dojo.i18n

    • type
      Object
    • summary
      Utility classes to enable loading of resources for internationalization (i18n)
  • clazz

    • type
      Function
    • source: [view]
      }
    • summary
  • dojo.i18n.normalizeLocale

    • type
      Function
    • parameters:
      • locale: (typeof String)
    • source: [view]
       var result = locale ? locale.toLowerCase() : dojo.locale;
       if(result == "root"){
        result = "ROOT";
       }
       return result; // String
    • summary
      Returns canonical form of locale, as used by Dojo.
    • description
      All variants are case-insensitive and are separated by '-' as specified in [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
      If no locale is specified, the dojo.locale is returned.  dojo.locale is defined by
      the user agent's locale unless overridden by djConfig.
    • returns
      String
  • dojo.i18n._requireLocalization

    • type
      Function
    • parameters:
      • moduleName: (typeof String)
      • bundleName: (typeof String)
      • locale: (typeof String)
      • availableFlatLocales: (typeof String)
      • m: (typeof )
      • b: (typeof )
    • source: [view]
         req(m,b,locale, availableFlatLocales);
         if(locale){return;}
         for(var i=0; i    req(m,b,extra[i], availableFlatLocales);
         }
    • summary
      See dojo.requireLocalization()
    • description
      Called by the bootstrap, but factored out so that it is only
      included in the build when needed.
  • dojo.i18n._searchLocalePath

    • type
      Function
    • parameters:
      • locale: (typeof String)
      • down: (typeof Boolean)
      • searchFunc: (typeof Function)
    • source: [view]
       locale = dojo.i18n.normalizeLocale(locale);


       var elements = locale.split('-');
       var searchlist = [];
       for(var i = elements.length; i > 0; i--){
        searchlist.push(elements.slice(0, i).join('-'));
       }
       searchlist.push(false);
       if(down){searchlist.reverse();}


       for(var j = searchlist.length - 1; j >= 0; j--){
        var loc = searchlist[j] || "ROOT";
        var stop = searchFunc(loc);
        if(stop){ break; }
       }
    • summary
      A helper method to assist in searching for locale-based resources.
      Will iterate through the variants of a particular locale, either up
      or down, executing a callback function.  For example, "en-us" and
      true will try "en-us" followed by "en" and finally "ROOT".
  • dojo.i18n._preloadLocalizations

    • type
      Function
    • parameters:
      • bundlePrefix: (typeof String)
      • localesGenerated: (typeof Array)
    • source: [view]
       function preload(locale){
        locale = dojo.i18n.normalizeLocale(locale);
        dojo.i18n._searchLocalePath(locale, true, function(loc){
         for(var i=0; i    if(localesGenerated[i] == loc){
           dojo["require"](bundlePrefix+"_"+loc);
           return true; // Boolean
          }
         }
         return false; // Boolean
        });
       }
       preload();
       var extra = dojo.config.extraLocale||[];
       for(var i=0; i  preload(extra[i]);
       }
    • summary
      Load built, flattened resource bundles, if available for all
      locales used in the page. Only called by built layer files.
    • returns
      Boolean
  • dojo.i18n.getLocalization

    • summary
  • locale

    • summary
  • elements

    • summary
  • module

    • summary
  • obj

    • summary
  • bundle

    • summary
  • i

    • summary
  • loc

    • summary
  • localization

    • summary
  • clazz.prototype

    • summary
  • dojo

    • type
      Object
    • summary