Webpack plugin that uses Translation Markup to auto generate you translations files.
Translation Markup Plugin auto generates your translations files, write your transaltions only once, in YAML, and refernce the auto generated JS files to internationalize your application with any i18n library you desire.
NPM:
npm install @shiftcode/translation-markup-plugin
Yarn:
yarn add @shiftcode/translation-markup-plugin
webpack.config.js
import TranslationMarkupPlugin from '@shiftcode/translation-markup-plugin';
{
...
plugins: [
new TranslationMarkupPlugin(options)
]
...
}
Param | Type | Default | Details |
---|---|---|---|
globPath | <string> |
'./**/*.lang.yaml' |
Glob style path where to find the yaml files. |
outputDirectory | <string> |
'./translations' |
Directory to output the translations. |
options | { format: <string>, splitFiles: <boolean>, outputName: <string>} |
{ format: 'JS', splitFiles: true, outputName: 'translations'} |
Output type and split options. |
*** format
accepts JS
JS_EXPORT_DEFAULT
, TS
or JSON
as values
→ Returns: Promise<void>