How to use t9n localization in meteor-useraccounts?


#1

In my /lib/locales/useraccounts.coffee I had

zh_cn = 
...
T9n.map "zh_cn", zh_cn

In /lib/config.js I had

T9n.setLanguage('zh_cn');

But when I visit /register or /login, the page is still default english. So what’s the problem? Is there a detailed example of how to use accounts-t9n in useraccounts? Thanks a lot!


#2

Hey @loongmxbt,
lets try to type T9n.setLanguage('zh_cn'); from your browser’s console.
In case it works there, I’d say it’s something with the files load order: perhaps something else is setting the en after you’re setting zh_cn.

As a side note, at the moment accounts-t9n is using zn-ch and NOT zn_ch.
This should be solved with the next release: see this PR


#3

Thanks a lot! The problem is load order, the language file actually used is the one in package. So zh-cn should be used instead of zh_cn. Fixed that!


#4

We’re having a similar issue, when we run T9n.setLanguage(‘pt’) it returns undefined on the browser…


#5

I don’t think setLanguage is supposed to return something…
See these lines