parent
b36fe5d564
commit
b146a8c311
|
@ -23,12 +23,8 @@ class TranslationCommand extends Command
|
||||||
*/
|
*/
|
||||||
public function validateLocaleCode($code)
|
public function validateLocaleCode($code)
|
||||||
{
|
{
|
||||||
$current = setlocale(LC_ALL, '0');
|
if (! preg_match('@[a-z]{2}_[A-Z]{2}@', $code)) {
|
||||||
$result = setlocale(LC_ALL, $code);
|
throw new Exception("Locale code '$code' is not valid. Expected format is: ll_CC");
|
||||||
setlocale(LC_ALL, $current);
|
|
||||||
|
|
||||||
if ($result === false) {
|
|
||||||
throw new Exception("Locale code '$code' is not valid");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $code;
|
return $code;
|
||||||
|
|
Loading…
Reference in New Issue