hyperformula
hyperformula copied to clipboard
HyperFormula.languages returns only `enGB`.
Description
Reference about HyperFormula.languages property says:
Contains all available languages to use in registerLanguage.
Also, Localizing functions guide mentions this property as a way to get all the available languages.
Steps to reproduce
- Call
HyperFormula.languages
Expected result: Get 16 supported languages.
Actual result: Get only one language, enGB
.
Expected result: Get 16 supported languages.
Nope. Languages available for registerLanguage
are those that are loaded on the page. If you don't attach additional files, they are not available. If someone loads his own languages then can even have 32 supported languages there.
Check any UMD language file:
if (!_.default.languages) {
_.default.languages = {};
}
_.default.languages[dictionary.langCode] = dictionary;
var _default = dictionary;
exports.default = _default;
It's just an object that creates a namespace for languages so when loaded they will not pollute global scope. Documentation you're referring to mentions Hypefromula.languages
only in UMD context. For ES modules property is not populated because modules are isolated (can't be done and it doesn't make sense anyway).
Ok, I get it. Thanks @wojciechczerniak. In that case, the API reference for languages
property should be updated.
- [ ] Mention that this property is only useful for UMD modules.
- [ ] Add link to the Localizing Functions guide that describes importing the language files.
Closed with https://github.com/handsontable/hyperformula/pull/1348/files in HyperFormula 2.6.1