To use Heroku, set locale to zh_cn instead of ZH-CN.

Source: Internet
Author: User

To use Heroku, set locale to zh_cn instead of ZH-CN.

I think it is probably because in application. RB, config. i18n. default_locale accepts the symbol by default, and when we use ZH-CN, We Have To enclose it in double quotation marks,

However, when reading rails, a flag such as ZH-CN may be used directly, so the following error message will appear:

Actionview: Template: Error (: ZH is not a valid locale ):

Therefore, if we can change all the files involved to zh_cn, we can avoid many such errors when using gem.

For example, this error is caused by devise, so I made the following changes:


In application. RB

Config. i18n. default_locale =: "ZH-CN" changed to config. i18n. default_locale =: zh_cn

Then rename the zh-CN.yml under locale to zh_cn.yml, devise. zh-CN.yml to devise. zh_cn.yml


Finally, replace ZH-CN in the zh_cn.yml and devise. zh_cn.yml files with zh_cn.



Restart the server!


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.