內容簡介
這個外掛讓使用者可以翻譯靜態文字,例如:
echo _l(‘cat’);
詳情請參閱 http://www.flexostudio.com/
使用方式
需要創建一個位於 WordPress 主題內部的 php 檔案,檔案名必須是 lang_ (將翻譯的語言種類加在後面,例如 lang_en.php)
該檔案需要包含以下程式碼:
<?php $FL_DICT = array(
'cat' => 'Katze',
'dog' => 'Hund',
.............
);?>
其中的 'cat' => 'Katze' 是一個單詞及其翻譯的對應。
在 function.php 中新增以下程式碼:
<?php if(class_exists(‘flexoLanguage’)){
$f = dirname(__FILE__);
if(!flexoLanguage::is_set_language())
flexoLanguage::set_language('en');//選擇語言
flexoLanguage::add_dictionary($f);
function _l($key){
return flexoLanguage::_($key);
}
}
否則,新增以下程式碼讓單詞不被翻譯:
function _l($key){return $key;}
並且在任何您想擁有另一種語言翻譯的單詞出現的程式碼中,加上以下語句:
_l(‘cat’);
外掛標籤
開發者團隊
原文外掛簡介
It allow the user to translate static texts as the example:
echo _l(‘cat’);
see http://www.flexostudio.com/
How to use
need to make php file that is located inside the theme, it must be said lang_ (languages ??which will translate as lang_en.php)
and contains the following code:
'Katze',
'dog' => 'Hund',
.............
);?>
where ‘cat’ => ‘Katze’ ‘regulations is a word and its translation.
in function.php to add the code:
and everywhere in the code where you write words you want to have a translation in another language and place:
_l(‘cat’);
