Giter VIP home page Giter VIP logo

rollup-plugin-vue-i18n's Introduction

🌐 @intlify/rollup-plugin-vue-i18n

Test

Rollup plugin for Vue I18n

⚠️ Notice

This package is maintained for Vue I18n v8 (Vue 2).

If you want to use Vue I18n v9 (Vue 3) or later, See the @intlify/bundle-tools repo.

❗ Requirement

You need to install the follwoing:

If you use rollup-plugin-vue, We recommend you should read the docs

πŸ’Ώ Installation

npm:

$ npm i --save-dev @rollup/plugin-json
$ npm i --save-dev @rollup/plugin-yaml # if you use locale messages with YAML format
$ npm i --save-dev @intlify/rollup-plugin-vue-i18n

yarn:

$ yarn add -D @rollup/plugin-json
$ yarn add -D @rollup/plugin-yaml # if you use locale messages with YAML format
$ yarn add -D @intlify/rollup-plugin-vue-i18n

πŸš€ Usages

the below example that example/Hello.vue have i18n custom block:

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

<script>
export default {
  name: 'Hello'
}
</script>

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

If you would like to bundle as common library with rollup, you can configure the following for ES Module:

const vue = require('rollup-plugin-vue')
const yaml = require('@rollup/plugin-yaml')
const json = require('@rollup/plugin-json')
const { default: i18n } = require('../lib/index')

export default {
  input: './example/index.js',
  output: {
    format: 'esm',
    file: './example/components.esm.js'
  },
  external: [
    // Externalize so that the output code is readable.
    'vue',
    'vue-runtime-helpers',
    'vue-i18n'
  ],
  plugins: [
    yaml(),
    json(),
    i18n(),
    vue({
      customBlocks: ['i18n']
    })
  ]
}

Locale Messages formatting

You can be used by specifying the following format in the lang attribute:

  • json (default)
  • yaml

example yaml foramt:

<i18n lang="yaml">
en:
  hello: "Hello World!"
ja:
  hello: "γ“γ‚“γ«γ‘γ―γ€δΈ–η•ŒοΌ"
</i18n>

⚠️ Limitations

Currently, There are the following limitations:

  • Not support json5 format
  • Not support locale attributes

πŸ“œ Changelog

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

❗ Issues

Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.

©️ License

MIT

rollup-plugin-vue-i18n's People

Contributors

kazupon avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rollup-plugin-vue-i18n's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update actions/checkout action to v4
  • chore(deps): update dependency typescript to v5
  • chore(deps): update dependency typescript-eslint-language-service to v5
  • πŸ” Create all rate-limited PRs at once πŸ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yml
  • actions/checkout v1
  • actions/setup-node v2
.github/workflows/test.yml
  • actions/checkout v2
  • actions/setup-node v2
npm
package.json
  • @rollup/plugin-json ^4.0.3
  • @rollup/plugin-yaml ^3.0.0
  • @types/debug ^4.1.5
  • @types/jest ^25.2.1
  • @types/node ^13.13.4
  • @typescript-eslint/eslint-plugin ^2.30.0
  • @typescript-eslint/parser ^2.30.0
  • @typescript-eslint/typescript-estree ^2.30.0
  • debug ^4.1.1
  • eslint ^6.8.0
  • eslint-plugin-vue-libs ^4.0.0
  • jest ^25.5.4
  • jest-watch-typeahead ^0.6.0
  • lerna-changelog ^1.0.0
  • opener ^1.5.1
  • rollup ^2.7.0
  • rollup-plugin-vue ^5.1.4
  • shipjs ^0.26.0
  • ts-jest ^25.4.0
  • typescript ^3.8.3
  • typescript-eslint-language-service ^2.1.8
  • vue-template-compiler ^2.6.11
  • vue-template-compiler ^2.6
  • node >= 10

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.