From 1e55dfb8a11faedb028f39d7529374a3714f4e9a Mon Sep 17 00:00:00 2001 From: fukachan Date: Tue, 29 Jul 2003 12:13:54 +0000 Subject: translated --- fml/doc/en/tutorial/message/discussion.sgml | 159 ++++++++++++++++++++++++++++ fml/doc/en/tutorial/message/language.sgml | 48 +++++++++ 2 files changed, 207 insertions(+) create mode 100644 fml/doc/en/tutorial/message/discussion.sgml create mode 100644 fml/doc/en/tutorial/message/language.sgml (limited to 'fml/doc/en/tutorial/message') 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 @@ + + + + + Discussion: how to send back language dependent error mesages + + + +fml needs to send back language dependent error mesages. +How we should implement it ? + + + + + + + &fml4; case + + + +In the case of &fml4;, call language dependent message converter like +this: + + Mesg(*e, KEYWORD, DEFAULT MESSAGE, ARGUMENT); + + + + +Mesg() searches the specified keyword in files +/usr/local/fml/messages/Japanese/ directory. Each file contains +messages with keywords to be substituted properly. + + + +For example, the keyword not_found matches not_found entry in +/usr/local/fml/messages/Japanese/kern file. + + + + + + + + + + What &fmldevel; should do ? + + + +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. + + + + + X/Open Portability Guide Issue 4 Version 2 (``XPG4.2'') + + + +If you use XPG (X/Open standard), + +catgets(catd, set_id, msg_id, char *s); + +function converts the message specified by LOCALE_XXX. + + + "s" is the default message. + + +For example, the usage is as follows: + +printf(catgets(catd, 30, 4, "%s: Internal match error.\n"), progname); + +Thie function uses se 30 and entry 4 in th local definition file such +as /usr/pkg/share/nls/ja_JP.EUC/PROGNAME.cat. + + + + + + + &fmldevel;: design (temporary ?) + + + +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 + +/usr/local/lib/fml/$fml_version/messages/ja_JP.EUC/kern + +1: %s not found +2: %s (error number = %d) + +. + + + +Instead one file for one message may be useful. +Especially we can customize only one message. + + + +To try the latter case, we can prepare a lot of classes such as + +FML::Message::ja::KEYWORD + +For example, there are 200 or 300 files such as + +FML::Message::ja::not_found + +. + + + +This methods has the following problems: + + + + separete files but in contrast more customizable. + + + + + + locale friendly? may be no. + + + + + + + + +Consider the example. In the latter case, +the message module will be like this? + +sub not_found +{ + my .. = @_; + + return <<"_EOF_" +$sender is ... something ... +_EOF_ +} + +hmm, is it good ??? + + + + + + + + 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 @@ + + + + + + message internationalization: + the usage of reply_message_nl() + + + +For the message internationalization, +use reply_message_nl() + + + See FML::Process::Kernel module. + + +like this: + +$curproc->reply_message_nl('error.already_member', + 'already member', + { _arg_address => $address }); + +This function uses the message template at +/usr/local/share/fml/$fml_version/message/$language/error/already_member +. + + + +$_arg_VARNAME in the message such as + +$_args_address + +is expanded by using the value specified as the argument of +reply_mesage_nl(). + + + +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. + + + -- cgit v1.2.1