Reputation: 11882
So we're using I18n to localize our website to traditional Chinese
I have a zh-TW.yml file under directory config/locales
I'm trying to see that the translation works in Rails Console.
So I tried:
1.9.3-p0 :001 > I18n.default_locale
=> :zh
1.9.3-p0 :008 > I18n.t 'users.account_header'
=> "zh, users.account_header"
1.9.3-p0 :009 > I18n.t "x_days", :count => 10
=> "zh, x_days"
Why does it not return the proper Chinese translation? so we know it works and gets the right translation.
I also tried some garbage string, eg
1.9.3-p0 :011 > I18n.t "dfkjafkjadf", :count => 10
=> "zh, dfkjafkjadf"
It didn't even complain that the translation is missing!
Have I missed something?
Thanks!
Upvotes: 3
Views: 9075
Reputation: 6568
I use the same chinese translation in my application.
My Chinese locale zh-CN.yml
zh-CN:
go: '进行'
Log out: '退出'
Rails Console:
Loading development environment (Rails 3.2.13)
1.9.3p392 :001 > I18n.default_locale
=> :en
1.9.3p392 :002 > I18n.locale = 'zh-CN'
=> "zh-CN"
1.9.3p392 :003 > helper.t('Go')
=> "进行"
1.9.3p392 :004 > helper.t('Log out')
=> "退出"
Upvotes: 3
Reputation: 2518
This might sound silly, but could it simply be that your default locale is zh
but your translations are stored under zh-TW
?
Upvotes: 3