15.3 Translation Contexts

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 output units headings (see Special Units 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 output unit headings, the translation context is obtained by prepending ‘section heading’ to the special output unit variety (see Table 16.1). For example, the footnotes special output unit variety heading translation context is ‘footnotes section heading’.

Here is an example, which could be used with a similar function registered as in the example above (see New translated strings example):

texinfo_register_direction_string_info('Forward', 'text', undef,
                                       'Forward');
texinfo_register_special_unit_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.