npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@oreliain/vue-i18n-extract-keys

v2.1.1

Published

Extract all vue-i18n keys from Vue.js project source files.

Downloads

106

Readme


vue-i18n-extract-keys is built to work with your Vue.js projects using vue-i18n. When run vue-18n-extract-keys, it extracts, from your Vue.js source code, any vue-i18n key usages (ex. $t(''), $tc(''), ...) and generates corresponding assets locales files.

:book: Documentation

Installation

## NPM
npm install --save-dev @oreliain/vue-i18n-extract-keys

## or

## Yarn
yarn add -D @oreliain/vue-i18n-extract-keys

Getting Started

To extract keys executed the command :

npx vue-i18n-extract-keys

or create a script entry in your package.json:

{
  "scripts": {
    "i18n:extract": "vue-i18n-extract-keys -o ./src/locales -l en fr -e -x"
  }
}

The command takes the following options :

-l, --locales (default: "en") :

The locales to generate

Example

Generate en.json and fr.json files in ./i18n/locales

npx vue-i18n-extrack-keys -l en fr
-s, --source (default: ["src"]) :

The source directories to parse for keys extracting

Example

Extract keys from ./sources and ./components directories

npx vue-i18n-extrack-keys -s ./sources -s ./components
-o, --output (default: "i18n/locales") :

The target directory in which locale generated files will be stored. The directory must already exist

Example

Extract keys to ./lang directory

npx vue-i18n-extrack-keys -o ./lang
-x, --withIndexFile (default: false) :

Create an index file in the output directory that export all your locales as a module.

Example
npx vue-i18n-extrack-keys -l en fr -o ./lang --withIndexFile

will create a ./lang/index.js file that contains :

module.exports = {
	fr: require("./fr.json"),
	en: require("./en.json")
};
-k, --keepKeys (default: false)

Keep non existing translations keys in the result translation file.

-e, --forceErase (default: false) :

By default, the command updates the output files on each run. Use this option to erase the output files instead of update it.

-v, --verbose (default: false)

Set verbose mode

-d, --dryRun (default: false)

Dry run mode, do the parsing but do not write locales files

--showDiff (default: false)

Show the differences between old and new locales files

-h, --help

Print the help message

--version

Print the package version

:bug: Issues

I'm sure you'll find bugs and when you do it would be great if you'd could report them here.

:muscle: Contribution

The project is still in its early stages and in progress. There's no need for guidelines yet, so feel free to contribute or give feedback as you prefer.

:copyright: License

MIT