polyglot-po-loader

Webpack loader to load po file and convert them to polyglot json format [readme](https://github.com/marmelab/polyglot-po/blob/master/packages/polyglot-po-loader/readme.md)

Usage no npm install needed!

<script type="module">
  import polyglotPoLoader from 'https://cdn.skypack.dev/polyglot-po-loader';
</script>

README

polyglot-po-loader

Webpack loader to load po file and convert them to polyglot json format readme

Install

$ npm install -g polyglot-po-loader
# or
$ yarn global add polyglot-po-loader

Usage

Add the csv-loader to your webpack configuration:

const config = {
    module: {
        rules: [{
            test: /\.po$/,
            loader: 'polyglot-po-loader',
        }]
    }

With create-react-app

You will need react-app-rewired to add the loader into the webpack-config.

With react-app-rewired, you can edit the webpack config inside the config-overrides.js.

There is a gotcha though, the create-react-app default webpack configuration possess a catch all file-loader.

For polyglot-po-loader to properly work, you need to pass it before this loader, like so:

// config-overrides.js
const path = require('path');

module.exports = config => {
    const lastLoader = config.module.rules.pop();

    lastLoader.oneOf.unshift({
        test: /\.po$/,
        use: [{
            loader: 'polyglot-po-loader',
        }],
    });

    config.module.rules.push(lastLoader);

    return config;
};