Mellon
Mellon

Reputation: 38912

localization in Rails

I know that in Rails, we can put localization file under config/locales to achieve the localization purpose.

For example config/locales/en.yml contains all the text in English and config/locales/fr.yml contains all the text in French.

But how about Chinese? If I would like to make a web app. which also has Chinese version, is it so that I just simply translate all texts into Chinese then put it under config/locales/ch.yml ? Any other sophisticated way for app. Chinese localization ?

Upvotes: 3

Views: 1177

Answers (2)

buruzaemon
buruzaemon

Reputation: 3925

For rails-i18n, you can find the zh-CN.yml (China Chinese) and zh-TW.yml (Taiwan Chinese variant) on GitHub. These files include the basic translations for ActiveRecord, numbers, dates, etc.

All you would need to do is drop them under your config/locales folder. You would also need to add any translations that your app requires.

Upvotes: 0

David Sulc
David Sulc

Reputation: 25994

As zed_0xff said, you need to call the file with zh as the language. To translate content, copy the en.yml file to zh.yml (for example), translate the content into Chinese, then set the locale to 'zh' within your app.

Upvotes: 1

Related Questions