diff options
Diffstat (limited to 'langs.inc.php')
-rw-r--r-- | langs.inc.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/langs.inc.php b/langs.inc.php index 5e9dceab5..4826b4ecf 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -118,6 +118,26 @@ function locale_hyphen_underscore($locale, $version_of_locale_uppercase = false) /** + * Create string pt-br from string pt_br or pt_BR and alike but leave the rest as is + * Return string. + * Do not exit the process. + * + * @param string $locale which we want to change + * + * @return string +*/ +function locale_underscore_to_hyphen($locale) +{ + preg_match("/(..)(_)(..)/", $locale, $parsed_locale); + if(isset($parsed_locale[3])) { + return $parsed_locale[1] . '-' . strtolower($parsed_locale[3]); + } else { + return $locale; + } +} + + +/** */ function show_langs($langs) { |