====LanguageAction====
这是一个给用户选择界面语言的插件。暂时不与CooCooWakka一同发布。
(只有CooCooWakka的charset设置为utf-8时,才能工作。)
需要PEAR_HTML_QUICKFORM或者CooCooWakka 0.0.8以上。
使用方法:
新建文件actions/language.php:
%%(php)
require_once "HTML/QuickForm.php";
if(strtolower($this->getconfigvalue("charset"))=="utf-8"){
$langs["schinese-utf"]="schinese";
$langs["tchinese-utf"]="tchinese";
$langs["english"]="english";
}
$form = new HTML_QuickForm('langForm','',$this->Href());
$form->addElement("select","sellang","Choose Language:",$langs,array("onChange"=>"langForm.submit()"));
if($form->validate()){
$lang=$form->getElementValue("sellang");
$this->SetPersistentCookie("language",$lang[0]);
$this->redirect($this->Href());
}
$form->display();
?>
%%
然后在适当的CooCooWakka页面中加入:
""{{language}}""
就可以使用了。
test