Restrict Zend_Locale to just the available translations?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Restrict Zend_Locale to just the available translations?

FishAreBest
This post has NOT been accepted by the mailing list yet.
Suppose a user visits my site with HTTP_LANGUAGE_ACCEPT: de;q=1.0,fr;q=0.5
i.e. They want german as a first choice and french as a second choice.

Suppose my site only has translations available for english, french and italian.  Clearly, I should be serving content in french.  If I use something like

$locale=Zend_Locale::findLocale('auto');

it just returns the first choice (german), so I cannot use it to select a language using something like

$translate=new Zend_Translate('gettext', APP_ROOT.'language/', $locale, array('scan'=>Zend_Translate::LOCALE_FILENAME));

Zend_Translate can clearly scan for available languages, but there is no way of telling Zend_Locale to restrict itself to this list.

I looked through Zend_Locale.  The list of locales is hard-coded  No member functions exist to change/restrict it.

How do I do this?

Thanks.

Greg

Using ZF1.10