roundcubemail/program/lib/Roundcube/rcube.php
public function gettext($attrib, $domain = null)
    {
        // load localization files if not done yet
        if (empty($this->texts)) {
            $this->load_language();
        }

        // extract attributes
        if (is_string($attrib)) {
            $attrib = array('name' => $attrib);
        }

        $name = (string) $attrib['name'];

        // attrib contain text values: use them from now
        if (($setval = $attrib[strtolower($_SESSION['language'])]) || ($setval = $attrib['en_us'])) {
            $this->texts[$name] = $setval;
        }

        // check for text with domain
        if ($domain && ($text = $this->texts[$domain.'.'.$name])) {
        }
        // text does not exist
        else if (!($text = $this->texts[$name])) {
            return "[$name]";
        }

        // replace vars in text
        if (is_array($attrib['vars'])) {
            foreach ($attrib['vars'] as $var_key => $var_value) {
                $text = str_replace($var_key[0] != '$' ? '$'.$var_key : $var_key, $var_value, $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']) {
            $case_mode = MB_CASE_UPPER;
        }
        else if ($attrib['lowercase']) {
            $case_mode = MB_CASE_LOWER;
        }

        if (isset($case_mode)) {
            $text = mb_convert_case($text, $case_mode);
        }

        return $text;
    }
public function gettext($attrib, $domain = null)
    {
        // load localization files if not done yet
        if (empty($this->texts)) {
            $this->load_language();
        }

        // extract attributes
        if (is_string($attrib)) {
            $attrib = array('name' => $attrib);
        }

        $name = (string) $attrib['name'];

        // attrib contain text values: use them from now
        if (($setval = $attrib[strtolower($_SESSION['language'])]) || ($setval = $attrib['en_us'])) {
            $this->texts[$name] = $setval;
        }

        // check for text with domain
        if ($domain && ($text = $this->texts[$domain.'.'.$name])) {
        }
        // text does not exist
        else if (!($text = $this->texts[$name])) {
            return "[$name]";
        }

        // replace vars in text
        if (is_array($attrib['vars'])) {
            foreach ($attrib['vars'] as $var_key => $var_value) {
                $text = str_replace($var_key[0] != '$' ? '$'.$var_key : $var_key, $var_value, $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']) {
            $case_mode = MB_CASE_UPPER;
        }
        else if ($attrib['lowercase']) {
            $case_mode = MB_CASE_LOWER;
        }

        if (isset($case_mode)) {
            $text = mb_convert_case($text, $case_mode);
        }

        return $text;
    }
public function gettext ( $ attrib , $ domain = null ) { // load localization files if not done yet if ( empty ( $ this -> texts ) ) { $ this -> load_language ( ) ; } // extract attributes if ( is_string ( $ attrib ) ) { $ attrib = array ( 'name' => $ attrib ) ; } $ name = ( string ) $ attrib [ 'name' ] ; // attrib contain text values: use them from now if ( ( $ setval = $ attrib [ strtolower ( $ _SESSION [ 'language' ] ) ] ) || ( $ setval = $ attrib [ 'en_us' ] ) ) { $ this -> texts [ $ name ] = $ setval ; } // check for text with domain if ( $ domain && ( $ text = $ this -> texts [ $ domain . '.' . $ name ] ) ) { } // text does not exist else if ( ! ( $ text = $ this -> texts [ $ name ] ) ) { return "[$name]" ; } // replace vars in text if ( is_array ( $ attrib [ 'vars' ] ) ) { foreach ( $ attrib [ 'vars' ] as $ var_key => $ var_value ) { $ text = str_replace ( $ var_key [ 0 ] != '$' ? '$' . $ var_key : $ var_key , $ var_value , $ 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' ] ) { $ case_mode = MB_CASE_UPPER ; } else if ( $ attrib [ 'lowercase' ] ) { $ case_mode = MB_CASE_LOWER ; } if ( isset ( $ case_mode ) ) { $ text = mb_convert_case ( $ text , $ case_mode ) ; } return $ text ; }
Get localized text in the desired language

@param mixed  $attrib Named parameters array or label name
@param string $domain Label domain (plugin) name

@return string Localized text
Get localized text in the desired language