I understand it is a demo code. My question was - getLanguageDisplay expects
language as its argument, anyway. In that case, why do we need to create a
new locale object or do a setLocale on the old one as you suggest. I guess
these are required to get the language name in the local language itself. A
better way might be to output the combination (with an optional argument)
and eliminate the necessity to do a setLocale or create new locale objects:

العربية (Arabic)
Deutsch (German)
English
Español (Spanish)
Français (French)
日本語 (Japanese)
Nederlands (Dutch)
Polski (Polish)
Português brasileiro (Brazilian Portugese)
Русский (Russian)
简体中文 (Simplified Chinese)
<http://framework.zend.com/manual/zh/index.html> I understand a native
speaker knows their language in their local language and does not need its
English description but it may be easy on the eyes of other language
speakers as there is always an English description to follow it.

Thanks,




On 11/22/06, Ahmed Shreef <[EMAIL PROTECTED]> wrote:

Hi,

  On 11/21/06, Shekar C Reddy <[EMAIL PROTECTED] > wrote:
> >
> > Thomas,
> >
> > Please correct me if I'm wrong as I haven't gone through the
> > Zend_Locale source as yet:
> >
> > foreach($list as $language => $content) {
> >    $lang = new Zend_Locale($language);
> >    print "\n<br>[".$language."]
> > ".$lang->getLanguageDisplay($language);
> > }
> >
> > In the above chunk, the $language argument is passed to both - the
> > construct as well as the getLanguageDisplay methods. Can't the first locale
> > object already created outside the loop ( for the list) return the
> > language display for any language from inside the loop? Is it necessary to
> > create the locale object for each language (inside the loop)?
> >
> > Regards,
> >
> >
> >
>
The example was demonstrating the idea only and you can get the same
result using one object if you want.
inside the loop, instead of creating new object for each language; just
use :

$locale->setLocale($language);

this will change the used locale.

Best Regards,
--
Ahmed Shreef
Web Developer
Egypt

Reply via email to