Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

banana-i18n-loader

0.1.0 • Public • Published

npm

banana-i18n-loader

A webpack loader for banana-i18n message files.

This loader resolves the fallback messages when certain messages are not localized yet. For example, in fr locale suppose only 5 messages are localized while the source locale en has 10 messages. The fr.json provided by this loader will have 10 messages and 5 messages that are not localized will be taken from en.json

The locale fallback is based on banana-i18n fallback chain logic.

Getting Started

To begin, you'll need to install banana-i18n-loader:

$ npm install banana-i18n-loader --save-dev

index.js

import fr from '@/i18n/fr.json';

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.json$/,
        include: [path.resolve(__dirname, "i18n")],
        use: [
          {
            loader: 'banana-i18n-loader',
          },
        ],
      },
    ],
  },
};

And run webpack via your preferred method.

License

MIT

Install

npm i banana-i18n-loader

DownloadsWeekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

7.1 kB

Total Files

12

Last publish

Collaborators

  • avatar