@el_skak: This is how I use it with wp i18n
from source (with all the yet to be released bug fixes included):
- (cwd into
~/src
) git clone https://github.com/wp-cli/i18n-command
- (cwd into
~/src/i18n-command
) -
composer install
to install thewp i18n
dependencies.
Sage theme package.json
:
"translate": "yarn translate:pot && yarn translate:update",
"translate:pot": "~/src/i18n-command/vendor/bin/wp i18n make-pot . ./resources/lang/sage.pot --include=\"theme.json,app,resources\"",
"translate:update": "for filename in ./resources/lang/*.po; do msgmerge -U $filename ./resources/lang/sage.pot; done; rm -f ./resources/lang/*.po~",
"translate:compile": "yarn translate:mo && yarn translate:js",
"translate:js": "~/src/i18n-command/vendor/bin/wp i18n make-json ./resources/lang --pretty-print",
"translate:mo": "~/src/i18n-command/vendor/bin/wp i18n make-mo ./resources/lang ./resources/lang"
(Don’t forget to change the sage.pot
back to the theme name/slug/domain, if you prefer and did that).
There are other ways of course, but this is the simplest and least intrusive way IMHO.
I hope there will be a new release of wp i18n
soon, as it also contains a new merge command that allows getting rid of the shell script of translate:update
.