Merge pull request #1824 from ErnestStaug/locale_support

Some document have non-standard locale code
This commit is contained in:
troosan 2021-02-07 23:33:14 +01:00 committed by GitHub
commit 5080139511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -228,6 +228,10 @@ final class Language extends AbstractStyle
*/ */
private function validateLocale($locale) private function validateLocale($locale)
{ {
if ($locale !== null) {
$locale = str_replace('_', '-', $locale);
}
if (strlen($locale) === 2) { if (strlen($locale) === 2) {
return strtolower($locale) . '-' . strtoupper($locale); return strtolower($locale) . '-' . strtoupper($locale);
} }