ZF-11893: Zend_Locale::getTranslationList() has wrong examples

Issue Type: Docs: Problem Created: 2011-11-16T11:29:33.000+0000 Last Updated: 2011-11-16T11:29:33.000+0000 Status: Open Fix version(s): Reporter: Dennis Becker (radhad) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

  • ,
  • Examples
  • Manual,
  • Zend_Locale,
  • getTranslationList

Related issues: Attachments:


The examples for using getTranslationList() of Zend_Locale have not been migrated with ZF 1.9 described in the migration guide. If you look at the description in the manual… and have a lok at the examples #8, #9 and #10, you'll see the issues. I would recommend the following changes as described in the migration guide.

Example #8 getTranslationList

<pre class="highlight">// prints the names of all countries in German language
print_r(Zend_Locale::getTranslationList('territory', 'de', 2));

Example #9 Converting country name in one language to another

<pre class="highlight">
$code2name = Zend_Locale::getTranslationList('language', 'en_US');
$name2code = array_flip($code2name);
$frenchCode = $name2code['French'];
echo Zend_Locale::getTranslation($frenchCode, 'language', 'de_AT');
// output is the German name of the French language

Example #10 All Languages written in their native language

<pre class="highlight">
$list = Zend_Locale::getTranslationList('language', 'auto');
foreach($list as $language => $content) {
    try {
        $output = Zend_Locale::getTranslation($language, 'language', $language);
        if (is_string($output)) {
            print "\n<br></br>[".$language."] ".$output;
    } catch (Exception $e) {


No comments to display

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.