TranslatorsHowTo

From IndLinux

Jump to: navigation, search

Contents

Simplified Translators Howto

What is all this about?
Ever wanted to use an application with the interface ( menus, dialogs, help etc) in your own language ? If yes, this is exactly doing that. Here we are providing local language interface for applications, by translating the user interface - menus, dialogs , help etc to user language. Here we are focussing on translating free software like KDE, GNOME etc which use the [ GNU gettext | GnuGetText ] framework

What needs to be done?
Translations, translations, translations....... testing, review, testing, review.... There is a large volume of translations to do. About 1,30,000 strings total for KDE and GNOME UI!!, and much more for their documentation.

How does it work?
Almost all applications that are run under Linux use the GNU gettext framework. GUI text, i.e all that is visible to a user in menus, dialogs, application window etc. is stored in message catalogs (called PO files), which are translated. When an application runs in particular language environment, it looks for translated message catalog for that language and uses it if it finds one.

How can I volunteer/help?
As a translator:
If you are have a good vocabulary in your language, or are a linguist or professional translator then you can volunteer for translation PO files and user docs.

As reviewer
You have good language knowledge, & can spare some time in reviewing translation work already done, comment on suitablilty of terms, grammar etc. You need be a translator for some time to graduate to a reviewer.

As a Tester
Don't have enough time to spare.. Still you could help, by just using the applications and reporting any errors, inconsistencies in translations.

How to join in
First join a language team . See next section for language teams contact info. eg If you would like to help for Hindi, esp for Gnome

Join the  indlinux-hindi-gnome list

Post your interest on the list.

PO file translations

Look up latest status, what packages are already translated.
KDE GUI statistics
GNOME translations statistics
See what module/file you would like to work
 If its unmaintained or not yet started take it up. Contact the team coordinator telling you want to take up that module.
 In the beginning you should start with a small small pot file (<100), then medium (100-500), as you become more experience & expert you can take up bigger ones.

How to translate

Before you begin with translations you need to know few things, basically pot file format and few commands used to process translations

PO File basics

POT (Portable Object Template) is a file without any translations. Its in 2 parts

  • the POT header
  • msgid - msgstr pairs

Header contains Translator details, team details, Date & time PO was last modified and character set being used for translation

Below is sample header from untranslated po file.

# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2002-05-28 09:28+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

If you are starting with a new POT file you should modify the header as follows

- Add you name & email in the line
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
eg
  # Amit Verma <amitverma@amitverma.com>, 2003

- Remove the  #, fuzzy line
- edit the line and put package name for PACKAGE
"Project-Id-Version: PACKAGE VERSION\n"
eg
"Project-Id-Version: gedit 2.2\n"

- Once you are finished translating the po, change the line
	"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 to reflect current date and time
 eg.
  "PO-Revision-Date: 2002-06-06 18:26+5:30\n"

- Add your name , and email address
	"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
eg.
"Last-Translator: Amit Verma <amitverma@amitverma.com>\n"

- The languangge & team mailing list
	"Language-Team: LANGUAGE <LL@li.org>\n"
 this should be say
 "Language-Team: Gnome Hindi Team<indlinux-hindi-gnome@lists.sourceforge.net>\n"

- Character set, set CHARSET to UTF-8
	"Content-Type: text/plain; charset=CHARSET\n"
change to
 "Content-Type: text/plain; charset=UTF-8\n"
So finally the header should look like.
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Amit Verma <amitverma@amitverma.com>, 2003.
#
#
msgid ""
msgstr ""
"Project-Id-Version: gedit 2.2\n"
"POT-Creation-Date: 2002-04-04 10:07-0500\n"
"PO-Revision-Date: 2003-02-08 15:50+5:30\n"
"Last-Translator: Amit Verma <amitverma@amitverma.com>\n"
"Language-Team: Gnome Hindi Team <indlinux-hindi-gnome@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

Msgid - Msgstr pairs
Following the header are msgid - msgstr pairs, which contain the original english string and translation respectively This pair is usually preceded by a comment which usually contains some line no & file name from which the string was extracted and any comments added by programmer

eg.

#: applet/gswitchit_applet.c:305
msgid "XKB toolkit for GNOME"
msgstr ""

Translation needs to be added in the msgstr line
so after translation it becomes

#: applet/gswitchit_applet.c:305
msgid "XKB toolkit for GNOME"
msgstr "GNOME ka XKB yantra"

#: bonobo-activation/bonobo-activation-shlib.c:101
#, c-format
msgid "g_module_open of `%s' failed with `%s'"
msgstr "%s à¤<95>ा g-module-open à¤<85>सफल"

There could be strings spanning multiple lines eg.

#: eel/eel-gconf-extensions.c:87
#, c-format
msgid ""
"GConf error:\n"
"  %s\n"
"All further errors shown only on terminal"
msgstr ""
"à¤<9C>à¥<80>à¤<95>ानà¥<8D>फ à¤¤à¥<8D>रà¥<81>à¤<9F>ि:\n"
" %s\n"
"à¤<85>ाà¤<97>à¥<87> à¤<95>à¥<80> सभà¥<80> तà¥<8D>रà¥<81>à¤<9F>ियà
¤¾à¤<82> सिरà¥<8D>फ à¤<9F>रà¥<8D>मिनल पर दिà¤<96>ाà¤
<88> à¤<97>यà¥<80> हà¥<88>"

By now it must be pretty abvious what needs to be done. You need to give the translations in msgstr field. Translating is pretty straightforward , open this file in an editor (like gedit or yudit, which allows you to type in your language, one by one add translations. While translating you need to keep in few things in mind. Read guideline sections for it.

Using translation tools

Doing translations in a simple editor is really tedious, you would not like to type same phrase you typed again and again. Since the file has a specific format its best done using tools specifically made for this purpose or editors which provide a feature for translating po files.

The best is Kbabel, a KDE based translation tool.(But we wont cover it here right now, since indian language support is not yet properly working in KDE). Another tool, Gnome based is Gtranslator ( www.gtranslator.org ), It has a Gnome 2 version , but is very buggy and unstable, so can be really used.

Then there is poedit , a simple tool for translating, its development version is based on gtk2.0 which has indian language support. Its simple interface make its easy to get started, it also features translation memory.

Testing

Once you have done translating, check the po file for errors. msgfmt tool is used for this. To just see statisitcs for po file

msgfmt --statistics file.po
eg.
[goofy@localhost 2.0]$ msgfmt --statistics gtkhtml.HEAD.hi.po
258 translated messages, 17 fuzzy translations, 90 untranslated messages.

You will get above only if there are no fatal errors in translation. Refer to section 'Common errors' to know possible kind of errors & their fix. Most errors are due to some typo you made eg. missing `"' , \n or c-format string errors.

Installation of translations

Copy the translation to respective language's catalog directory.

eg. for Hindi it will be
 /usr/share/locale/hi/LC_MESSAGES/ or /usr/local/share/locale/hi/LC_MESSAGES
$ msgfmt -o gedit-2.0.mo gedit.HEAD.hi.po
# cp gedit-2.0.mo /usr/share/locale/hi/LC_MESSAGES/

Now you can start the respective application for the po file. eg gedit in case of gedit.HEAD.hi.po

$ export LANG=hi_IN
$ gedit &

The program should load with interface in your language (say Hindi). Go through the application to check how the translations are appearing. Sometimes the translated po file may not be that of a standalone application, it may be part of some bigger application/library . In such case you need to open an application which you think uses that application. eg for libgnomeprint.po , since its part of gnome printing library, open an application which uses printing feature ( eg gedit ), to test it.

Submitting

Once you have checked for all errors & tested your translations, email them to language coordinator or group maintainer. Also post on the respective mailing list about your work. (Don't send translated file on list!). Before adding the translation to CVS, your translation will be reviewed by another person.


Using the tools
Since all translations have to be in UTF-8, we need editors supporting Unicode &Indic rendering. Below few

Using Gnome2
Gedit - text editor of GNOME could be used. So also Abiword.

Using yudit
Yudit is a simple Unicode editor, has Opentype font support for Devanagari, Malayalam & other indic languages. Inscript & phonetic keymaps are available for typing in Indic. You can download the latest versions from

http://www.yudit.org/
Binary RPMs and Windows version is available at
http://www.yudit.org/download/binary/

A guide on using Yudit is here

Using Gtranslator
Gtranslator is Gnome based tool for PO file translations. Its available from http://www.gtranslator.org if you distribution doesnt already have it.

Using Kbabel
The best tool for the job, Kbabel supports a host of features, catalog manager, autotranslation, easy navigation through PO files, context based

Using Poedit
Poedit ( http://poedit.sourceforge.net/ ) is another PO editing tools. It is cross-platform gettext catalogs (.po files) editor. It is built with wxWindows toolkit and can run on any platform supported by it (although it was only tested on Unix with GTK+ and Windows). It aims to provide more convenient approach to editing catalogs than launching vi and editing the file by hand."

Using Emacs
Emacs has a built in PO mode to edit PO(T) files. Some basic Indic support is available

Online based tools

Pootle

Launchpad.net


Entrans</br>


Gettext utilities

msgfmt

compile message catalog to binary format
msgfmt [OPTION] filename.po ...
     -o, --output-file=FILE
             write output to specified file
     --statistics
             print statistics about translations

msgunfmt

uncompile message catalog from binary format, ie get a .po file from .mo
msgunfmt [OPTION] [FILE]...
     -o, --output-file=FILE
             write output to specified file
      -s, --sort-output
             generate sorted output

msgcat

combines several message catalogs. This tool is used to build a PO compendium, a po file containing all translations extracted from a set of po files. This PO compendium can then be used to fill in translations in empty pot files. This is done using msgmerge utility ( see below ).
msgcat [OPTION] [INPUTFILE]...
     -o, --output-file=FILE
             write output to specified file
     --use-first
             use first available translation for  each  message,
             don't merge several translations
     -<, --less-than=NUMBER
             print  messages  with  less  than this many defini-
             tions, defaults to infinite if not set
     ->, --more-than=NUMBER
             print messages with more  than  this  many  defini-
             tions, defaults to 0 if not set
     -u, --unique
             shorthand  for  --less-than=2,  requests  that only
             unique messages be printed
     --no-location
             do not write '#: filename:line' lines
      -s, --sort-output
             generate sorted output
      -F, --sort-by-file
             sort output by file location

msgmerge

merge message catalog and template
msgmerge [OPTION] def.po ref.pot
 Merge two .po files together. def.po is existing PO file containing translations ( this could be PO Compendium ). ref.pot is last created PO file with uptodate source references but old translations or a POT file. Any translation in the file will be discarded
      -s, --sort-output
             generate sorted output
      -F, --sort-by-file
             sort output by file location
      --no-location
             suppress '#: filename:line' lines
      --add-location
             preserve '#: filename:line' lines (default)

eg.

msgmerge -s --no-location allstrings.po package.po

For more do a 'info gettext' or read (Insert web link to gnu gettext online docs)

Testing the translated po


- Check for errors in translated po by msgfmt command

$ msgfmt --statistics sample.hi.po

eg. [goofy@cartoon TranslatedPO]$ msgfmt --statistics gtk+.HEAD.hi.po 804 translated messages, 210 untranslated messages.

Another example: $ msgfmt --statistics libgnomeprintui.hinew.po 76 translated messages, 20 fuzzy translations, 14 untranslated messages.



Points to take note when translating.

  • Completing the header
  • Read comments
  • fuzzy entries
  • C-Format strings
    • ordering of format specifiers
  • Newlines
  • Quotes, punctuation
  • in KDE comments not to be translated
    • In KDE for a string of the following form
msgid ""
"_: NAME OF TRANSLATORS\n"
"Your names"
should not be translated as
msgstr ""
"_: NAME OF TRANSLATORS\n"
"अमित वर्मा"
but just
msgstr "अमित वर्मा"
Personal tools
communication
Development