|
|
The environment variable $LANG sets a user's language preference. The presence and value of this variable determine how icon labels and messages are displayed during a user's session.
By default, your icon's label is taken from the name of your icon's object directory. If the directory is named Calendar.obj, by the icon will be labeled ``Calendar''. If the file title exists in the object directory, the contents of that file are used as the title.
Messages, such as menu titles and error messages, are often explicitly defined in the trigger files as absolute values, such as:
title='analog clock'In many cases, this default behavior is undesirable, such as when you want to be able to easily change messages and labels to another language. To do so, you must:
To modify the trigger file:
For example, the menu example could be modified to localize messages:
1 rule='
2 menu: PopupClockMenu
3 {
4 menu_item
5 {
6 title='$m1'
7 action
8 {
9 begin
10 xclock -digital
11 finish
12 }
13 }
14 menu_item
15 {
16 title='$m2'
17 action
18 {
19 begin
20 xclock
21 finish
22 }
23 }
24 dividing_line;
25 menu_item
26 {
27 title='$m3'
28 action
29 {
30 help 'static_arg'
31 }
32 }
33 remove_dynamic_rule PopupClockMenu
34 dynamic_rule PopupClockMenu $rule
35 popup PopupClockMenu $static_arg
To modify the text file:
For example, if you are localizing a Spanish language application for use in Spain, ensure that the spanish_SPAIN directory exists in the object directory.
Or, if the file already exists, edit it. Here is a sample text file:
t1='Calendario' m1='Enero' m2='Febrero' . . . m12='Deciembre'In this sample file, the title (t1) is set to the Spanish translation of Calendar, and each message (m1-m12) corresponds to a month of the year.