From 070c7f127bc814ad6123df4d643df2e50b907886 Mon Sep 17 00:00:00 2001 From: filip Date: Sun, 30 Nov 2014 16:27:34 +0100 Subject: First push of report about differences between Transifex and our git repository --- langs.inc.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'langs.inc.php') diff --git a/langs.inc.php b/langs.inc.php index 5e9dceab5..4826b4ecf 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -117,6 +117,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) -- cgit v1.2.1