intl extension

View: New views
11 Messages — Rating Filter:   Alert me  

intl extension

by Stanislav Malyshev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have released a beta version of the intl extension (ICU
implementation). It is documented here:
http://docs.php.net/manual/en/book.intl.php
and can be installed either by downloading package from PECL:
http://pecl.php.net/package/intl
or just by running "pecl install intl".
Please try it!
--
Stanislav Malyshev, Zend Software Architect
stas@...   http://www.zend.com/
(408)253-8829   MSN: stas@...

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: intl extension

by David M.-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Stanislav Malyshev wrote:
> I have released a beta version of the intl extension (ICU
> implementation). It is documented here:
> http://docs.php.net/manual/en/book.intl.php
> and can be installed either by downloading package from PECL:
> http://pecl.php.net/package/intl
> or just by running "pecl install intl".
> Please try it!

This is great to have! :) As a developer writing considerable amounts of
  code that does this kind of stuff, it is nice to know that we can use
this as an alternative to our own PHP based implementation.

P.S.
Any hope on getting case folding in there? ICU supports it :) It is
useful from a security standpoint (making sure that usernames cannot be
confused with others, etc.) If you do not have the time, I suppose I
could make a patch for it...

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Re: intl extension

by Stanislav Malyshev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Any hope on getting case folding in there? ICU supports it :) It is

We plan to have a bunch of stuff dealing with unicode characters later,
but not in the first release. First release is to deal mostly with
locale-dependent stuff (though not exclusively). So there's definitely
hope, but probably also some waiting involved :)
--
Stanislav Malyshev, Zend Software Architect
stas@...   http://www.zend.com/
(408)253-8829   MSN: stas@...

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: Re: intl extension

by Andi Gutmans :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David,

Besides case folding is there anything else you'd like to see? Not long
wishlist but short version of stuff you really feel we should have in
there and would benefit from an ICU implementation.
Thanks,

Andi

> -----Original Message-----
> From: Stanislav Malyshev [mailto:stas@...]
> Sent: Tuesday, January 22, 2008 11:27 AM
> To: David M.
> Cc: php-i18n@...
> Subject: Re: [PHP-I18N] Re: intl extension
>
> > Any hope on getting case folding in there? ICU supports it :) It is
>
> We plan to have a bunch of stuff dealing with unicode characters
later,

> but not in the first release. First release is to deal mostly with
> locale-dependent stuff (though not exclusively). So there's definitely
> hope, but probably also some waiting involved :)
> --
> Stanislav Malyshev, Zend Software Architect
> stas@...   http://www.zend.com/
> (408)253-8829   MSN: stas@...
>
> --
> PHP Unicode & I18N Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: intl extension

by felho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!


> I have released a beta version of the intl extension (ICU
> implementation). It is documented here:
> http://docs.php.net/manual/en/book.intl.php
I just started to get familiar with intl while I read your article in
phparchitect and I like a lot of features of this extension.

I would have some question:
- If I should have to came out to a site with multi language support in
1-2 months is it worth to rely on this extension? (Will be part of 5.3?)
- Is there now standard like way to handle plurals?

TIA!


Best Regards,
Felhő


--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: intl extension

by Stanislav Malyshev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

> I would have some question:
> - If I should have to came out to a site with multi language support in
> 1-2 months is it worth to rely on this extension? (Will be part of 5.3?)

Yes, I think so.

> - Is there now standard like way to handle plurals?

In MessageFormatter, you have a way to use conditionals (see ICU docs
here:
http://icu-project.org/apiref/icu4c/classMessageFormat.html#_details)
which may allow you to do correct plurals. Of course, you would still
have to supply the correct words (room/rooms, etc.) in the format.
--
Stanislav Malyshev, Zend Software Architect
stas@...   http://www.zend.com/
(408)253-8829   MSN: stas@...

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: intl extension

by felho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!


> In MessageFormatter, you have a way to use conditionals (see ICU docs
> here:
> http://icu-project.org/apiref/icu4c/classMessageFormat.html#_details)
> which may allow you to do correct plurals. Of course, you would still
> have to supply the correct words (room/rooms, etc.) in the format.
Thank you answer.

I would have one more question, which is a little more theoretically.
Currently I see two direction providing proper plural handling and
actually I am not sure which one should be better to use.

So I am curious what others think about this, and can offer some more
thing which I should consider, and what helps me to make a better decision.


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


Actually I like the second way, why it is more flexible, but I am not
sure if this flexibility worth. And I like the possibility that you can
handle the "0 case" in one place.

But I have some problems with this approach too (I feel that it is a
little programmer centric).
  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).
  o My other problem is that for this structure it would be not easy to
create a logical/usable user interface for translating.
  o Or what is if I want to export my master language to XLIFF format,
will a translator able handle this approach and create a proper translation?


I will really appreciate your comments about this topic, I have no work
experience yet with it.

TIA!


Best Regards,
Felhő

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: intl extension

by Ed Batutis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> entry (so the data model is a little strange, it holds some redundancy).

How many of these do you have? A little redundancy is OK, I think.

>   o My other problem is that for this structure it would be not easy to
> create a logical/usable user interface for translating.

Don't do that. Translators have specialized tools they own and want to use.

>   o Or what is if I want to export my master language to XLIFF format,

Good idea. Or a plain text file or many other formats will be OK with most
translators.

=Ed



--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: intl extension

by Stanislav Malyshev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...   http://www.zend.com/
(408)253-8829   MSN: stas@...

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: intl extension

by Tomas Kuliavas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> - Is there now standard like way to handle plurals?

Those who don't use gettext are doomed to reimplement it.

--
Tomas

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: intl extension

by Texin, Tex :: Rate this Message:

Reply to Author | View Threaded | Show Only 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@...]
> Sent: Monday, May 12, 2008 5:23 PM
> To: Gergely Hodicska
> Cc: php-i18n@...
> 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@...   http://www.zend.com/
> (408)253-8829   MSN: stas@...
>
> --
> PHP Unicode & I18N Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>