Translation contexts may be set to avoid ambiguities for translated
strings, in particular when the strings are short (see Contexts in GNU gettext
utilities). Translation contexts are set for translated
direction strings (see Direction Strings) and for special elements headings
(see Special Elements Information Customization).
For direction strings, the translation context is based on the direction name (see Directions), with ‘direction’ prepended and another string prepended, depending on the type of string:
button
‘button label’ is prepended
description
‘description’ is prepended
text
‘string’ is prepended
For example, the Top
direction button
direction string
translation context is ‘Top direction button label’.
As an exception, the This
direction has ‘(current section)’
prepended to have a more explicit translation context. The This
direction text
direction string translation context is thus ‘This
(current section) direction string’.
For special element headings, the translation context is obtained by
prepending ‘section heading’ to the special element variety (see Table 15.1). For example, the footnotes
special element
variety heading translation context is ‘footnotes section heading’.
Here is an example, which could be used with the same
function registered as format_translate_string
as in the example above:
texinfo_register_direction_string_info('Forward', 'text', undef, 'Forward'); texinfo_register_special_element_info('heading', 'contents', 'The @emph{Table of Contents}'); my %translations = ( 'fr' => { 'The @emph{Table of Contents}' => {'contents section heading' => '@result{} La @emph{Table des mati@`eres}',}, 'Forward' => {'Forward direction string' => 'Vers l\'avant @result{}',}, } ... );
Other translated strings may also be associated with translation contexts. The translation template file po_document/texinfo_document.pot in the source directory of Texinfo contains the translated strings appearing in all the output formats.