ApplicationBootstrap: Deprecate method `listLocales()`
This commit is contained in:
parent
2e5abbc832
commit
84757111d1
|
@ -770,27 +770,15 @@ abstract class ApplicationBootstrap
|
||||||
/**
|
/**
|
||||||
* List all available locales
|
* List all available locales
|
||||||
*
|
*
|
||||||
* NOTE: Might be a candidate for a static function in Translator
|
* @return array Locale list
|
||||||
*
|
*
|
||||||
* return array Locale list
|
* @deprecated Use {@see \ipl\I18n\GettextTranslator::listLocales()} instead
|
||||||
*/
|
*/
|
||||||
public function listLocales()
|
public function listLocales()
|
||||||
{
|
{
|
||||||
$locales = array();
|
/** @var GettextTranslator $translator */
|
||||||
if (! $this->hasLocales()) {
|
$translator = StaticTranslator::$instance;
|
||||||
return $locales;
|
|
||||||
}
|
|
||||||
$localedir = $this->getLocaleDir();
|
|
||||||
|
|
||||||
$dh = opendir($localedir);
|
return $translator->listLocales();
|
||||||
while (false !== ($file = readdir($dh))) {
|
|
||||||
$filename = $localedir . DIRECTORY_SEPARATOR . $file;
|
|
||||||
if (preg_match('/^[a-z]{2}_[A-Z]{2}$/', $file) && is_dir($filename)) {
|
|
||||||
$locales[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($dh);
|
|
||||||
sort($locales);
|
|
||||||
return $locales;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue