rollup-plugin-i18next-conv
Import po files with rollup
Last updated a month ago by perrin4869 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rollup-plugin-i18next-conv 
SYNC missed versions from official npm registry.

rollup-plugin-i18next-conv

Travis npm package Coverage Status Dependency Status devDependency Status

Import po files as i18next compatible json objects with rollup

Install

$ npm install --save-dev rollup-plugin-i18next-conv

Usage

Given the following source file:

import i18next from 'i18next';

import en from '../../locale/en/LC_MESSAGES/messages.po';
import ja from '../../locale/ja/LC_MESSAGES/messages.po';

i18next.init({
  resources: {
    en: { translation: en },
    ja: { translation: ja },
  },
});

Compile using:

// rollup.config.js
import i18next from 'rollup-plugin-i18next-conv';

export default {
  input: 'src/main.js',
  output: {
    file: 'dist/bundle.js',
  },
  format: 'iife',

  plugins: [
    i18next({
      // All PO files will be parsed by default,
      // but you can also specifically include/exclude files
      include: 'node_modules/**',
      exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ],
      
      // Customize the determineLocale function, which by default is:
      // const defDetermineLocale = filename => filename.split(path.sep).slice(-3)[0];
      // (returns 'en' given a filename './locale/en/LC_MESSAGES/messages.po')
      determineDomain: filename => path.basename(filename, '.po'),

      // And any option supported by i18next-conv's gettextToI18next function, for example
      keyseparator: '$$',
    })
  ]
};

Current Tags

  • 5.1.0                                ...           latest (a month ago)

11 Versions

  • 5.1.0                                ...           a month ago
  • 5.0.1                                ...           a month ago
  • 5.0.0                                ...           a month ago
  • 4.0.0                                ...           5 months ago
  • 3.0.0                                ...           a year ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 49
Dependencies (1)
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |