Hi
I have tried calling findAvailableLocale in localization:
console.log(this.app.i18n.findAvailableLocale(“de”, this.app.i18n._availableLangs));
But console throughs an error:
Please check
Hi
I have tried calling findAvailableLocale in localization:
console.log(this.app.i18n.findAvailableLocale(“de”, this.app.i18n._availableLangs));
But console throughs an error:
Please check
looking at the source code, the function is static
so should be called as I18n.findAvailableLocale(...
I’m not sure why it’s not marked as static in the documentation though … we’ll need to fix this @yaustar
https://developer.playcanvas.com/en/api/pc.I18n.html#findAvailableLocale
Even if I call it as I18n.findAvailableLocale:
console.log(I18n.findAvailableLocale(“de”, this.app.i18n._availableLangs));
It says I18n is not defined.
Usage:
pc.I18n.findAvailableLocale('en-US', {});
Odd, it’s marked as static: engine/i18n.js at 01cddc1ca983628d023ff5c9920955001eda3104 · playcanvas/engine · GitHub
Thanks for the quick response, it worked as you mentioned.
I recommend adding a single line of “usage” in front of all functions.