Translation User Interface

TranslationUserInterface

This document is targeted at translators. If you are looking for instructions on configuring your Foswiki to work with your local language, see InstallationWithI18N

Foswiki is using CPAN:Locale::Maketext for user interface internationalisation. This is a very flexible framework for localisation, and supports several issues that are critical to good translation in most of existing languages, every those largely different from common western languages (see user interface internationalisation for further details).

The rest of this topic documents how one can contribute a new language to Foswiki.

Where are translations performed

The Foswiki project operates a Weblate based translation server at http://translate.foswiki.org. The new server is up and running for testing the translation process.

Users wishing to translate Foswiki into a new language, or contribute to existing translations should perform the following steps:

TIP The Foswiki project currently does not have federated accounts. It is important to use a common email address between Foswiki.org, Weblate, and GitHub, so that activities can be coordinated across the systems. If you really don't want your translations to be attributed, you don't have to establish developer access to github or foswiki.org, and a generic id will be used for checkins.

How can I add a new language to Foswiki ?

Languages are added using the Weblate admin interface. Contact one of the language administrators for more information.

Once a language is added to Weblate, it will be available for translation. Translations will be pushed to the Github account.

Foswiki development is done in the distro repository, master branch. Once a translation has reached a reasonable level of completion, it will be added to the Foswiki MANIFEST file for inclusion in the next release.

How can I report quality issues

Sometimes translation is made difficult because the developer made errors in the location or content of the MAKETEXT macro or call. You can use the "Comments" tab within Weblate. Enter a "Source String Comment" and it will be emailed to the Foswiki developers for action.

Translating

Translation changes made in Weblate

The Weblate tool will automatically push translations to github as they are saved. Translations are checked in under Tasks.Item13252. The identity of the translator is preserved and will be used for the commit back to github.

Fuzzy Translations.

If Weblate has a translation marked as "Fuzzy", it will not be used by Foswiki. It is important to review any fuzzy strings, and clear the fuzzy status for the string to be used.

Checking your translation

Translations are checked by the Weblate tool. When you sign into Weblate, you'll see the list of languages that you are translating, along with status information.

Reviewing translations made by others

The Weblate "Search" page, on the right side, has a form where you can select a starting date, and begin a review of translated strings. You can then step through the changes, and revise as needed.

Coordination of the translation process and translators

See TranslationProcess and TranslationTeam

Internals

File format

Foswiki translations uses extended PO format. Here is an abstract for this format. Examples ilustrate a Portuguese translation (although not all the strings are real).

  • An PO file has a sequence of msgid/msgstr pairs. The msgid indicates the original string. The msgstr is where you have to write your translation. Example:
    msgid "Edit"
    msgstr "Editar"
  • Each string can have parameters, identified by a percent sign and a number. Your translation must keep the logic between them. Example:
    msgid "The %1 topic in the %2 web"
    msgstr "O tópico %1 na web %2"

Translations marked as "fuzzy" are not used, you must remove the "fuzzy" tag after reviewing the translation.

Attention: Foswiki translation files must be encoded in UTF-8 !

Checking your translation

Translations are checked by the Weblate tool. When you sign into Weblate, you'll see the list of languages that you are translating, along with status information.

You can also the following command to check your translation:

cd core/locale
msgfmt --statistics --output=/dev/null <your_language>.po

This will output the number of translated, unstranslated and fuzzy strings. See man msgfmt for details (msgfmt is part of GNU gettext).

Adding your translation to Foswiki

New translations can be added by an administrator using the Weblate interface. This information is included here for reference of what happens internally.

If you are a developer adding a new translation to the GIT repository for inclusion into the next release, you must do the following:

  • add the translation file to the locale/ directory. It must end up at locale/language.po
  • Add the translation to the core/lib/Foswiki/Contrib/core/MANIFESTfile
    • locale/language.po 0444
  • add translator credits to data/System/ReleaseHistory.txt

String changes within Foswiki

The script tools/xgettext.pl will scan all components of the release and merge new / changed / removed strings into locale/Foswiki.pot and then merged with existing translations in the <language>.po files. Commit these changes under Tasks.Item13252 and push to the github repository. Weblate is automatically notified of the changes and will merge them into the translation tools.

-- Contributors: AntonioTerceiro, SteffenPoulsen, RichardDonkin, AndreUlrich, GeorgeClark
Topic revision: r15 - 10 Oct 2019, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy