Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

| is not support in 9.x? #1655

Open
5 tasks done
wxfred opened this issue Feb 22, 2023 · 1 comment
Open
5 tasks done

| is not support in 9.x? #1655

wxfred opened this issue Feb 22, 2023 · 1 comment
Labels
Status: Review Needed Request for review comments

Comments

@wxfred
Copy link

wxfred commented Feb 22, 2023

Reporting a bug?

I'm using the latest v9 vue-i18n, in my vue file

<i18n>
{
  "en": {
    "Z": "|Z|"
  }
}
</i18n>

A compile error will occur
Syntax Error: Final loader (./node_modules/@intlify/vue-i18n-loader/lib/index.js) didn't return a Buffer or String

If I remove the |, no error come out

<i18n>
{
  "en": {
    "Z": "Z"
  }
}
</i18n>

By the way, [email protected] dose not have this problem.

Expected behavior

Support | in i18n content.

Reproduction

  1. Use vue-cli 5 to create a new project
    vue create i18n9test

  2. Install latest vue-i18n and @intlify/vue-i18n-loader

npm install --save vue-i18n
npm install --save-dev @intlify/vue-i18n-loader
  1. Config loader in vue.config.js
module.exports = defineConfig({
  chainWebpack: config => {
    config.module
      .rule('i18n')
        .resourceQuery(/blockType=i18n/)
        .type('javascript/auto')
        .use('i18n')
          .loader('@intlify/vue-i18n-loader')
  },
})
  1. Use i18n in main.js
import { createApp } from 'vue'
import { createI18n } from 'vue-i18n'
import App from './App.vue'
import router from './router'
import store from './store'

createApp(App).use(store).use(router).use(createI18n()).mount('#app')
  1. Append the conent below to App.vue
<i18n>
{
  "en": {
    "Home": "New Home"
  }
}
</i18n>

change <router-link to="/">Home</router-link> to <router-link to="/">{{ $t('Home') }}</router-link>

  1. Run, and no error currently
    npm run serve

  2. Change the i18n content, save and recompile, a error will come out

<i18n>
{
  "en": {
    "Home": "|New Home"
  }
}
</i18n>

System Info

Win10
Node 16.13.1
npm 8.1.2
Chrome 110.0.5481.104
vue 3.2.47
vue-i18n 9.2.2
@intlify/vue-i18n-loader 4.2.0
@vue/cli 5.0.8

Screenshot

No response

Additional context

No response

Validations

@wxfred wxfred added the Status: Review Needed Request for review comments label Feb 22, 2023
@TheDutchCoder
Copy link

| is used for pluralization, maybe that's the issue?
Example test: 'Test | Tests'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Needed Request for review comments
Projects
None yet
Development

No branches or pull requests

2 participants