|
|
10 |
__coverage__['build/widget-locale/widget-locale.js'] = {"path":"build/widget-locale/widget-locale.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":44}}},"2":{"name":"(anonymous_2)","line":46,"loc":{"start":{"line":46,"column":18},"end":{"line":46,"column":44}}},"3":{"name":"(anonymous_3)","line":65,"loc":{"start":{"line":65,"column":18},"end":{"line":65,"column":35}}},"4":{"name":"(anonymous_4)","line":79,"loc":{"start":{"line":79,"column":17},"end":{"line":79,"column":34}}},"5":{"name":"(anonymous_5)","line":120,"loc":{"start":{"line":120,"column":16},"end":{"line":120,"column":38}}},"6":{"name":"(anonymous_6)","line":158,"loc":{"start":{"line":158,"column":23},"end":{"line":158,"column":34}}},"7":{"name":"(anonymous_7)","line":162,"loc":{"start":{"line":162,"column":17},"end":{"line":162,"column":31}}},"8":{"name":"(anonymous_8)","line":166,"loc":{"start":{"line":166,"column":17},"end":{"line":166,"column":31}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":172,"column":44}},"2":{"start":{"line":12,"column":0},"end":{"line":17,"column":22}},"3":{"start":{"line":28,"column":0},"end":{"line":30,"column":2}},"4":{"start":{"line":33,"column":0},"end":{"line":33,"column":37}},"5":{"start":{"line":35,"column":0},"end":{"line":169,"column":9}},"6":{"start":{"line":47,"column":8},"end":{"line":47,"column":30}},"7":{"start":{"line":48,"column":8},"end":{"line":48,"column":38}},"8":{"start":{"line":50,"column":8},"end":{"line":52,"column":9}},"9":{"start":{"line":51,"column":12},"end":{"line":51,"column":30}},"10":{"start":{"line":54,"column":8},"end":{"line":54,"column":49}},"11":{"start":{"line":55,"column":8},"end":{"line":55,"column":28}},"12":{"start":{"line":66,"column":8},"end":{"line":66,"column":48}},"13":{"start":{"line":81,"column":8},"end":{"line":81,"column":60}},"14":{"start":{"line":84,"column":8},"end":{"line":90,"column":19}},"15":{"start":{"line":93,"column":8},"end":{"line":105,"column":9}},"16":{"start":{"line":94,"column":12},"end":{"line":94,"column":31}},"17":{"start":{"line":95,"column":12},"end":{"line":104,"column":13}},"18":{"start":{"line":96,"column":16},"end":{"line":96,"column":44}},"19":{"start":{"line":99,"column":16},"end":{"line":99,"column":54}},"20":{"start":{"line":100,"column":16},"end":{"line":102,"column":17}},"21":{"start":{"line":101,"column":20},"end":{"line":101,"column":56}},"22":{"start":{"line":103,"column":16},"end":{"line":103,"column":33}},"23":{"start":{"line":107,"column":8},"end":{"line":107,"column":20}},"24":{"start":{"line":122,"column":8},"end":{"line":122,"column":60}},"25":{"start":{"line":125,"column":8},"end":{"line":128,"column":45}},"26":{"start":{"line":131,"column":8},"end":{"line":146,"column":9}},"27":{"start":{"line":132,"column":12},"end":{"line":145,"column":32}},"28":{"start":{"line":134,"column":16},"end":{"line":134,"column":48}},"29":{"start":{"line":135,"column":16},"end":{"line":138,"column":17}},"30":{"start":{"line":136,"column":20},"end":{"line":136,"column":36}},"31":{"start":{"line":137,"column":20},"end":{"line":137,"column":26}},"32":{"start":{"line":139,"column":16},"end":{"line":139,"column":49}},"33":{"start":{"line":141,"column":16},"end":{"line":143,"column":17}},"34":{"start":{"line":142,"column":20},"end":{"line":142,"column":54}},"35":{"start":{"line":148,"column":8},"end":{"line":148,"column":19}},"36":{"start":{"line":159,"column":8},"end":{"line":159,"column":51}},"37":{"start":{"line":163,"column":8},"end":{"line":163,"column":55}},"38":{"start":{"line":167,"column":8},"end":{"line":167,"column":50}}},"branchMap":{"1":{"line":50,"type":"if","locations":[{"start":{"line":50,"column":8},"end":{"line":50,"column":8}},{"start":{"line":50,"column":8},"end":{"line":50,"column":8}}]},"2":{"line":81,"type":"binary-expr","locations":[{"start":{"line":81,"column":18},"end":{"line":81,"column":24}},{"start":{"line":81,"column":28},"end":{"line":81,"column":44}}]},"3":{"line":86,"type":"cond-expr","locations":[{"start":{"line":86,"column":31},"end":{"line":86,"column":47}},{"start":{"line":86,"column":50},"end":{"line":86,"column":52}}]},"4":{"line":93,"type":"if","locations":[{"start":{"line":93,"column":8},"end":{"line":93,"column":8}},{"start":{"line":93,"column":8},"end":{"line":93,"column":8}}]},"5":{"line":93,"type":"binary-expr","locations":[{"start":{"line":93,"column":12},"end":{"line":93,"column":32}},{"start":{"line":93,"column":36},"end":{"line":93,"column":61}}]},"6":{"line":100,"type":"if","locations":[{"start":{"line":100,"column":16},"end":{"line":100,"column":16}},{"start":{"line":100,"column":16},"end":{"line":100,"column":16}}]},"7":{"line":122,"type":"binary-expr","locations":[{"start":{"line":122,"column":18},"end":{"line":122,"column":24}},{"start":{"line":122,"column":28},"end":{"line":122,"column":44}}]},"8":{"line":126,"type":"binary-expr","locations":[{"start":{"line":126,"column":19},"end":{"line":126,"column":46}},{"start":{"line":126,"column":50},"end":{"line":126,"column":52}}]},"9":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":8},"end":{"line":131,"column":8}},{"start":{"line":131,"column":8},"end":{"line":131,"column":8}}]},"10":{"line":131,"type":"binary-expr","locations":[{"start":{"line":131,"column":12},"end":{"line":131,"column":32}},{"start":{"line":131,"column":36},"end":{"line":131,"column":45}}]},"11":{"line":135,"type":"if","locations":[{"start":{"line":135,"column":16},"end":{"line":135,"column":16}},{"start":{"line":135,"column":16},"end":{"line":135,"column":16}}]},"12":{"line":135,"type":"binary-expr","locations":[{"start":{"line":135,"column":20},"end":{"line":135,"column":24}},{"start":{"line":135,"column":28},"end":{"line":135,"column":39}}]},"13":{"line":141,"type":"if","locations":[{"start":{"line":141,"column":16},"end":{"line":141,"column":16}},{"start":{"line":141,"column":16},"end":{"line":141,"column":16}}]}},"code":["(function () { YUI.add('widget-locale', function (Y, NAME) {","","/**"," * Provides string support for widget with BCP 47 language tag lookup. This module has been deprecated."," * It's replaced by the \"intl\" module which provides generic internationalization and BCP 47 language tag"," * support with externalization."," *"," * @module widget-locale"," * @deprecated This module has been deprecated. It's replaced by the \"intl\" module which provides"," * generic internationalization and BCP 47 language tag support with externalization."," */","var TRUE = true,"," LOCALE = \"locale\","," INIT_VALUE = \"initValue\","," HYPHEN = \"-\","," EMPTY_STR = \"\","," Widget = Y.Widget;","","/**"," * @attribute locale"," * @deprecated Use Y.config.lang and Y.Intl externalization support"," * @description"," * The default locale for the widget. NOTE: Using get/set on the \"strings\" attribute will"," * return/set strings for this locale."," * @default \"en\""," * @type String"," */","Widget.ATTRS[LOCALE] = {"," value: \"en\"","};","","// Since strings support with locale needs the private _strs setup","Widget.ATTRS.strings.lazyAdd = false;","","Y.mix(Widget.prototype, {",""," /**"," * Sets strings for a particular locale, merging with any existing"," * strings which may already be defined for the locale."," *"," * @method _setStrings"," * @protected"," * @param {Object} strings The hash of string key/values to set"," * @param {Object} locale The locale for the string values being set"," */"," _setStrings : function(strings, locale) {"," var strs = this._strs;"," locale = locale.toLowerCase();",""," if (!strs[locale]) {"," strs[locale] = {};"," }",""," Y.aggregate(strs[locale], strings, TRUE);"," return strs[locale];"," },",""," /**"," * Returns the strings key/value hash for a paricular locale, without locale lookup applied."," *"," * @method _getStrings"," * @protected"," * @param {Object} locale"," */"," _getStrings : function(locale) {"," return this._strs[locale.toLowerCase()];"," },",""," /**"," * Gets the entire strings hash for a particular locale, performing locale lookup."," * <p>"," * If no values of the key are defined for a particular locale the value for the"," * default locale (in initial locale set for the class) is returned."," * </p>"," * @method getStrings"," * @param {String} locale (optional) The locale for which the string value is required. Defaults to the current locale, if not provided."," */"," // TODO: Optimize/Cache. Clear cache on _setStrings call."," getStrings : function(locale) {",""," locale = (locale || this.get(LOCALE)).toLowerCase();","",""," var defLocale = this.getDefaultLocale().toLowerCase(),"," defStrs = this._getStrings(defLocale),"," strs = (defStrs) ? Y.merge(defStrs) : {},"," localeSegments = locale.split(HYPHEN),"," localeStrs,"," i, l,"," lookup;",""," // If locale is different than the default, or needs lookup support"," if (locale !== defLocale || localeSegments.length > 1) {"," lookup = EMPTY_STR;"," for (i = 0, l = localeSegments.length; i < l; ++i) {"," lookup += localeSegments[i];","",""," localeStrs = this._getStrings(lookup);"," if (localeStrs) {"," Y.aggregate(strs, localeStrs, TRUE);"," }"," lookup += HYPHEN;"," }"," }",""," return strs;"," },",""," /**"," * Gets the string for a particular key, for a particular locale, performing locale lookup."," * <p>"," * If no values if defined for the key, for the given locale, the value for the"," * default locale (in initial locale set for the class) is returned."," * </p>"," * @method getString"," * @param {String} key The key."," * @param {String} locale (optional) The locale for which the string value is required. Defaults to the current locale, if not provided."," */"," getString : function(key, locale) {",""," locale = (locale || this.get(LOCALE)).toLowerCase();","",""," var defLocale = (this.getDefaultLocale()).toLowerCase(),"," strs = this._getStrings(defLocale) || {},"," str = strs[key],"," idx = locale.lastIndexOf(HYPHEN);",""," // If locale is different than the default, or needs lookup support"," if (locale !== defLocale || idx != -1) {"," do {",""," strs = this._getStrings(locale);"," if (strs && key in strs) {"," str = strs[key];"," break;"," }"," idx = locale.lastIndexOf(HYPHEN);"," // Chop of last locale segment"," if (idx != -1) {"," locale = locale.substring(0, idx);"," }",""," } while (idx != -1);"," }",""," return str;"," },",""," /**"," * Returns the default locale for the widget (the locale value defined by the"," * widget class, or provided by the user during construction)."," *"," * @method getDefaultLocale"," * @return {String} The default locale for the widget"," */"," getDefaultLocale : function() {"," return this._state.get(LOCALE, INIT_VALUE);"," },",""," _strSetter : function(val) {"," return this._setStrings(val, this.get(LOCALE));"," },",""," _strGetter : function(val) {"," return this._getStrings(this.get(LOCALE));"," }","}, true);","","","}, '3.10.3', {\"requires\": [\"widget-base\"]});","","}());"]}; |