RE: [PHP-I18N] intl extension
| From: | Texin, Tex | Date: | Tue, 13 May 2008 09:45:07 +0000 |
| Subject: | RE: [PHP-I18N] intl extension | ||
| References: | 1 2 3 4 5 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-1208@lists.php.net to get a copy of this message | ||
Of the two, I prefer the all in one way, because the localizer needs to see the entire structure and
modify it appropriately for the language, grammar and rules.
If the programmer creates a format_plural function, then the function is not likely to cover all the
needs of all languages, nor the reordering of the text that a localizer might choose for correct
grammar.
That said, I try to avoid the problem altogether by putting the text in a form of label:value, since
this can almost always be accommodated by an unchanging label in all languages.
Number of comments: (0, 1, 2 whatever...)
It is not as engaging as writing "You have n comments" but it can be done so it is not
offputting and you can use the rest of the text to better engage the audience.
tex
> -----Original Message-----
> From: Stanislav Malyshev [mailto:stas@zend.com]
> Sent: Monday, May 12, 2008 5:23 PM
> To: Gergely Hodicska
> Cc: php-i18n@lists.php.net
> Subject: Re: [PHP-I18N] intl extension
>
> Hi!
>
> > 1.) Gettext way: I call a format_plural($count, '1
> comment', '$count
> > comments'), and this function can handle special cases (for example
> > Russian), and the given language file can store multiple
> plural format.
> >
> > 2.) "All-in-one" way: only one string belongs to one string id, and
> > this string holds the different versions of the given
> word/sentence,
> > and the rules too on which we can decide which version
> should be used. For example:
> > "[0]No comment.|[1]1 comment.|[2,]$count comments."
>
> Here you'd probably want to use {1,number,integer} instead of
> $count and provide $count as parameter, otherwise you'd lose
> local number formatting.
>
> > o Maybe the most obvious one is that the rules are
> repeated in every
> > entry and the fact that the rules belongs to the language not to an
> > entry (so the data model is a little strange, it holds some
> redundancy).
>
> Yes, that's correct - but you could always isolate it into
> specific printing function - i.e. create function
> print_comments_count($count) and use the pattern there, and
> then insert it into bigger pattern.
> Depends on how often that pattern repeats, I guess.
>
> > o My other problem is that for this structure it would be
> not easy to
> > create a logical/usable user interface for translating.
>
> Well, here I don't have any meaningful experience, but I
> think since ICU uses it there must be some tools that support
> it. Right now the extension does not deal with the question
> where you get the patterns from or how you switch between
> pattern sets (we planned to add support for resource bundles,
> etc. later). Maybe other people on the list could help more
> with that :)
> --
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com http://www.zend.com/
> (408)253-8829 MSN: stas@zend.com
>
> --
> PHP Unicode & I18N Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>