[zf2] localized

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[zf2] localized

Bas Kamer
Hi,

I'm looking for the zf2 way to translate country names to use in a selectbox (amongst others).

I know I can add every full country name to my translation file and call $this->translate('The Netherlands') in my views, but my model would store the country codes not full names.

I don't believe ZF2 has something for this at the moment - is that correct? Any suggestions?


thanks
Bas Kamer



--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

RE: [zf2] localized

demiankatz
I don't claim that this is necessarily the best solution, but I've dealt with a similar problem (translating English language names into native versions for all the languages -- i.e. German => Deutsch) by creating a separate language file just for language names and using a custom view helper for displaying them:

http://vufind.git.sourceforge.net/git/gitweb.cgi?p=vufind/vufind;a=blob;f=module/VuFind/src/VuFind/Theme/Root/Helper/DisplayLanguageOption.php;h=639da8a7563a42564bca3d47d7b856cfdef366f4;hb=HEAD

- Demian
________________________________________
From: Bas Kamer [[hidden email]]
Sent: Wednesday, September 26, 2012 9:03 AM
To: [hidden email]
Subject: [fw-general] [zf2] localized

Hi,

I'm looking for the zf2 way to translate country names to use in a selectbox (amongst others).

I know I can add every full country name to my translation file and call $this->translate('The Netherlands') in my views, but my model would store the country codes not full names.

I don't believe ZF2 has something for this at the moment - is that correct? Any suggestions?


thanks
Bas Kamer



--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]



--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: [zf2] localized

Ralf Eggert
Hi,

within ZF1 we had a lot of this stuff within XML files:

http://framework.zend.com/svn/framework/standard/branches/release-1.12/library/Zend/Locale/Data/

Maybe that could be reactivated and reincluded to the /resources folder?

Regards,

Ralf

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: [zf2] localized

Stefano Torresi
This post has NOT been accepted by the mailing list yet.
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: [zf2] localized

Jurian Sluiman
In reply to this post by Ralf Eggert
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: [zf2] localized

weierophinney
Administrator
-- Jurian Sluiman <[hidden email]> wrote
(on Wednesday, 26 September 2012, 09:14 PM +0200):

> 2012/9/26 Ralf Eggert <[hidden email]>
> > within ZF1 we had a lot of this stuff within XML files:
> >
> >
> > http://framework.zend.com/svn/framework/standard/branches/release-1.12/library/Zend/Locale/Data/
> >
> > Maybe that could be reactivated and reincluded to the /resources folder?
>
>
> That data is called CLDR (Common Locale Data Repository) and is maintained
> at http://cldr.unicode.org/. They have a downloads section where you can
> get all the xml files. Inside the CLDR data there is a section "display
> names" where a list of all territories:
> http://unicode.org/reports/tr35/#Display_Name_Elements
>
> I am not sure what the reason was to remove the CLDR data from zff2, but if
> I remember correctly it was a large codebase and hard to keep up to date
> with the latest release from http://cldr.unicode.org/. But perhaps this
> will be resubmitted to the zf2 repository, but I am not sure...

There were two primary factors:

* ext/intl fulfills a majority of L10n needs, and, due to being in C, is
  much, much faster than anything we could write in userland.
* As you note, keeping the CLDR up-to-date was a major hassle, and
  hugely inflated the repository size -- and the majority of user needs
  fell within what ext/intl offers, making the offering questionable.

Additionally, due to the size, there were performance issues that led to
a need for robust caching. While we could transcode the XML to native
PHP data structures, those structures would be large enough to impact
resources. Caching only what is used works, but it requires some pretty
difficult strategies to accomplish well.

If enough people are interested in having CLDR-backed L10n, we can
likely add it in a future release, or, better yet, via a module.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]