Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.lang.misc Subject: Re: Issuing a message in the language of the user Date: Mon, 28 Apr 2014 03:45:33 -0400 Organization: Aioe.org NNTP Server Lines: 38 Message-ID: References: NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.misc:2035 On Sun, 27 Apr 2014 15:29:42 -0400, James Harris wrote: > [snip] > > The idea is that a program wants to issue a message to a user > (using a function which for the sake of giving it a name in this > post I will call IssueMsg) but doesn't want to have to know what > language the user speaks or what other locale settings are in > effect. The message should appear in English to an English speaker, > French to a French speaker etc. The IssueMsg routine is to look up > the message in a library of the appropriate language for the user > and then fill-in the parameter values supplied by the program. > > This is akin to gettext() but, of course, much better. ;-) > > Regarding the need for the order of values in a message to vary, > a two-parameter message in English might have parm 1 first then > parm 2 but the same message in French might be more naturally > expressed by having parm 2 come before parm 1. Rather than > forcing the same order on all languages the message needs to > pick the parameter for each location. This means that the message > text cannot just use them in order but needs to have numbered or > named parameters. Numbered is more efficient and was chosen for > the suggestion below. > > [snip] Is there a reason each message needs to have values? I.e., my inclination would be to have static strings for each language selectable by index and pointer. The pointer would be set for the chosen language to select the appropriate array of strings. I would avoid emitting values, or I'd emit them on a line without other text and without language specific formatting. Rod Pemberton