Fixed a bug in i18n extract/compile scripts

This commit is contained in:
Eliot Berriot 2018-09-05 21:06:53 +02:00
parent 14d8224db4
commit b26cd0bb20
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
2 changed files with 2 additions and 2 deletions

View File

@ -1,3 +1,3 @@
#!/bin/bash -eux #!/bin/bash -eux
locales=$(tail -n +2 src/locales.js | sed -e 's/export default //' | jq '.locales[].code' | xargs echo) locales=$(tail -n +2 src/locales.js | sed -e 's/export default //' | jq '.locales[].code' | xargs echo)
find locales -name '*.po' | xargs $(yarn bin gettext-extract)/gettext-compile --output src/translations.json find locales -name '*.po' | xargs $(yarn bin)/gettext-compile --output src/translations.json

View File

@ -7,7 +7,7 @@ touch $locales_dir/app.pot
# Create a main .pot template, then generate .po files for each available language. # Create a main .pot template, then generate .po files for each available language.
# Extract gettext strings from templates files and create a POT dictionary template. # Extract gettext strings from templates files and create a POT dictionary template.
$(yarn bin gettext-extract)/gettext-extract --attribute v-translate --quiet --output $locales_dir/app.pot $sources $(yarn bin)/gettext-extract --attribute v-translate --quiet --output $locales_dir/app.pot $sources
xgettext --language=JavaScript --keyword=npgettext:1c,2,3 \ xgettext --language=JavaScript --keyword=npgettext:1c,2,3 \
--from-code=utf-8 --join-existing --no-wrap \ --from-code=utf-8 --join-existing --no-wrap \
--package-name=$(node -e "console.log(require('./package.json').name);") \ --package-name=$(node -e "console.log(require('./package.json').name);") \