diff options
| author | fukachan <fukachan> | 2003-07-29 12:13:54 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-07-29 12:13:54 +0000 |
| commit | 1e55dfb8a11faedb028f39d7529374a3714f4e9a (patch) | |
| tree | 0b5c71787ba8bd1b6c3a71236119b41a618f98cf /fml/doc/en/tutorial/message | |
| parent | 9b8aa01b71fa6ae09e7e12a9fe2f5150e1adec3f (diff) | |
| download | fml8-1e55dfb8a11faedb028f39d7529374a3714f4e9a.tar.gz fml8-1e55dfb8a11faedb028f39d7529374a3714f4e9a.tar.bz2 fml8-1e55dfb8a11faedb028f39d7529374a3714f4e9a.zip | |
translated
Diffstat (limited to 'fml/doc/en/tutorial/message')
| -rw-r--r-- | fml/doc/en/tutorial/message/discussion.sgml | 159 | ||||
| -rw-r--r-- | fml/doc/en/tutorial/message/language.sgml | 48 |
2 files changed, 207 insertions, 0 deletions
diff --git a/fml/doc/en/tutorial/message/discussion.sgml b/fml/doc/en/tutorial/message/discussion.sgml new file mode 100644 index 00000000..3d4e48b2 --- /dev/null +++ b/fml/doc/en/tutorial/message/discussion.sgml @@ -0,0 +1,159 @@ +<!-- + $FML$ + $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 mesages. +How we should implement it ? +</para> + + +<!-- ===================================================== --> +<sect2> + <title> + &fml4; case + </title> + +<para> +In the case of &fml4;, call language dependent message converter like +this: +<screen> + Mesg(*e, KEYWORD, DEFAULT MESSAGE, ARGUMENT); +</screen> +</para> + +<para> +Mesg() searches the specified keyword in files +/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> +Hmm, which is better ? "One file has one keyword" and "one file for +one category, so one file contains plural entries". +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> +Thie function uses se 30 and entry 4 in th 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 ? +By 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 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 the 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> diff --git a/fml/doc/en/tutorial/message/language.sgml b/fml/doc/en/tutorial/message/language.sgml new file mode 100644 index 00000000..7e34be55 --- /dev/null +++ b/fml/doc/en/tutorial/message/language.sgml @@ -0,0 +1,48 @@ +<!-- + $FML$ + $jaFML: language.sgml,v 1.5 2003/04/15 14:51:42 fukachan Exp $ +--> + + +<sect1 id="message.nl"> + <title> + message internationalization: + the usage of reply_message_nl() + </title> + +<para> +For the message internationalization, +use reply_message_nl() + <footnote> + <para> + See FML::Process::Kernel module. + </para> + </footnote> +like this: +<screen> +$curproc->reply_message_nl('error.already_member', + 'already member', + { _arg_address => $address }); +</screen> +This function uses the message template at +/usr/local/share/fml/$fml_version/message/$language/error/already_member +. +</para> + +<para> +$_arg_VARNAME in the message such as +<screen> +$_args_address +</screen> +is expanded by using the value specified as the argument of +reply_mesage_nl(). +</para> + +<para> +Usual $VARIABLE is also expaned by replacing it with value of config.cf. +For example, $ml_name is expanded to ML name defined in config.cf +$_arg_ prefix is used for lexical scope variables to avoid +conflicts against variables in config.cf. +</para> + +</sect1> |
