Skip to content

Commit

Permalink
docs: update GetText doc (#7618)
Browse files Browse the repository at this point in the history
* Better documentation

* Fix doc

* Fix doc about en.po

* Update labeler.yml

Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>
Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
  • Loading branch information
3 people authored Nov 2, 2022
1 parent 22bf228 commit 3ccb0f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ footer:
documentation:
- docs/**/*
- scripts/generate_perl_html_doc_from_pod.pl
- po/README.md

docker:
- docker/**/*
Expand Down
26 changes: 24 additions & 2 deletions po/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
### Translations
You can translate Open Food Facts at https://translate.openfoodfacts.org. Please do not translate directly in the code, or your translations will be overwritten.
If you have added or modified a string in the source file (the file with the .pot extension), you should update the crowdin-trigger branch from main/develop. This will trigger import within Crowdin, and 1 hour later, it will create a new pull request with added or modified strings in all language files, plus all added or modified translations.
You can translate Open Food Facts at https://translate.openfoodfacts.org thanks to the Crowdin platform. Please do not translate directly in the code, or your translations will be overwritten.

If you want to add a translatable string in the code:
* modify the file with the `.pot` extension related to your context. Eg.
```pot
msgctxt "name_of_your_string"
msgid "Hello world!"
msgstr ""
```
* modify the file `en.po` related to your context, to be sure at least an english string will be displayed before Crowdin send back all `.po` files (which can take several days). It should be the same code as the one from `.pot` + the english transaltion (see `msgstr` field). Eg.
```po
msgctxt "name_of_your_string"
msgid "Hello world!"
msgstr "Hello world!"
```
* use your new string with the `lang()` function. Eg. in a template file: `[% lang('name_of_your_string') %]`
* if you want to test your modifications in your dev environnement:
* modify the `fr.po` files if you want to test in French; be aware it's just for test: these files will be overwritten by Crowdin. Eg. in French:
```pot
msgctxt "name_of_your_string"
msgid "Hello world!"
msgstr "Salut le monde!"
```
* don't forget to `make build_lang` to let docker take your modifications into account

0 comments on commit 3ccb0f2

Please sign in to comment.