Zend_Locale 2.0

Hy fellows,

first I want to wish you all a good start into this new decade.
Then I wanted to inform you about some news for Zend Framework.

Within the last days I began a complete rework of the I18n core for ZF.
The first class which will be reworked is Zend_Locale as it’s the base class for I18n within ZF.

The following changes will be done for Zend Locale 2.0:

CLDR update to 1.9
This integrates the most actual locale database within ZF

Usage of a fallback locale
This locale can be set and used as fallback when the wished locale is not supported

Usage of a fixed locale
This locale can be set and will be used regardless of any other locale which the accessing user wants
This removes the workaround from Zend_Application

Add locale providers as base
This allows to use other locale providers than CLDR
This will remove Zend_Locale_Format and integrate it into the used provider

Rework CLDR to be a provider

Add INTL as new provider
This allows to use INTL when available alone or in combination with CLDR because the INTL extension does not provide all informations like CLDR

Add a way to upgrade a locale
This would allow to provide informations for language locales when no region was given (f.e. when a user gives ‘en’ and wants to have informations from a region (f.e. currency))

Add script support
This allows to use locales which provide several scripts within the same language like Azerbaijani, English or Hausa.

That’s the actual plan for Zend_Locale 2.0 and will be the base for all other reworks.
Please note that all spoken will be done within Zend Framework 2.0 and not be migrated to 1.x.

Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top
  1. Matthew Weier O'Phinney

    Monday, January 3, 2011 - 00:26:39

    Please include profiling and benchmarking as part of the refactoring process. One of the chief complaints I hear regarding l10n in ZF has to do with performance; any way we can improve this situation will be appreciated by many.

    I’m very happy to see the adapter-based approach - ext/intl was a key feature for 5.3, and many will be quite willing to trade the features of CLDR for the speed of ext/intl, I believe.

  2. Denis

    Wednesday, January 5, 2011 - 02:21:31

    Great news!
    Talking about performance… Mabe it’s a good idea to get rid of xml and store CLDR data in php arrays?

  3. thomasw

    Friday, January 7, 2011 - 02:16:35

    Manually converting 20MB to PHP arrays every 4 months, with each CLDR release, is nothing which I will do. There are other ways which would also speed things up.

    Writing a conversion tool does also not work, because LDML (CLDR’s core) changes with each release.

    Feel free to do the conversion every 4 months. Actually it takes me 10 hours to prepare CLDR for it’s usage within ZF. I expect such a conversion will take up to 90 hours.

  4. Syed Sumair Zafar

    Wednesday, July 27, 2011 - 15:24:32

    Hello Thomas

    i just start working on Zend Framework

    I got a project which involved multilingual support not just 2 may be more than 2

    it also include arabic
    and client is not sure about translating english in to arabic because they think it is not correctly translated

    so i need to know what folder structure i should follow to accommodate multiple language website

    like where should i place the controllers views language folder like en or ar

    i really appreciate if you help me on this


  5. Christian Weiss

    Wednesday, August 24, 2011 - 11:28:57

    Performance. Sure. I think using Zend_Cache and a two level cache strategy should be enough to tweek. No need to bring the source to another form of representation. LDML is not changing with each CLDR release. So writing a Adapter for each release should be the way of doing - and changes between LDML versions are not so fundamental (normally).

  6. melldren

    Tuesday, October 25, 2011 - 01:12:25

    good post

  7. Drupal Software Development

    Monday, January 9, 2012 - 08:40:32

    I think these changes are really needed in Zend framework 2.0 and it will helpful for its user. Nice post. thank you for your valuable information.

  8. Ego-T Type B

    Friday, March 9, 2012 - 00:23:46

    Great post! We are linking to this particularly great article on our site.
    Keep up the great writing.

  9. Zend PHP Development

    Monday, April 2, 2012 - 17:02:46

    Hi thomasw,
    Nice Post Mate and as the points you shared are way much fresh and informative to me. And as for the use of CLDR or XML both took place in Zend.


  10. comment

    Sunday, September 16, 2012 - 05:01:06

    Good answer back in return of this difficulty with solid arguments and describing everything on the topic of that.