1. Documentation
L10N Guidelines for Developers by ChristianRose: what to watch out for, most common mistakes, etc.—a must read for any self-respecting developer who wants to reduce number of bug reports she gets
Internationalising GNOME application by MalcolmTreddinick: guides developers to using autotools and intltool-based build system setup for new and existing Gnome applications.
1.1. Translation contexts
Moved to Translation contexts of L10N Guidelines for Developers.
Translators: If you encounter any msgid that contains a '|' in a Gnome project, then the part before the '|' is a comment and your translation should only contain the translation for the part after the '|'. The described example would look like this de.po:
msgid "do something with a file|File" msgstr "Datei"
1.2. Preparing GConf schemas for translation
It looks like there is no documentation on the web describing how to set up GConf schemas files for translations. The example from http://www.gnome.org/projects/gconf/ needs to be changed into the following:
schemadir = @GCONF_SCHEMA_FILE_DIR@ schemas_in_files = foo.schemas.in bar.schemas.in schema_DATA = $(schemas_in_files:.schemas.in=.schemas) @INTLTOOL_SCHEMAS_RULE@ EXTRA_DIST = $(schemas_in_files) CLEANFILES = $(schema_DATA)
Then, intltool-update will collect the short and long names of the key from the foo.schemas.in file, will add them to the PACKAGE.pot file, and will insert the translated strings into the auto-created foo.schemas file. (This was discussed here http://bugzilla.gnome.org/show_bug.cgi?id=327353)
2. Most common problems
2.1. Innocent unmarked messages
Moved to What should be localized section of L10N Guidelines for Developers.
2.2. Language Bindings Notice
2.2.1. Python
If you are about to include multiple placeholders in one string, please notice that some languages might reorder the placeholders to get a more fluent result. According to python documentation, it would be better putting the actual name of the variable rather than plain placeholders.
- Bad practise:
#, python-format msgid "Cannot find file %s in folder %s."
- Good practise:
#, python-format msgid "Cannot find file %(file_name)s in folder %(folder_name)s."
2.3. Translation not showing up
- Ensure that you're calling setlocale(), bindtextdomain() and textdomain() with appropriate parameters (see "info gettext" for documentation, as well as the man pages)
GtkActionGroup: Ensure that you're calling gtk_action_group_set_translation_domain with appropriate domain name
libglade: Pass NULL as third parameter to glade_xml_new() for using default translation domain, or char* indicating domain name you want to use (API reference on d.g.o is outdated; use devhelp to browse gtk-doc-based reference)
2.4. Using multiple domains
Moved to Avoid creating multi domain modules section of L10N Guidelines for Developers.
2.5. How to fix invalid translation (.po) files
In some cases, an invalid .po translation file may appear in your repository with the effect of failing to compile your module. This situation should get rarer as there is a git hook that validates PO files as they are pushed to your repository. However, some invalid translations may make it through because the translations were added at a time when no validation was enabled when committing.
The way to deal with this issue is to simply mark the offending translation as fuzzy (incomplete), which makes the .po file validate, and allows the translation to fix the translation at a later date.
Replace (we show two examples)
#: ../libnautilus-actions/nautilus-actions-config-gconf-private.h:96 #, c-format msgid "Missing key: %s-%s" msgid_plural "Missing keys: %s-%s" msgstr[0] "Λείπει το κλειδί: %s" msgstr[1] "Λείπουν τα κλειδιά: %s" #: ../libnautilus-actions/nautilus-actions-config-gconf-private.h:102 msgid "Missing key" msgid_plural "Missing keys" msgstr[0] "Λείπει το κλειδί: %s"
with
#: ../libnautilus-actions/nautilus-actions-config-gconf-private.h:96 #, fuzzy, c-format msgid "Missing key: %s-%s" msgid_plural "Missing keys: %s-%s" msgstr[0] "Λείπει το κλειδί: %s" msgstr[1] "Λείπουν τα κλειδιά: %s" #: ../libnautilus-actions/nautilus-actions-config-gconf-private.h:102 #, fuzzy msgid "Missing key" msgid_plural "Missing keys" msgstr[0] "Λείπει το κλειδί: %s"
That is, you add the fuzzy keyword to the special line that starts with #,.
Furthermore, to notify the translators, please also report a bug about the problem in Bugzilla under the l10n product and the corresponding language component. This is not only in order to put the blame where the blame belongs, but more importantly to notify the corresponding language translators that this message was syntactically erroneous and needs a proper fix.
FIXME: Add stuff relevant to libraries