diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 9b8e6689c..833975cfe 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -599,7 +599,7 @@ class rcube * * @return string Localized text */ - public function gettext($attrib, $domain=null) + public function gettext($attrib, $domain = null) { // load localization files if not done yet if (empty($this->texts)) { @@ -633,18 +633,25 @@ class rcube } } - // format output - if (($attrib['uppercase'] && strtolower($attrib['uppercase'] == 'first')) || $attrib['ucfirst']) { - return ucfirst($text); + // replace \n with real line break + $text = strtr($text, array('\n' => "\n")); + + // case folding + if (($attrib['uppercase'] && strtolower($attrib['uppercase']) == 'first') || $attrib['ucfirst']) { + $case_mode = MB_CASE_TITLE; } else if ($attrib['uppercase']) { - return mb_strtoupper($text); + $case_mode = MB_CASE_UPPER; } else if ($attrib['lowercase']) { - return mb_strtolower($text); + $case_mode = MB_CASE_LOWER; + } + + if (isset($case_mode)) { + $text = mb_convert_case($text, $case_mode); } - return strtr($text, array('\n' => "\n")); + return $text; } /**