webpack-rails-18n
Webpack plugin to provide access to Rails i18n translations. Heavily inspired by https://github.com/mikamai/rails-translations-webpack-plugin, without dependency on lodash.
Installation
yarn add webpack-rails-i18nyarn add json-loader # required to load the generated JSON file
Setup
Require and setup in your webpack configuration.
const WebpackRailsI18n = ...plugins: localesPath: path pathRoot: "output/path" // Where the generated file is output
Require in your application
console
Things to improve
- test framework and decent test coverage
- write in ES2015 and transpile
- smarter setting of locale
- find a way to allow locale to be changed on the fly or at least remove the need to load all locales and reference using their key
- add config options to include or exclude a key from the locale files to reduce size of the generated object