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


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

// 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

$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

$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
[".$language."] ".$output; } } catch (Exception $e) { continue; } }


No comments to display