How can I change default locale to "en"

(Duan Zhi Qiang) #1

After I changed my discourse default locale to “zh_cn” from admin Web UI, but the system cannot work. I got these error “(locales/zh_cn.js isn’t precompiled):” in error log.
So, How can I change default locale to “en” without admin Web UI.

(Régis Hanol) #2

To reset the default locale back to “en”, you can do the following:

bundle exec rails console

And then:

SiteSetting.where(name: "default_locale").first.destroy

(Sam Saffron) #3

If you get that the fix is:

bundle exec rake assets:precompile

(Luke) #4

Another sql solution:
Suppose that discourse_production is your database name

set to chinese locale

$psql discourse_production
discourse_production=# update site_settings set value='zh_CN' where name='default_locale';

If you want to reset to en

discourse_production=# delete from site_settings where name='default_locale';

(Luke) #5

欢迎来中文论坛交流哦 ,自己搭的 哈哈

(Luke) #6

these error “(locales/zh_cn.js isn’t precompiled):” maybe caused by the wrong locale string, should be zh_CN(locales/zh_CN.js)

(Duan Zhi Qiang) #7

What is the default password for discourse_production? I cannot login with admin123

(Sam Saffron) #8

that sounds like a bug to me, we should not be able to totally mess up the UI by entering an error locale string.

(Luke) #9

Yes. “Drop down list” maybe better than “input field” for locale setting.

(Duan Zhi Qiang) #11

I exec the command ”psql discourse_production“, system ask me to input password. My system install password is admin123, it cannot work.
For command "bundle exec rails console “, the system error is " Could not locate Gemfile”.

(Luke) #12

Just use the method as @zogstrip said.
You should enter your discourse folder first, then

bundle install
bundle exec rails c


SiteSetting.where(name: "default_locale").first.destroy

(Jeff Atwood) #13

The admin settings now only allow you to select a valid supported locale, no free text entry.

(Jeff Atwood) #14