/** * Construct the LocaleChoiceList * * @param LocaleInformation $information LocaleInformation Service * @param bool $languagesOnly If only Languages should be displayed * @param bool $strictMode If strict mode */ public function __construct(LocaleInformation $information, $languagesOnly = true, $strictMode = false) { $this->localeChoices = array(); if ($strictMode) { $allowedLocales = $information->getAllowedLocalesFromConfiguration(); } else { $allowedLocales = $information->getAllAllowedLanguages(); } foreach ($allowedLocales as $locale) { if ($languagesOnly && strlen($locale) == 2 || !$languagesOnly) { $this->localeChoices[$locale] = Locale::getDisplayName($locale, $locale); } } $this->preferredChoices = $information->getPreferredLocales(); parent::__construct($this->localeChoices, $this->preferredChoices); }