Skip to content
Snippets Groups Projects
Unverified Commit 3312593a authored by meskio's avatar meskio :tent:
Browse files

[locales] improve the locales workflow and document it

parent c5f33ab5
No related branches found
No related tags found
No related merge requests found
......@@ -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/$*/
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment