Static GitHub Issues

[1328] ElementUI Vue components locale / i18n issues (workaround)

prev: Issue with single file components and css loader
next: s.replace is not a function

I spent all this morning trying to figure out how to fix ElementUI locale + Nuxt. They just released a new version but even they saying this should be fixed, at least on my end with Nuxt still bugged.

For now, the method wrote under this documentation doesn't work as expected.

I made a small prototype to show the problem on Glitch.me. As you can see at the screenshot below, all strings disappeared: ElementUI locale problem

For those who tried change the components language like me, the only way I found for now is replacing the request via Webpack plugin like that:

nuxt.config.js

  build: {
    plugins: [
      new webpack.NormalModuleReplacementPlugin(
        /element-ui[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/,
        'element-ui/lib/locale/lang/en',
      ),
    ],
  }

I don't think this is the best solution.... and I can't define what's the cause of this problem...(if is Nuxt or ElementUI itself) So I'm leaving this workaround to help other people with the same problem here.

I didn't open a issue under ElementUI repo because seems this problem is related with Nuxt...

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1177">#c1177</a>)</em></sub></div>