Hi, has anybody successfully integrated the i18n creator library with Typescript? Is there any tutorial/example?
@slackmoehrle @pandamicro?
I am not sure.
Which i18n library you are referring to? The extension https://github.com/cocos-creator-packages/i18n or this https://github.com/cocos-creator/i18n-example?
You can use it as it is by doing this:
In your .ts file do such import:
import * as i18n from '../i18nPath/i18n';
Use it as usual:
i18n.init ('zh'); // init parameter is the language identifier, such as 'zh', 'en', etc.
var myLocalizedText = i18n.t ('TEXT_KEY');
The only downside is you probably won’t get any autocomplete from i18n.
Hi @jake72 this is exactly what I did and it didnt work. But it was my fault (im starting with Typescript and had an issue with the import syntax). Now it works.
Thanks!