Re: intl naming
| From: | Stanislav Malyshev | Date: | Tue, 08 Apr 2008 17:04:39 +0000 |
| Subject: | Re: intl naming | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-36877@lists.php.net to get a copy of this message | ||
Hi!
The ICU API solves this issue nicely using the current locale. It would be easier to work with the intl API if the same principle was used. Add a Locale::setDefault() and Locale::getDefault().You can use default locale, of course, and Locale class already has these functions. http://docs.php.net/manual/en/class.locale.php
The argument order for the constructors/factories should be change to allow that. The locale argument has to be optional (and moved as 2nd+ argument).I'm afraid that wouldn't work since functions have variable number of arguments and we want consistent API across all modules.
Arguments order may be confusing and hard to remember. However theirLike "locale goes first"?
4. Support of Date Object, they are the standard DateTime type in PHP.Planned to be done later - if anybody wants to contribute now, please do. It is indeed very important, we just don't have somebody to do it right now.
5. Error management is rather unintuitive. I can't imagine to have to check the error code after each call. Exceptions can greatly improveLike 99% people do with 99% functions in PHP? You must be really suffering not writing code in Java :)
6. What's about a __toString implementation when possible. It may beIf you can propose good toString - and especially if you have volunteer to implement it :) - why not? We didn't have good use for toString, but if you find one - welcome.
Prepare: $invoice_line_amount = new NumberFormatter( 'fr_CH', NumberFormatter::DECIMAL ); $invoice_line_amount->setValue($res); View: echo $invoice_line_amount;We didn't purport to implement yet another MVC templating system here. We wrote ICU wrapper.
Locale specific: - Being able to parse, fetch and manage Locale IDs in a consistent and portable way would rock, the ISO3 related API is a must have prior 1.0. It can be used from day #1 to normalize locale IDs format.Could you elaborate? I think our functions understand locales in standard formats, but maybe you mean something else. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com