wp-cli / i18n-command

Provides internationalization tools for WordPress projects.
MIT License
96 stars 52 forks source link

make-json Allow to keep source file context by translating to build files during extraction #284

Closed cpiber closed 3 years ago

cpiber commented 3 years ago

Any build step for JavaScript files can now provide a mapping file, to allow the po[t] files to operate on the source files.

Mappings are simple JSON objects with source files as keys and one or an array of build files as values.

Currently this is done by a --use-map option, optionally with paths (delimited by ,) specified. I'm open for better names for this option as well as better ways to specify multiple values (it doesn't seem like specifying the option multiple times works, like some programs support).

Example plugin (for webpack) to produce such maps: https://github.com/cpiber/webpack-bundle-output. I intend to integrate this plugin into @wordpress/scripts if this PR goes through, if that happens, that could be added to the README.

Resolves #127 Resolves #200 Resolves #282

swissspidy commented 3 years ago

By the way, nice work with https://github.com/cpiber/webpack-bundle-output too!