vue-i18n icon indicating copy to clipboard operation
vue-i18n copied to clipboard

SFC and Global translations with YAML

Open ricardo17coelho opened this issue 3 years ago • 0 comments

Question

  • How to use SFC and Global messages with YAML ?

Module versions (please complete the following information):

  • vue: ^2.6.14
  • vue-i18n: ^8.26.5"
  • @intlify/vue-i18n-loader: "^1.0.0"
  • yaml-loader: "^0.6.0"

//vue.config.js

    ....
    chainWebpack: (config) => {
        config.module
            .rule("i18n")
            .resourceQuery(/blockType=i18n/)
            .type("javascript/auto")
            .use("i18n")
            .loader("@intlify/vue-i18n-loader")
            .end()
            .use("yaml-loader")
            .loader("yaml-loader")
            .end();
      ....

SFC with yaml files works fine. And when i add json translations to messages on create new VueI18n({}) works too, but when i try to import some yaml file to add it to "messages" doesn't work.

Error:

 ERROR  Failed to compile with 1 errors10:14:40 AM

 error  in ./src/lang/locales_yaml/fr.yaml

Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> default-title: Équipement
| default-subtitle: Lorem ipsum dolor sit amet, consetetur sadipscing
| 

 @ ./src/lang/lang.js 10:0-40 11:19-21
 @ ./src/main.js
 @ multi (webpack)-dev-server/client/index.js (webpack)/hot/dev-server.js ./src/main.js

<s> [webpack.Progress] 100% 

ricardo17coelho avatar Nov 08 '21 10:11 ricardo17coelho