JSPM

@kazupon/vue-i18n-loader

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18488
  • Score
    100M100P100Q15493F
  • License MIT

vue-i18n loader for custom blocks

Package Exports

  • @kazupon/vue-i18n-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@kazupon/vue-i18n-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

🌐 vue-i18n-loader

CircleCI codecov npm

vue-i18n loader for custom blocks

πŸ’Ώ Installation

$ npm i --save-dev @kazupon/vue-i18n-loader

πŸš€ Usage

the below example thatApp.vue have i18n custom block:

Custom Blocks (Single File Components)

<i18n>
{
  "en": {
    "hello": "hello world!"
  },
  "ja": {
    "hello": "γ“γ‚“γ«γ‘γ―γ€δΈ–η•Œ!"
  }
}
</i18n>

<tempalte>
  <p>{{ $t('hello') }}</p>
</template>

<script>
export default {
  name: 'app',
  // ...
}
</script>

JavaScript

import Vue from 'vue'
import VueI18n from 'vue-i18n'
import App from './App.vue'

Vue.use(Vue-i18n)

const i18n = new VueI18n({
  locale: 'en',
  messages: {
    en: {
      // ...
    },
    ja: {
      // ...
    }
  }
})
new Vue({
  i18n,
  render: h => h(App)
}).$mount('#app')

Webpack Config

configure webpack config for vue-loader (v11.3 later):

module.exports = {
  module: {
    rules: [{
      test: /\.vue$/,
      loader: 'vue',
      options: {
        loaders: {
          i18n: '@kazupon/vue-i18n-loader'
        }
      }
    }]
  }
}

πŸ“œ Changelog

Details changes for each release are documented in the CHANGELOG.md.

πŸ’ͺ Contribution

Please make sure to read the Contributing Guide before making a pull request.

©️ License

MIT