| 1 |
translation-canary |
| 2 |
------------- |
| 3 |
|
| 4 |
Translations can crash your program. Creating software for a wide audience |
| 5 |
means sending your strings away for translation, and giving up control of your |
| 6 |
strings means that strings with extralinguistic content can come back broken. |
| 7 |
No one is likely to even realize it until someone fires up your program in |
| 8 |
Hungarian and it crashes because Gtk bombed out on some busted markup, and the |
| 9 |
Hungarian speaker is sad, and you are sad, and everything is just the absolute |
| 10 |
worst. |
| 11 |
|
| 12 |
This is the canary in the translation coalmine. |
| 13 |
|
| 14 |
There are two parts to this project: |
| 15 |
|
| 16 |
translatable: |
| 17 |
This contains checks on the strings to be submitted for translation. This |
| 18 |
ensures that the content of the original strings marked for translation are |
| 19 |
suitable for translation. These tests are run on the POT file before |
| 20 |
uploading the POT or the updated PO files to the translators. |
| 21 |
|
| 22 |
translated: |
| 23 |
This contains checks on the strings returned from the translators. This |
| 24 |
ensures that the content of the translated strings won't break anything. |
| 25 |
These tests are run on the source directory before creating a release. |
| 26 |
|
| 27 |
Both translatable and translated are run by running the module |
| 28 |
(e.g., `python3 -m translation_canary.translatable`) with the input file(s) as |
| 29 |
the argument. |
| 30 |
|
| 31 |
In addition to the python modules, this project contains xgettext_werror.sh, a |
| 32 |
wrapper for xgettext that treats warnings as errors. xgettext will print |
| 33 |
warnings as it extracts translatable strings from source files, and these |
| 34 |
warnings should be addressed instead of silently ignored as they scroll by in |
| 35 |
the build output. To use the script in a package that uses the gettext template |
| 36 |
files from autopoint or gettextize, set XGETTEXT=/path/to/xgettext_werror.sh in |
| 37 |
Makevars. |
| 38 |
|
| 39 |
|
| 40 |
Usage as a subtree |
| 41 |
================== |
| 42 |
|
| 43 |
Anaconda and Blivet use translation canary as a git subtree. If you need to |
| 44 |
change the canary for these projects, follow these steps: |
| 45 |
|
| 46 |
1. Make changes and test them in the context of your project. |
| 47 |
|
| 48 |
2. Copy these changes to the ``translation-canary`` repo and make a pull |
| 49 |
request with these changes. |
| 50 |
|
| 51 |
3. After that PR is merged, go to Anaconda or Blivet repo root and run:: |
| 52 |
|
| 53 |
dnf install git-subtree |
| 54 |
git subtree pull --prefix translation-canary/ [email protected]:rhinstaller/translation-canary.git master --squash |
| 55 |
|
| 56 |
This produces a squash commit with some ancient parent, and then also |
| 57 |
a merge commit that merges the squash commit into your current ``HEAD``. |
| 58 |
|
| 59 |
4. Make a topic branch and PR for merging what you got into your project. For |
| 60 |
the purpose of making branches and PRs, the commits above are not special |
| 61 |
in any way. |
| 62 |
|
| 63 |
Note: There is no way to detect subtree presence, it behaves as regular files |
| 64 |
and directories. |