Verified Commit b26cd0bb authored by Agate's avatar Agate 💬

Fixed a bug in i18n extract/compile scripts

parent 14d8224d
Pipeline #1961 passed with stages
in 11 minutes and 11 seconds
#!/bin/bash -eux
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
  • We have another solution : $(yarn bin gettext-compile) What do you think? Would it be better to avoid a concat?

  • Well, the initial issue with this code was reported by someone on Matrix a few days ago and I'm not sure why this even worked in the past: $(yarn bin gettext-extract) returns /home/eliotberriot/projects/funkwhale/app/front/node_modules/.bin at least on my device.

    @emillumine I'm sorry you were hit by this as well :/ using $(yarn bin gettext-compile) works on your side? I get a permission denied on my side if I use it.

  • It seems we may have a different version of yarn. We have 1.9.4 and yarn bin can take an argument now (https://github.com/yarnpkg/yarn/commit/12d8f7fab0875af1e05a91dd5945e05c5350a6d1). Your solution is better because it works with both old and new version of yarn.

  • Thanks for the follow-up @emillumine , it's nice to know the why about this. We'll be able to switch to your solution soon, and recommand a yarn upgrade to Funkwhale contributors :)

Please register or sign in to reply
......@@ -7,7 +7,7 @@ touch $locales_dir/app.pot
# 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.
$(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 \
--from-code=utf-8 --join-existing --no-wrap \
--package-name=$(node -e "console.log(require('./package.json').name);") \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment