New i18n interface for KDE 4, second try

Chusslove Illich caslav.ilic at gmx.net
Sat Oct 29 14:37:10 BST 2005


>> [: Chusslove Illich :]
>> Throughout base KDE packages, I've encountered 130 i18n calls with
>> .arg() methods with more than one argument [...]
>
> [: Nicolas Goutte :]
> As Qt had not that QString::arg with multiple argument, there is code
> *not* using it. (Often you can recognise such code at string like "%3
> %1 %2" where the numbers are not in sequence but the user-given string
> is the last argument.)

Well, ok, but that is not strictly connected with the interface question we 
are trying to solve here (in any case, arg() methods would be available).

However, having those special arg() methods, some heuristic checks at 
runtime could be provided in debug mode (like if several QStrings are 
being given via single argument arg() methods, etc.)

>> [: Chusslove Illich :]
>> For example, when giving context, if they forget to specify correct
>> call name:
>>
>> i18n("This is entry in menu Session", "New");
>
> [: Nicolas Goutte :]
> I really think that long names are the way to go:
> 
> i18n
> i18n_context
> i18n_plural

Hm, I've got nothing against long names, but I think typos would be much 
smaller problem than plain forgetting to use appropriate call (or not?), 
and long names wouldn't fix that (or would they?)

> By the way, it would be nice, if you could find a way to have a
> I18N_NOOP_PLURAL.

I thought this one is not already there because there is no need for it, is 
there a situation where it could be used?

Anyway, what would be the problem having just:

#define I18N_NOOP_PLURAL(singular, plural)  singular, plural

and then eg:

struct myEarlyPlurals {
  const char *singular, *plural;
}

const myEarlyPlurals mep[] = {
  {I18N_NOOP_PLURAL("Mary had a little lamb","Mary had %n little lambs")},
  ...
}

later on in the code:

i18np(mep[i].singular, mep[i].plural, nlambs);

(Extraction of in this way defined I18N_NOOP_PLURAL by xgettext is also no 
longer a problem.)

-- 
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051029/36ca51cd/attachment.sig>


More information about the kde-core-devel mailing list