Welcome to Translation with context

Translation with context

By Mark Overmeer (‎markov‎) from Arnhem.pm, Amsterdam.pm
Date: Friday, 22 August 2014 12:00
Duration: 20 minutes
Target audience: Any
Language: English


The GNU gettext system is commonly used as management framework for translating text. The strings in the program are called 'msgid'. PO (and MO) tables are created per language, linking those msgids to the text to be displayed for that language.

One of the complications of translations, is that values may need to be filled-in. The order of these inserted texts may depend on the languages. This means that you usually have to play with formatted print.

One thing that GNU gettext is not able to handle, is that the inserted values may influence the whole translation. For instance, when a person's name is inserted, the sentence might need to either use the she or the he form. English is a relatively easy language in this respect, but many languages are not so forgiving.

Log::Report::Translate::Context uses the msgctxt field of standard PO-files to make this very simple. Little information is added to msgids, to make context sensitive translations possible. Example of use:

print __x"{name<gender} forgot his bag", name => $name;

In this case, the insert of the name parameter links to the 'gender' setting in the context, which influences the PO record to be used. Come to the talk to see how easy this works.


Attended by: osfameron, Alex Balhatchet (‎Kaoru‎), Alex-P. Natsios (‎Drakevr‎), Красимир Беров (‎berov‎), sotona, Upasana Shukla (‎upasana‎), Mihai Pop, Anca Davidel, Ovidiu Satmari (‎ovidiu.satmari‎), Dumitru Negrea, Oliver Hoos, ignat ignatov, Tudor Constantin, Marc Egea i Sala (‎meis‎), Anton Berezin (‎Grrrr‎), Zlatin Stanimirov, Jean Forget, Vladimir Vasilev, Oana Raluca Rusu, Ivan Ivanov (‎suricactus‎), Mihaela Marinca, Manol Roujinov, Michael Lush, Søren Lund (‎slu‎), Anatoliy Dmytriyev (‎tolid‎), Jean-Baptiste Mazon, Kamen Naydenov (‎pau4o‎), Pavel Scherbinin (‎Dzirtik‎), Paul Cochrane (‎ptc‎), Andrew Nugged (nugged), Jan Kittler (‎Kita‎), Roman Daniel (‎wayan‎), Steffen Winkler (‎STEFFENW‎), Mihai Safta (‎SDCM‎), Thomas Reifenberger,