[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .

Discussion: How To Send Back Language Dependent Error Mesages

fml needs to send back language dependent error messages. How we should implement it ?

(Below, just a discussion not implemation in fact.)

fml4 Case

In the case of fml4, fml4 calls language dependent message converter like this:


Mesg() searches the specified keyword in files under /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 fml8 Should Do ?

"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.

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. [1] For example, the usage is as follows:
printf(catgets(catd, 30,  4,  "%s: Internal match error.\n"), progname);
This function uses set 30 and entry 4 in the local definition file such as /usr/pkg/share/nls/ja_JP.EUC/PROGNAME.cat.

fml8: Design (Temporary ?)

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


1: %s not found
2: %s (error number = %d)

Instead, one file for one message may be useful. Especially it is easy we can customize only one message.

To try the latter case, we can prepare a lot of classes such as

For example, there are 200 or 300 files such as

This methods has the following problems:

  • separete files but in contrast more customizable.

  • locale friendly? may be no.

Consider an example. In the latter case, the message module will be like this?

sub not_found
   my ..  = @_;

   return <<"_EOF_"
$sender is ... something ...
Hmm, is it good ???



"s" is the default message.

[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .
Copyright (C) 1993-2022 Ken'ichi Fukamachi mail:< fukachan at fml.org >