Skip to content

Commit

Permalink
add fix to #10 auto-alias lang-LOCALE pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
vluzrmos committed Dec 30, 2015
1 parent f4bf666 commit 7f6d5a0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,22 @@
function parse_langs_to_array($str)
{
if (is_array($str)) {
return $str;
$languages = $str;
} else {
$languages = split_str_to_simple_array($str);
}

return split_str_to_simple_array($str);
foreach ($languages as $alias => $lang) {
if (is_numeric($alias) && str_contains($lang, '-')) {
$newAlias = preg_replace('/-/', '_', $lang);

if (! isset($languages[$newAlias])) {
$languages[$newAlias] = $lang;
}
}
}

return $languages;
}
}

Expand Down

0 comments on commit 7f6d5a0

Please sign in to comment.