Prev Up Top Next Contents
7.1 Internationalization
Therion is distributed with support for english (en), cezch (cz),
slovak (sk), and other languages from contributors:
french (fr), spanish (sp), polish (po), italian (it), and german (de),
russian (ru), albanian (sq).
Adding a new language is very simple thanks to the fact that the localization
is contained in the subdirectory thlang of therion,
and there is a perl script, process.pl, to generate a localization file
from the list of the strings for the different supported languages.
This script can also be used to create an empty file for a given language, and
include its content in the localization file, after it has been filled in
with a text editor.
Since the script is in PERL, you must have a perl interpreter installed on
your system. This is normal for every Linux distribution.
If you do not have it (likely if you have Windows) you can download
PERL from CPAN ((comprehensive PERL archive network), as well as
the additional perl modules that you may need. The url is
http://www.cpan.org
.
The last thing you must do is to set the language in the configuration file
of xtherion
.
legend
text
7.1.1 Legend names
If you want to change a name in the legend only for a cave project
you use the thconfig command
text
. The syntax is "text
". For example, say you are generating the output in english, to
change the symbol "wall" legend to "cave wall", you add to the thconfig
file the line (in the thconfig file)
text en "line wall:bedrock" "cave wall"
\edncode
If a line type has subtypes, you must specify the subtype too:
if you write only "line wall" it does nothing. If you define custom (user)
lines assign them a subtype and use this feature to print a meaningful
legend. For example, "line u:rope" "rope".
\brall
\subsection Localization
As an example we describe the localization for italian (it), so that
you can have cave maps and atlases with italian legends, and the interface of
\tt{xtherion} in italian too.
Move into the directory \it{therion/thlang} and execute the command
\br
\code
perl process.pl export it
.
For other languages use the respective code, eg, "de" for german, and so on.
This generates the text file texts_it.txt containing lines with
the command name used by therion
followed by lines with the string "it:"
with nothing else on it.
You must open this file with a text editor and write the string (or phrase)
in the locale language on the lines beginning with
"it:", ie, the language code. This is what therion
will write
when it generates the output.
Every string or phrase must stay on a single line.
Multiline labels or description are not supported.
It is not possible to use the continuation combination (backslash-newline)
either, because the perl script does not recognize it.
When you are doen with the editing, run the command
perl process.pl update
This will include the content of the file
texts_it.txt in the global file
texts.txt, and removes the file
texts_it.txt.
In case of errors it points them out to you.
For instance if you forget to insert a string/phrase and leave a line with
only the header "it:" it tells you, adding where in the file there is
the missing translation. In this case, regenerate the file
texts_it.txt, as you did before. It will have all the inputs
you have entered, and you need only to fill in the missing translation.
Then repeat the "update" command.
When everything is in order, run the script with no argument,
perl process.pl
This generates the source files in the directory of
therion
:
...
updating definitions from ../thsymbolset.cxx ... done
updating definitions from ../thexpmap.cxx ... done
updating definitions from ../thlocale.cxx ... done
updating definitions from ../thmapstat.cxx ... done
updating definitions from ../thpdf.cxx ... done
Move up in the directory of "therion", recompile it, and reinstall it.
Now therion
is ready to generate cave maps with legends in italian.
7.1.2 Configuration
The last step is to specify the default language in the configuration file
of therion
. At a global level this is "/etc/therion.ini"
or "/usr/local/etc/therion.ini"
(on Linux). At a local level there is ".therion/therion.ini" (on Linux)
in your home directory. Open one of them with a text editor and search the
string "language". It is commented (there is a '#' in front of it).
Make a copy of it, uncomment it and replace "en_UK" with "it" (the language
code).
Alternatively you can specify the language with the layout option "language".
For example "language fr".
Now try to generate surveys with the legends in different languages.
7.1.3 xtherion
Also xtherion
can be localized, justlike therion
.
Go into the directory "xtherion/lang", and repeat the procedure with the
script "process.pl": export the file "texts_XX.txt" (replace "XX" with your
language code), edit it and write proper strings for the messages in your
language. Update the file "texts.txt". Finally execute the script
without arguments.
You are not done. You must insert also the texts that will be displayed with
the menu "Help | Controls". move up in the "xtherion" directory and edit the
file "msgusr.tcl": you must insert an object for the text to display
(again, replace "XX" with your language code):
::msgcat::mcset XX "xtherion_help_control" [encoding convertfrom utf-8 {
-- write the text here --
}]
Go up in the therion
directory and execute "make install".
xtherion
has its initialization file, "/etc/xtherion.ini".
Open it with a text editor and search the string "mclocale".
It is usually commented (the line starts with '#') and with the language code
"sk". make a copy if it. Remove the comment from the copied line and replace
"sk" with your language code.
7.1.4 Other extensions
Therion can handle other extension to the data
presentation, ina modular way, as for the localization.
Possible extensions are:
- encodings
- TeX encodings
- macros of TeX and MetaPost
More details can be found in the Therion book [thbook 62].
therion users - Thu Nov 10 16:59:57 2011
Prev Up Top Next Contents
This work is licensed under a Creative Commons
Attribution-NonCommercial-ShareAlike 2.5 License.