Skip to content

Commit

Permalink
[Locale] Prevent empty bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
stealth35 committed Mar 9, 2012
1 parent 55f962d commit 7aad478
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Symfony/Component/Locale/Locale.php
Expand Up @@ -51,8 +51,9 @@ static public function getDisplayCountries($locale)

$collator = new \Collator($locale);
$countries = array();
$bundleCountries = $bundle->get('Countries') ?: array();

foreach ($bundle->get('Countries') as $code => $name) {
foreach ($bundleCountries as $code => $name) {
// Global countries (f.i. "America") have numeric codes
// Countries have alphabetic codes
// "ZZ" is the code for unknown country
Expand Down Expand Up @@ -105,8 +106,9 @@ static public function getDisplayLanguages($locale)

$collator = new \Collator($locale);
$languages = array();
$bundleLanguages = $bundle->get('Languages') ?: array();

foreach ($bundle->get('Languages') as $code => $name) {
foreach ($bundleLanguages as $code => $name) {
// "mul" is the code for multiple languages
if ('mul' !== $code) {
$languages[$code] = $name;
Expand Down Expand Up @@ -155,8 +157,9 @@ static public function getDisplayLocales($locale)

$collator = new \Collator($locale);
$locales = array();
$bundleLocales = $bundle->get('Locales') ?: array();

foreach ($bundle->get('Locales') as $code => $name) {
foreach ($bundleLocales as $code => $name) {
$locales[$code] = $name;
}

Expand Down

0 comments on commit 7aad478

Please sign in to comment.