vuei18n-po

transform gettext .po files for vue-i18n
13,785 15
Install
npm install vuei18n-po
Latest Version:1.4.0
Vue:2
License:BSD-3-Clause
Last Updated:Jul 22, 2022
Links: GitHub  ·  npm
Maintainer: pavelstudeny

vuei18n-po

Transform gettext .po files for vue-i18n.

When it comes to plural support, the best data format nowadays is MessageFormat. Unfortunatelly, it isn't well supported neither by Vue nor by translation services. This modules takes gettext translations (that have a good support among translators) and transforms both the messages and plural rules to be consumable by VueI18n.

man vuei18n-po

  Usage:
    vuei18n-po [OPTIONS]  GLOB_OR_FILE.po ...

  Options:
    --pluralRules=FILE.js
      language plural rules to be imported for VueI18n pluralizationRules

    --messagesFile=FILE.json
      a single file containing all the translation strings, language as a key

    --messagesDir=DIRECTORY
      directory where translations go split by a language

    --whiteList=GLOB
      files that are tested for presence of the message keys;
      the unnused keys are filtered out

Usage

const vuei18nPo = require('vuei18n-po');

await vuei18nPo({
    po: [ 'en.po', 'translations/**/*.po' ],
    pluralRules: 'spec/data/out/choices.js',
    messagesFile: 'generated/allInOne.json',
    messagesDir: 'generated',
    whiteList: 'src/**/*.vue'
});

Plug it in

new VueI18n({
      locale: 'en',
      messages: {
        en: require('./generated/en.json'),
        ja: require('./generated/ja.json')
      },
      pluralizationRules: require('./generated/choices.js')
});

Related Packages

@dialpad/i18n

Internationalization library for Vue 3 apps using Mozilla's Fluent syntax, with...

10,073
@mylukin/easy-i18n-js

Framework-agnostic i18n extraction tool with plugin support for Svelte, Vue, and...

5,836 0
@byjohann/vue-i18n

Lightweight internationalization plugin for Vue

8,721 7
@the-i18n-kit/nuxt

Nuxt module that publishes the layer graph and locale table Nuxt already resolve...

16,307 11

Version History

Version Released Vue License
1.4.0 ^2.6.7 BSD-3-Clause
1.3.0 ^2.6.7 BSD-3-Clause
1.2.0 ^2.6.7 BSD-3-Clause
1.1.0 ^2.6.7 BSD-3-Clause
1.0.5 ^2.6.7 BSD-3-Clause