Texi2HTML – Texinfo to HTML v1.78: A. Internationalization
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A. Internationalization

The strings written in the document are selected based on the document language. This can be used to customize the strings, as described in Customizing strings written by texi2html. This also enables translation of the strings.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.1 Translating strings


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.1.1 Contributing to existing translations

If the language is allready supported, then there will be a file in the ‘i18n’ directory with name the two-letter ISO-639 language code. In that case you can enhance the translations by editing this file. There is a $LANGUAGES->{'language'} hash in that file. The keys are the english strings, in '', the values (in '' after =>) are the translations. When a string contains a ‘%’ followed by ‘{name}’ it means that the string will be expanded by texi2html. For an example, see Customizing strings written by texi2html.

After that you should run the command ./manage_i18n.pl merge in the top directory, it should merge your file with the existing files in ‘translations.pl’, which is incorporated to the ‘texi2html’ script by make.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.1.2 Contributing translations to another language

If the language isn't currently supported, copy the ‘en’ file in ‘i18n’ to a file with name the two-letter ISO-639 language code of your language and then add your translations to the strings. You could also add your two-letter language code in the ‘manage_i18n.pl’ file in the @known_languages array.

After that you should run the command ./manage_i18n.pl update lang and ./manage_i18n.pl merge in the top directory.

Obsoleted strings are not removed from the files, they are still present in the $T2H_OBSOLETE_STRINGS->{'language'} hash in case the string is reused later.

If you made change to strings specified in installed files (see section Installation of texi2html) you will have to reinstall them otherwise the installated files will take precedence (see section Use initialization files for fine tuning).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.2 Adding new strings written to document

If you need to write strings, for example the new string a string to the resulting document, call &$I('a string'). Use simple quotes. If you want to substitute a value in the string put %{string_value}, in the string, and give a second argument to &$I, a hash reference with key string_value and value the what you want to substitute. Here is an example:

 
return &$I('%{name} of %{class}', 
       { 'name' => $name, 'class' => $class });

In that case %{name} is substituted by $name in the translated string.

After that you should run the command ./manage_i18n.pl in the top directory, to add your new strings to the template file, that is the file for english and to all the files in the ‘i18n’ directory. This is achieved with

 
./manage_i18n.pl template
./manage_i18n.pl update

These two commands won't work if you don't have the Data::Dumper module installed. And to merge the new translation files in ‘translations.pl’, do

 
./manage_i18n.pl merge

All these steps may be performed by make, once the language file is added to ‘Makefile.am’ in the i18n_files variable.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Derek Price on June, 5 2007 using texi2html 1.78.