| 1 |
Internationalization notes |
| 2 |
-------------------------- |
| 3 |
- apps: |
| 4 |
- use setlocale to parse locale env vars and set to language code |
| 5 |
- use textdomain to set the text domain of their app |
| 6 |
- use bindtextdomain to tie the domain to a locale dir |
| 7 |
- use gettext (possibly disguised as _) to translate in the current domain |
| 8 |
|
| 9 |
- libraries: |
| 10 |
- should only use bindtextdomain to tie a domain to a locale dir |
| 11 |
- use dgettext (possibly disguised as _) to translate from a set domain |
| 12 |
|
| 13 |
- How to make your plug-in code translatable: |
| 14 |
- in plugin_init, add a block like this: |
| 15 |
|
| 16 |
#ifdef ENABLE_NLS |
| 17 |
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, |
| 18 |
LOCALEDIR); |
| 19 |
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); |
| 20 |
#endif /* ENABLE_NLS */ |
| 21 |
|
| 22 |
- mark all strings you want translated for translation by wrapping them in |
| 23 |
_() |
| 24 |
- typically, these are all strings that serve as the message string for a |
| 25 |
GST_ELEMENT_ERROR or _WARNING |
| 26 |
- but it could also consist of any strings that may end up being presented |
| 27 |
to the user (for example mixer track) |
| 28 |
|
| 29 |
Things to watch out for |
| 30 |
----------------------- |
| 31 |
- forgetting to bindtextdomain is an error that is not always noticeable, |
| 32 |
because: |
| 33 |
- any plugin from the same module being init'd binds the text domain, |
| 34 |
so you may forget it in B, and still have it work because A bound the |
| 35 |
domain |
| 36 |
- without a bindtextdomain call, any domain is bound to the system locale |
| 37 |
dir - so you could still have translations if it happens to be where the |
| 38 |
translations are |
| 39 |
|
| 40 |
- our translations are managed by the Translation Project |
| 41 |
http://www.iro.umontreal.ca/translation/ |
| 42 |
They are updated by the release manager for prereleases using |
| 43 |
make download-po |
| 44 |
As the translator project website clearly states, only accept translations |
| 45 |
from the translation project, and direct would-be translators there: |
| 46 |
"It would defeat the purpose of the teams if you were directly accepting PO |
| 47 |
files from individual translators, or were having "contracts" with them. If |
| 48 |
people write to you, wanting to volunteer as translators, direct them to |
| 49 |
[email protected], and the translation coordinator will send them |
| 50 |
appropriate documentation." |