File: localization.html

package info (click to toggle)
redet 8.26-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,696 kB
  • sloc: tcl: 38,887; makefile: 58
file content (92 lines) | stat: -rw-r--r-- 4,674 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<!--Time-stamp: <2005-12-19 11:29:15 poser> -->
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
   <META NAME="Author" CONTENT="Bill Poser">

   <TITLE>Redet Reference Manual: </TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFE2C0" VLINK="#0000EE" LINK="#AA0066" ALINK="#FF0000">

<H2><a name="localization">Localization</a></H2>
<P>
<i>Redet</i> is fully internationalized, meaning that the program is written
in such a way that all messages and labels can be localized without modification
to the program itself.
The system used is the
<a href="http://www.tcl.tk/man/tcl8.4/TclCmd/msgcat.htm">Tcl version</a> of
<a href="http://www.gnu.org/software/gettext/">GNU gettext</a>. In this system,
each string is looked up in a message catalog, which pairs strings in the
original language with their translations. If there is an entry for it,
the translation is used in place of the original string. If not, the original
string is used. This allows translations to be used while they are still incomplete.
</P>
<P>
The message catalog to use is determined by the current locale. A fully specified locale consists
of a language, a region (usually a country), and an encoding. For example,
the locale <i>es_ES.UTF-8</i> is the locale for Spanish as used in Spain encoded
in UTF-8 Unicode. <i>es_ES</i> is the locale for Spanish as used in Spain encoded
in the ISO-8859-1 (Latin-1) encoding, since this is considered the default for Spanish.
This could be made explicit by using the locale specification <i>es_ES.ISO-8859-1</i>.
</P>
<P>
In a Unix shell the locale is defined by the settings of a set of environment
variables. These include <i>LANGUAGE</i>, <i >LANG</i>, and <i>LC_ALL</i>.
(Similarly named environment variables control non-linguistic aspects of the
locale. For instance, the variable <i>LC_NUMERIC</i> determines the way in which
non-monetary numbers are formatted. You can set the locale to be used by <i>Redet</i>
either by setting the appropriate environment variables before starting <I>Redet</i>
or by selecting a new locale while <i>Redet</i> is running via the <i>Configure</i>
menu.
</P>
<P>
Providing a translation for a particular language means providing a message catalog
containing English strings paired with their translations in the appropriate format,
giving this file an appropriate name, and installing it where <i>Redet</i> will
find it. The file name should consist of the locale name with the suffix <i>.msgs</i>.
The locale name may contain only the language code, the language code and the region
code, or the language code, region code, and encoding. Thus, <i>es</i>,
<i>es_es</i>, and <i>es_es.UTF-8</i> are all valid locale names for Spanish.
The encoding is not specified as part of the file name, so only
<i>es.msgs</i> and <i>es_es.msgs</i> are valid names for Spanish message files.
</p>
<p>
<i>Redet</i> expects to find message catalogs in a subdirectory called <i>msgs</i>
of the directory in which the program itself is located. For example, if <i>Redet</i>
is installed in <i>/usr/local/bin/</i>, message catalogs should be in 
<i>/usr/local/bin/msgs</i>. However, if the <i>DebugP</i> flag is set
(using the command line option <i>-d</i>), message catalogs will be sought
in a subdirectory named <i>msgs</i> in the current directory. On a Unix system
the Makefile supplied with <i>Redet</i> will install the message catalogs provided
with <i>Redet</i> in the correct location.
</p>
<P>
A message catalog is actually a Tcl program consisting of calls to the function
<i>::msgcat::mcset</i>. The first argument to each call is the locale.
The second and third arguments are the source string and the corresponding
translation string. For example, the entry for the <i>Quit</i> label on the
<i>File</i> menu in the Spanish message catalog is:

<pre>
::msgcat::mcset es "Quit" "Salir"
</pre>
<P>
All strings should be written in UTF-8 Unicode. (It may, of course, be more convenient
to write the translations initially in another encoding and then translate it.)
The file <i>template.msgs</i> provided with the distribution contains all of the
necessary entries with the translations left blank. If you wish to add a localization
for your own language, make a copy of the template and fill in the empty strings.
For details see the documentation for the
<a href="http://www.tcl.tk/man/tcl8.4/TclCmd/msgcat.htm">Tcl msgcat module</a>.
</p>

<br>
<center><a href="license.html">Next</a></center>
<br>
<center><a href="Manual.html">Back to Table of Contents</a></center>
</body>
</html>