Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update GetText doc #7618

Merged
merged 5 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,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