Intl.js revision d894ed8f7003b6c2ec19d5fb3969b6c45f0d7147
a) _explodeLang()
1) Explode static meta-data "lang" property into first class modules
var langModuleName = loader._formatLang(lang, module);
b) _useLang(lang)
Support for Y.use("lang:fr-CA"); or Y.use("lang:fr-CA;module");
1) Y.Intl.lookupBestLang(module, lang)
2) loader._formatLang(module, lang)
3) loader.insert(module_lang)
4) Y._attach(module_lang)
c) getAvailableLangs(module)
1) Loop through meta-data for the module, to get available langs
getAvailableLangs() support feasible?
Loop through meta-data for all "loaded" modules, to get the common
subset (could be presented as an app level dropdown for example).
d) Register custom langs
1). Same as any module?
*/
// Explode module language meta-data, converting lang: [] configuration into module data
/**
* Internal data store
*
*/
var _mods = {},
L = Y.Lang,
ACTIVE = "yuiActiveLang";
Y.Intl = {
}
},
_explodeLang : function() {
// LOADER STUB
},
// LOADER STUB
},
getAvailableLangs : function(module) {
// META-DATA STUB
},
/**
* Finds the closest language match, from the list of available languages based on BCP 47 lookup.
*
* @method lookupBestLang
* @param {String} lang The BCP 47 language code to find the closest match for
* @param {Array} supportedLangs An array of supported langauge codes
*
* @return {String} The BCP 47 language code
*/
// check whether the list of available languages contains language; if so return it
var i;
return availableLanguages[i];
}
}
}
if (L.isString(preferredLanguages)) {
}
language = preferredLanguages[i];
continue;
}
// check the fallback sequence for one language
if (result) {
return result;
} else {
if (index >= 0) {
// one-character subtags get cut along with the following subtag
}
} else {
// nothing available for this language
break;
}
}
}
}
return "";
},
/**
* Sets the active language for the given module. Returns false on failure
* (e.g. if the language does not exist)
*
* @method setLang
* @private
*
* @param {String} module The module name.
* @param {String} lang The BCP 47 language code.
*
*/
if (exists) {
}
return exists;
},
/**
* Get the active language for the given module.
*
* @method getCurrLang
*
* @param {String} module The module name.
* @param {String} lang The BCP 47 language code.
*
* @return {String} The current BCP 47 language code.
*/
},
/**
* Register a set of strings for the given module and language
*
* @method add
*
* @param {String} module The module name.
* @param {String} lang The BCP 47 language code.
* @param {Object} strings The hash of strings.
*/
},
/**
* @method get
*
* @param {String} module The module name.
* @param {String} key Optional. If not provided, returns all strings, using merge to protect the originals.
* @param {String} lang Optional. The BCP 47 langauge code.
* @return String | Object
*/
strs,
str;
if (strs) {
}
return str;
}
};