webpack-rails-i18n-js-plugin

Usage

// webpack.config.js
const WebpackRailsI18nJS = require('webpack-rails-i18n-js-plugin')

plugins: [
  new WebpackRailsI18nJS({
    // Locale to be used. Default value: 'html.lang'. Can be ether:
    // 1. Locale name ("en" for example)
    // 2. "html.lang" locale will be taken from `<html lang="en">` atribute
    locale: 'html.lang',

    // Deafult local. Default value: 'en'
    defaultLocale: 'en',

    // Path to yaml files. Default value: `./config/locales`
    localesPath: __dirname
  })
]
import I18n from 'i18n';

console.log(I18n.translate('hello'))

Testing

Browser

  • npm install
  • npm test for test GUI at http://localhost:8080
  • npm run test-ci to run in CI