Vue-cli: The interface is not displayed in the system language (我的Vue Cli Ui界面变成了英文)

Created on 7 Nov 2018  ·  4Comments  ·  Source: vuejs/vue-cli

Version

3.1.1

Node and OS info

node v8.12.0 / npm v6.4.1 / MAC OS 10.14

Steps to reproduce

在命令行中输入 :vue ui
Enter on the command line:vue ui

What is expected?

当我打开Vue-Cli 的UI 界面时,显示中文界面
When I open the UI interface of Vue-Cli, the Chinese interface is displayed.

What is actually happening?

显示为英文
Displayed in English


我用 VUE-cli 3.0.5的时候显示的是中文的,升级到了3.1.1后显示成了英文(升级过程中,删除了之前版本的VUE),且不知道在哪里可以调整配置文件。

When I use VUE-cli 3.0.5, it is displayed in Chinese. After upgrading to 3.1.1, it is displayed in English (in the upgrade process, the previous version of VUE is deleted), and I don't know where to adjust the configuration file.

Most helpful comment

It's network error when fetching https://unpkg.com/[email protected]/locales/zh.json

maybe no network, dns error or firewall problem. Anyway, this can be improve with local locale..

@sodatea

All 4 comments

@vue/cli-ui use vue-i18n

  • detect language from 'window.navigator.language'
  • fetch locale from https://unpkg.com/vue-cli-locales/locales/${lang}.json
  • fallback to en if fail
[UI] Trying to load zh-CN locale...
theme.js:8 forced theme null
LocaleLoader.vue:31 [UI] Locale en updated with new strings
LocaleLoader.vue:31 [UI] Locale en updated with new strings
select:1 GET https://unpkg.com/[email protected]/locales/zh-CN.json 404
i18n.js:64 [UI] Trying to load zh-cn locale...
zh-cn.json:1 GET https://unpkg.com/[email protected]/locales/zh-cn.json 404
i18n.js:64 [UI] Trying to load zh locale...
i18n.js:69 [UI] Automatically loaded zh locale 
.*$:496 Uncaught (in promise) Error: Cannot find module './zh'
    at o (.*$:496)
    at a (.*$:490)
    at i18n.js:57
    at x (runtime.js:62)
    at Generator._invoke (runtime.js:296)
    at Generator.e.(anonymous function) [as next] (http://localhost:8000/js/chunk-vendors.1d136f45.js:16:31966)
    at r (asyncToGenerator.js:3)
    at a (asyncToGenerator.js:25)
o @ .*$:496
a @ .*$:490
(anonymous) @ i18n.js:57
x @ runtime.js:62
(anonymous) @ runtime.js:296
e.(anonymous function) @ runtime.js:114
r @ asyncToGenerator.js:3
a @ asyncToGenerator.js:25
Promise.then (async)
r @ asyncToGenerator.js:13
a @ asyncToGenerator.js:25
Promise.then (async)
r @ asyncToGenerator.js:13
a @ asyncToGenerator.js:25
Promise.then (async)
r @ asyncToGenerator.js:13
a @ asyncToGenerator.js:25
(anonymous) @ asyncToGenerator.js:32
(anonymous) @ asyncToGenerator.js:21
m @ i18n.js:36
f @ i18n.js:36
9225 @ i18n.js:83
r @ bootstrap:78
d699 @ LocaleLoader.vue:1
r @ bootstrap:78
a @ components sync [a-z0-9]+\.(jsx:80
(anonymous) @ register-components.js:13
56d7 @ register-components.js:12
r @ bootstrap:78
0 @ bootstrap:151
r @ bootstrap:78
t @ bootstrap:45
(anonymous) @ bootstrap:151
(anonymous) @ bootstrap:151

@ideacco check you cli-ui's console and find answer.

Thank you for your reply, but I output this, how can I solve it?

my window.navigator.language = zh

[UI] Trying to load zh locale...
theme.js:8 forced theme null
ClientAddonLoader.vue:38 [UI] Loading client addon org.vue.webpack.client-addon (/_addon/org.vue.webpack.client-addon/index.js)...
ClientAddonLoader.vue:38 [UI] Loading client addon org.vue.widgets.client-addon (/_addon/org.vue.widgets.client-addon/index.js)...
LocaleLoader.vue:31 [UI] Locale en updated with new strings
LocaleLoader.vue:31 [UI] Locale en updated with new strings
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-webpack-components-dashboard component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-webpack-components-analyzer component
ClientAddonApi.js:53 [ClientAddonApi] Registered new routes under the /addon/org.vue.webpack route
ClientAddonApi.js:65 [ClientAddonApi] Registered new strings for locale en
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-welcome component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-kill-port component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-plugin-updates component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-dependency-updates component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-vulnerability component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-vulnerability-details component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-run-task component
ClientAddonApi.js:23 [ClientAddonApi] Registered client-addon--org-vue-widgets-components-news component
dashboard:1 GET https://unpkg.com/[email protected]/locales/zh.json net::ERR_CONTENT_DECODING_FAILED 200
i18n.js:49 [UI] No locale data was found for your locale zh.
i18n.js:53 Uncaught (in promise) TypeError: c.a.createTimeago is not a function
    at i18n.js:53
    at x (runtime.js:62)
    at Generator._invoke (runtime.js:296)
    at Generator.e.(anonymous function) [as next] (http://localhost:8000/js/chunk-vendors.1d136f45.js:16:31966)
    at r (asyncToGenerator.js:3)
    at a (asyncToGenerator.js:25)

It's network error when fetching https://unpkg.com/[email protected]/locales/zh.json

maybe no network, dns error or firewall problem. Anyway, this can be improve with local locale..

@sodatea

Thanks, the problem is solved. Now that Chinese is normal, I upgraded vue cli from 3.1.1 to 3.1.3. The magic happened and the problem was fixed automatically. Although I don't know what happened.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NathanKleekamp picture NathanKleekamp  ·  3Comments

joshuajohnson814 picture joshuajohnson814  ·  3Comments

CodeApePro picture CodeApePro  ·  3Comments

jgribonvald picture jgribonvald  ·  3Comments

eladcandroid picture eladcandroid  ·  3Comments