Skip to content

Commit

Permalink
l10n: Add "npm run fetch-transfiex" script to update all translation …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
shesek committed Feb 22, 2019
1 parent 3fe1d1d commit 946459d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lang/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The `.json` files in this directory are auto-generated from the `.po` files
using the `build-json.sh` utility script. Please do not edit `.json` files
directly.

To contribute translations, please visit https://www.transifex.com/blockstream/esplora
21 changes: 21 additions & 0 deletions lang/fetch-transifex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -eo pipefail

TRANSIFEX_PROJECT=esplora
TRANSIFEX_RESOURCE=esplora

for file in lang/*.po; do
lang=`basename $file`
lang=${lang%.*}
lang=${lang%-*}

# These are identified differently by transifex
[ "$lang" == "me" ] && lang=sr_ME
[ "$lang" == "jp" ] && lang=ja

echo "Downloading $lang from transifex to $file"
curl -s -L -u api:$TRANSIFEX_KEY https://www.transifex.com/api/2/project/$TRANSIFEX_PROJECT/resource/$TRANSIFEX_RESOURCE/translation/$lang?file=po > $file

echo "Generating json from $file"
./lang/po2json.js < $file > ${file%.*}.json
done
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"dev-server": "babel-node dev-server.js",
"prerender-server": "cd prerender-server && npm start",
"postinstall": "(cd client && npm install) && (cd prerender-server && npm install)",
"dist": "./build.sh"
"dist": "./build.sh",
"fetch-transifex": "./lang/fetch-transifex.sh"
},
"author": "Nadav Ivgi",
"license": "MIT",
Expand Down

0 comments on commit 946459d

Please sign in to comment.