html文件必须包含着两个
<html lang="zh" >这里可以设置默认语言
<link href="tis/en.tis" hreflang="en" rel="translation" >
<link href="tis/zh.tis" hreflang="zh" rel="translation" >
C++代码自己研究
sciter::value MainFrame::OnSetShowLanguage(sciter::value param)
{
sciter::value svRet = 0;
CString str = param.to_string().c_str();
RegOperate regOp;
if (regOp.SetLanguage(str))
{
svRet = 1;
}
return svRet;
}
sciter::value MainFrame::OnGetShowLanguage()
{
RegOperate regOp;
CString str;
regOp.GetLanguage(str);
sciter::value svRet = str;
return svRet;
}
需要再主窗口授权:
self.language = view.GetShowLanguage();
调用
//语言切换 英文
$(#English).onClick = function()
{
self.language = "en";
}
//语言切换 中文
$(#Chinese).onClick = function()
{
self.language = "zh";
}
其他窗口必须先传参数进去
var winReturn =view.window
{
url: self.url("SevicerLog.html"),
x:750,
y:500,
parameters:
{ // view.parameters inside new window
Language: self.language
}
}
其他窗口调用参数操作:
self.language = view.parameters.paramLang;
英文en.tis文件
({
//"Matches":"Matches", //- deliberetly not defined
"There are # matches in the box" : function(n) {
return n == 0 ? "The matchbox is empty"
: n == 1 ? "There is just one match in the box"
: "There are " + n + " matches in the box";
},
"Second test": "Second test",
"Title test": "Test of title translation",
"UNUSED": "Simply unused",
"Home": "Home",
"Clean":"Clean",
"Registry":"Registry"
})
zh.tis 中文翻译必须完全匹对多空格都不行 再需要翻译的地方加上<label>必须写这里面</label>
({
/* 托盘弹窗 */
"Show Window" :"显示窗口",
"Exit" :"退出",
"There are # matches in the box" : function(n) {
return n == 0 ? "没有匹配"
: n == 1 ? "方框内仅有一个匹配"
: "方框内有 " + n + " 匹配";
}
})