ya-i18next-webpack-plugin
[![npm version](https://badge.fury.io/js/ya-i18next-webpack-plugin.svg)](https://badge.fury.io/js/ya-i18next-webpack-plugin) [![Build Status](https://travis-ci.org/Perlmint/ya-i18next-webpack-plugin.svg?branch=master)](https://travis-ci.org/Perlmint/ya-i1
Last updated 9 months ago by perlmint .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ya-i18next-webpack-plugin 
SYNC missed versions from official npm registry.

npm version Build Status Coverage Status dependencies Status devDependencies Status

ya-i18next-webpack-plugin

Yet another i18next webpack plugin

This plugin collects keys from webpack parsing phase, saves missing translations into specified path, copies translation files.

usage

webpack.config.js

const i18nextPlugin = require("ya-i18next-webpack-plugin").default;

module.exports = {
    plugins: [
        new i18nextPlugin({
            defaultLanguage: "en",
            languages: ["en", "ko"],
            functionName: "_t",
            resourcePath: "./locales/{{lng}}/{{ns}}.json",
            pathToSaveMissing: "./locales/{{lng}}/{{ns}}-missing.json"
        })
    ]
};

index.js

import * as i18next from 'i18next';
import * as Backend from 'i18next-xhr-backend';
import * as i18nConf from "ya-i18next-webpack-plugin/config";

if (window._t === undefined) {
	i18next
		.use(Backend)
		.init({
			fallbackLng: i18nConf.DEFAULT_NAMESPACE,
			whitelist: i18nConf.LANGUAGES,
			backend: {
				loadPath: `${__webpack_public_path__}${i18nConf.RESOURCE_PATH}`
			}
		});
	window._t = i18next.t;
}

console.log(_t("hello_world"));

example missing keys

{
	"hello_world": [
		"index.js(18,16)"
	],
}

Current Tags

  • 0.4.2                                ...           latest (9 months ago)

8 Versions

  • 0.4.2                                ...           9 months ago
  • 0.4.1                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.2                                ...           3 years ago
  • 0.3.1 [deprecated]           ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (7)
Dev Dependencies (16)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |