On 11/15/09 9:22 PM, Craig Andrews wrote:
How do you handle lists of variables lengths with gettext and sprintf so
they can be translated?
Here's the commit that I have no idea how to properly do for i18n:
http://gitorious.org/statusnet/mainline/commit/f04dbc8fa21d86bae5c34ece2637c3c345e29927
I'm pretty sure this is the way to go:
$out = ngettext('You are subscribed to this person:',
'You are subscribed to these people:',
count($nicknames));
$out .= ' ';
$out .= implode(', ',$nicknames);
as per http://status.net/wiki/I18n_guidelines#Plurals
The important thing about using ngettext() here rather than checking for
1-ness manually is that some languages have different plural rules than
English; using ngettext() means the extra plural forms get handled on
the backend by the locale info and translators.
Be warned however that we haven't actually been doing this before in
existing code, so we'll want to watch and make sure that plurals get
picked up correctly with the translatewiki.net interface. :)
-- brion vibber (brion @ status.net)
_______________________________________________
StatusNet-dev mailing list
[email protected]
http://lists.status.net/mailman/listinfo/statusnet-dev