2.0.7 • Published 2 years ago

vue-i18n-extract v2.0.7

Weekly downloads
48,685
License
MIT
Repository
-
Last release
2 years ago

:green_book: Table of Contents

  1. Installation
  2. Introduction
  3. How to use it?
  4. Contribution
  5. Core Team
  6. License

Install with yarn:

yarn add vue-i18n-extract --dev

Install with npm:

npm install --save-dev vue-i18n-extract

However, managing and maintaining all the language files and the vue-i18n keys inside a project could be very demanding and vue-i18n-extract solves this problem.

Vue-i18n-extract performs a static analysis on a Vue.js project (which uses vue-i18n) and reports the following information:

  • list of all the unused vue-i18n keys (entries found in the language files but not used in the project)
  • list of all the missing keys (entries found in the project but not in the language files)

Optionally you can decide to show the output in the console or in a json file.

The missing keys can also be automatically added to the given language files.

yarn run vue-i18n-extract report -v <vueFiles> -l --languageFiles <languageFiles>

or

npm run vue-i18n-extract report -v <vueFiles> -l --languageFiles <languageFiles>

Required options

-v, --vueFiles <vueFiles>,
The Vue.js file(s) you want to extract i18n strings from. It can be a path to a folder or to a file. It accepts glob patterns. (ex. *, ?, (pattern|pattern|pattern)

-l, --languageFiles <languageFiles>,
The language file(s) you want to compare your Vue.js file(s) to. It can be a path to a folder or to a file. It accepts glob patterns (ex. *, ?, (pattern|pattern|pattern)

Options

-o, --output <output>
Use if you want to create a json file out of your report. (ex. -o output.json)

-a, --add,
Use if you want to add missing keys into your json language files.,

-d, --dynamic,
Use if you want to ignore dynamic keys false-positive. Use it 2 times to get dynamic keys report.',

-ci,
The process will exit with exitCode=1 if at least one translation-key is missing (useful especially if it is part of a CI pipeline).',

Examples

npm run vue-i18n-extract report -v './demo/vue-files/**/*.?(js|vue)' -l './demo/lang/**/*.?(json|yaml|yml)'

Create an empty config file:

yarn run vue-i18n-extract init

Open the config file:

vue-i18n-extract.config.js

Edit the file and change the values:

module.exports = {
  vueFilesPath: './', // The Vue.js file(s) you want to extract i18n strings from. It can be a path to a folder or to a file. It accepts glob patterns. (ex. *, ?, (pattern|pattern|pattern)
  languageFilesPath: './', // The language file(s) you want to compare your Vue.js file(s) to. It can be a path to a folder or to a file. It accepts glob patterns (ex. *, ?, (pattern|pattern|pattern)
  options: {
    output: false, // false | string => Use if you want to create a json file out of your report. (ex. output.json)
    add: false, // false | true => Use if you want to add missing keys into your json language files.
    dynamic: false, // false | 'ignore' | 'report' => 'ignore' if you want to ignore dynamic keys false-positive. 'report' to get dynamic keys report.
  }
};

Run the program:

yarn run vue-i18n-extract use-config

We are very happy to get any kind of contribution to this project and we would like to make contributions to this project as easy and transparent as possible.

When contributing to this repository, please first discuss the changes you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we do have a code of conduct, please follow it in all of your interactions with the project.

You can use the GitHub repository page for the following contributions:

  • Reporting a bug
  • Discussing the current state of the code
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

We use Github Flow, so all code changes happen through pull requests.

Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests.

Instructions for contributing:

  1. Fork the repo and create your branch from master.
  2. If you've added code that should be tested, add tests.
  3. If you've changed APIs, update the documentation.
  4. Ensure the test suite passes.
  5. Make sure your code lints.
  6. Issue that pull request!

:bug: Report bugs using Github's issues

We use GitHub issues to track public bugs. Report a bug by opening a new issue.

Great Bug Reports tend to have:

  • A quick summary and/or background
  • Steps to reproduce
  • What you expected would happen
  • What actually happens
2.0.7

2 years ago

2.0.5

2 years ago

2.0.6

2 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.0

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.11

3 years ago

1.1.10

4 years ago

1.1.4

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.4.14

5 years ago

0.4.13

5 years ago

0.4.12

5 years ago

0.4.11

5 years ago

0.4.10

5 years ago

0.4.9

5 years ago

0.4.8

5 years ago

0.4.5

5 years ago

0.4.3

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.6

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago