summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2019-03-12 21:05:29 +0100
committerRuben Pollan <meskio@sindominio.net>2019-03-19 22:14:36 +0100
commit3312593a4b9c4c9ef864af34bb012ffd3aa201db (patch)
treed3ecdc92e3d3f8f1eed50dd132e10eea52377bcd
parentc5f33ab52e7ea08864765a7af78f17e6f7910575 (diff)
[locales] improve the locales workflow and document it
-rw-r--r--Makefile4
-rw-r--r--README.md14
2 files changed, 10 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index e3e9ae9..9b1762e 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ lang_list := $(subst $(space),,$(foreach lang,$(LANGS),$(lang),))
locales: $(foreach lang,$(LANGS),get_$(lang)) cmd/bitmask-vpn/catalog.go
generate_locales:
- gotext update ./pkg/systray ./pkg/bitmask
+ gotext update -lang=$(lang_list) ./pkg/systray ./pkg/bitmask
make -C tools/transifex
locales/%/out.gotext.json: pkg/systray/systray.go pkg/systray/notificator.go pkg/bitmask/standalone.go pkg/bitmask/bitmaskd.go
@@ -50,6 +50,6 @@ locales/%/out.gotext.json: pkg/systray/systray.go pkg/systray/notificator.go pkg
cmd/bitmask-vpn/catalog.go: $(foreach lang,$(LANGS),locales/$(lang)/messages.gotext.json)
gotext update -lang=$(lang_list) -out cmd/bitmask-vpn/catalog.go ./pkg/systray ./pkg/bitmask
-get_%:
+get_%: locales/%/out.gotext.json
make -C tools/transifex build
curl -L -X GET --user "api:${API_TOKEN}" "https://www.transifex.com/api/2/project/bitmask/resource/RiseupVPN/translation/${subst -,_,$*}/?file" | tools/transifex/transifex t2g locales/$*/
diff --git a/README.md b/README.md
index 4e75116..fc2be52 100644
--- a/README.md
+++ b/README.md
@@ -78,17 +78,19 @@ In that case bitmask-systray assumes that you already have bitmaskd running. Run
i18n
----
-Generate `locales/*` files:
+When a string has being modified you need to regenerate the locales:
```
- $ make generate_locales LANGS="sjn tlh"
+ $ make generate_locales
```
-Edit the `locales/*/out.gotext.json` translations into `locales/*/messages.gotext.json`.
-
-To rebuild the locales:
+To fetch the translations from transifex and rebuild the catalog.go (API\_TOKEN is the transifex API token):
```
- $ make locales
+ $ API_TOKEN='xxxxxxxxxxx' make locales
```
+There is some bug on gotext and the catalog.go generated doesn't have a package, you will need to edit
+cmd/bitmask-vpn/catalog.go and to have a `package main` at the beginning of the file.
+
+If you want to add a new language create the folder `locales/$lang` before running `make locales`.
Report an issue