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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
<!--
$FML: discussion.sgml,v 1.2 2003/08/03 05:28:49 fukachan Exp $
$jaFML: discussion.sgml,v 1.4 2003/04/15 14:51:42 fukachan Exp $
-->
<sect1>
<title>
Discussion: How To Send Back Language Dependent Error Mesages
</title>
<para>
fml needs to send back language dependent error messages.
How we should implement it ?
</para>
<para>
(Below, just a discussion not implemation in fact.)
</para>
<!-- ===================================================== -->
<sect2>
<title>
&fml4; Case
</title>
<para>
In the case of &fml4;, &fml4; calls language dependent message
converter like this:
<screen>
Mesg(*e, KEYWORD, DEFAULT MESSAGE, ARGUMENT);
</screen>
</para>
<para>
Mesg() searches the specified keyword in files under
/usr/local/fml/messages/Japanese/ directory. Each file contains
messages with keywords to be substituted properly.
</para>
<para>
For example, the keyword not_found matches not_found entry in
/usr/local/fml/messages/Japanese/kern file.
</para>
</sect2>
<!-- ===================================================== -->
<sect2>
<title>
What &fmldevel; Should Do ?
</title>
<para>
"One file has one keyword" and "one file for one category, so one file
contains plural entries". Hmm, which is better? I don't determine it.
</para>
<sect3>
<title>
X/Open Portability Guide Issue 4 Version 2 (``XPG4.2'')
</title>
<para>
If you use XPG (X/Open standard),
<screen>
catgets(catd, set_id, msg_id, char *s);
</screen>
function converts the message specified by LOCALE_XXX.
<footnote>
<para>
"s" is the default message.
</para>
</footnote>
For example, the usage is as follows:
<screen>
printf(catgets(catd, 30, 4, "%s: Internal match error.\n"), progname);
</screen>
This function uses set 30 and entry 4 in the local definition file such
as /usr/pkg/share/nls/ja_JP.EUC/PROGNAME.cat.
</para>
</sect3>
<sect3>
<title>
&fmldevel;: Design (Temporary ?)
</title>
<para>
One problem is whether we should use locale or not ?
In considering CUI e.g. makefml, it is better to use locale.
For example, prepare
<screen>
/usr/local/lib/fml/$fml_version/messages/ja_JP.EUC/kern
1: %s not found
2: %s (error number = %d)
</screen>
.
</para>
<para>
Instead, one file for one message may be useful.
Especially it is easy we can customize only one message.
</para>
<para>
To try the latter case, we can prepare a lot of classes such as
<screen>
FML::Message::ja::KEYWORD
</screen>
For example, there are 200 or 300 files such as
<screen>
FML::Message::ja::not_found
</screen>
.
</para>
<para>
This methods has the following problems:
<itemizedlist>
<listitem>
<para>
separete files but in contrast more customizable.
</para>
</listitem>
<listitem>
<para>
locale friendly? may be no.
</para>
</listitem>
</itemizedlist>
</para>
<para>
Consider an example. In the latter case,
the message module will be like this?
<screen>
sub not_found
{
my .. = @_;
return <<"_EOF_"
$sender is ... something ...
_EOF_
}
</screen>
Hmm, is it good ???
</para>
</sect3>
</sect2>
</sect1>
|