Generates gettext pot files for standard Vue projects
Designed to be used with vue-gettext and nuxt-gettext
npm install -D vue-gettext-extract
cd /my/project/dir/
vue-gettext-extract --help
Options:
--version Show version number [boolean]
--js, -j Glob pattern for JS files [string] [default: "**/*.js"]
--vue, -v Glob pattern for Vue files [string] [default: "**/*.vue"]
--out, -o Path to output pot file [string] [default: "template.pot"]
--help, -h Show help [boolean]
const extract = require('vue-gettext-extract')
async function run() {
const extractor = await extract('src/**/*.js', 'src/**/*.vue', 'locale/template.pot')
extractor.printStats()
}
Most of the code is thanks to gettext-extractor and this gist