Only display locales that are installed on the system
This commit is contained in:
parent
eef3b88ff7
commit
b14df412c1
1 changed files with 9 additions and 1 deletions
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
namespace Alltube;
|
namespace Alltube;
|
||||||
|
|
||||||
|
use Symfony\Component\Process\ProcessBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to manage locales.
|
* Class used to manage locales.
|
||||||
*/
|
*/
|
||||||
|
@ -55,8 +57,14 @@ class LocaleManager
|
||||||
public function getSupportedLocales()
|
public function getSupportedLocales()
|
||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
|
$builder = new ProcessBuilder(['locale', '-a']);
|
||||||
|
$process = $builder->getProcess();
|
||||||
|
$process->run();
|
||||||
|
$installedLocales = explode(PHP_EOL, trim($process->getOutput()));
|
||||||
foreach ($this->supportedLocales as $supportedLocale) {
|
foreach ($this->supportedLocales as $supportedLocale) {
|
||||||
$return[] = new Locale($supportedLocale);
|
if (in_array($supportedLocale, $installedLocales)) {
|
||||||
|
$return[] = new Locale($supportedLocale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|
Loading…
Reference in a new issue