Exemple #1
0
 private function _getdocPath($doc_name, $language)
 {
     $doc_name = AkInflector::underscore($language != 'en' ? Ak::untranslate($doc_name, $language) : $doc_name);
     return AkConfig::getDir('docs') . DS . (empty($this->docs_path) ? '' : trim($this->docs_path, DS) . DS) . $language . DS . $doc_name . '.textile';
 }
Exemple #2
0
    /**
    * Translate strings from a language to another language.
    *
    * @access public
    * @static
    * @param    string    $string    The string to be translated.
    * @param    string/array    $target_language    A string containing the 
    *           target language or an array containing 0 => from, 1 => to.
    * @return string The untranslated string.
    */
    public static function translate($string, $target_language, $namespace = false)
    {
        $from = is_array($target_language) ? $target_language[0] : 'en' ;
        $to = is_array($target_language) ? $target_language[1] : $target_language ;

        if($from != 'en'){
            $string = Ak::untranslate($string, $from, $namespace);
        }

        $dictionary = AkLocaleManager::getDictionary($to, $namespace);
        return !empty($dictionary[$string]) ? $dictionary[$string] : $string;
    }