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!