Nietzsche's Preposterous Moustache
    Wondering what’s next for npm?Check out our public roadmap! »

    @oreliain/vue-i18n-extract-keys

    1.0.2 • Public • Published

    @oreliain/vue-i18n-extract-keys


    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.

    📖 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 directory to parse for keys extracting

    Example

    Extract keys from ./sources directory

    npx vue-i18n-extrack-keys -s ./sources
    -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")
    };
    -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

    --logLevel (default: "success")

    Set the log level ("warn", "success", "error", "debug", "all")

    -h, --help

    Print the help message

    --version

    Print the package version

    🐛 Issues

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

    💪 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.

    ©️ License

    MIT

    Install

    npm i @oreliain/vue-i18n-extract-keys

    DownloadsWeekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    21.2 kB

    Total Files

    16

    Last publish

    Collaborators

    • avatar