Localization/Concepts/Auto Assists: Difference between revisions

From KDE TechBase
No edit summary
Line 35: Line 35:
# If the language directory contains the file <tt>messages/kdelibs/kdelibs4.po</tt>, then Scripty copies the '''plural formula''' and a couple of other fields in the header ('''merges''' the header) from that <tt>kdelibs4.po</tt> file to all other translation catalogs for the same language.
# If the language directory contains the file <tt>messages/kdelibs/kdelibs4.po</tt>, then Scripty copies the '''plural formula''' and a couple of other fields in the header ('''merges''' the header) from that <tt>kdelibs4.po</tt> file to all other translation catalogs for the same language.
# Profit! For example, if you are a translator and your .po editor does not add all the necessary fields to the header or gets the plural formula wrong, then Scripty will fix those problems. It is very useful for those localization teams that use unofficial (tweaked) plural formulas for KDE (Serbian, Ukrainian, Russian - any else?)
# Profit! For example, if you are a translator and your .po editor does not add all the necessary fields to the header or gets the plural formula wrong, then Scripty will fix those problems. It is very useful for those localization teams that use unofficial (tweaked) plural formulas for KDE (Serbian, Ukrainian, Russian - any else?)


How header adjustment works in l10n-kf5:
How header adjustment works in l10n-kf5:
Line 40: Line 41:
# If the language directory contains the file <tt>messages/frameworks/ki18n5.po</tt>, then it '''merges''' the header from there to all '''other''' *.po files - to those catalogs that will be used with KI18n localization system and the i18n*() calls.
# If the language directory contains the file <tt>messages/frameworks/ki18n5.po</tt>, then it '''merges''' the header from there to all '''other''' *.po files - to those catalogs that will be used with KI18n localization system and the i18n*() calls.
The above mentioned language teams using tweaked plural formulas will have different plural formulas in *_qt.po and other .po files, but still the plural formulas will be consistent inside each of these two sets of .po files.
The above mentioned language teams using tweaked plural formulas will have different plural formulas in *_qt.po and other .po files, but still the plural formulas will be consistent inside each of these two sets of .po files.


The adjustment described above is done in the script <tt>check_po_files</tt> with a few runs of the helper script <tt>change-header.pl</tt>.
The adjustment described above is done in the script <tt>check_po_files</tt> with a few runs of the helper script <tt>change-header.pl</tt>.

Revision as of 19:48, 15 May 2014

Automatic Translation Assists
On Localization   Concepts
Prerequisites   The PO Format
Related Articles   Building KDE's l10n Module
External Reading   n/a

Daily jobs done by Scripty

Language coordinators would have a lot of routine work to do unless there was a daily job running on the KDE l10n server and doing simple cleanups in SVN. It is called Scripty and consists of a the following scripts:

  • update_translations
  • check_po_files

These two scripts and its dependencies are located in the "scripts/" directory in each of the three currently maintained localization branches:

  1. branches/stable/l10n-kde4,
  2. trunk/l10n-kde4 and
  3. trunk/l10n-kf5.

There is an Umbrello diagram which describes usage of scripts in the "scripts/" directory in SVN. It was initially drawn for KDE4 and is not up to date as of KF5.0, but still may help a lot if you want to get familiar with Scripty.

Daily script: update_translations

TBD

Daily script: check_po_files

The script check_po_files does the following operations on translation catalogs:

  1. Adjusts headers of .po files to make them uniform (using the other script - scripts/change-header.pl). See below "Adjustment of .po headers".
  2. Check .po headers with msgfmt
  3. Makes sure there are no translation templates (.pot) in language directories
  4. Runs simple checks for translations in desktop_*.po

Adjustment of .po headers

How header adjustment worked in l10n-kde4:

  1. If the language directory contains the file messages/kdelibs/kdelibs4.po, then Scripty copies the plural formula and a couple of other fields in the header (merges the header) from that kdelibs4.po file to all other translation catalogs for the same language.
  2. Profit! For example, if you are a translator and your .po editor does not add all the necessary fields to the header or gets the plural formula wrong, then Scripty will fix those problems. It is very useful for those localization teams that use unofficial (tweaked) plural formulas for KDE (Serbian, Ukrainian, Russian - any else?)


How header adjustment works in l10n-kf5:

  1. If the language directory contains the file messages/frameworks/kcoreaddons5_qt.po, then it merges the header from there to all *_qt.po files - to those catalogs that will be used with Qt localization system and the tr() call.
  2. If the language directory contains the file messages/frameworks/ki18n5.po, then it merges the header from there to all other *.po files - to those catalogs that will be used with KI18n localization system and the i18n*() calls.

The above mentioned language teams using tweaked plural formulas will have different plural formulas in *_qt.po and other .po files, but still the plural formulas will be consistent inside each of these two sets of .po files.


The adjustment described above is done in the script check_po_files with a few runs of the helper script change-header.pl.