Relax locale code validation to just a format check

fixes #6930
This commit is contained in:
Johannes Meyer 2014-08-21 10:06:53 +02:00
parent b36fe5d564
commit b146a8c311
1 changed files with 2 additions and 6 deletions

View File

@ -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;