界面文字中英文
策略界面上的文字可以同时写中文和英文,网页按当前语言显示其中一种,切换语言后刷新网页生效:
- 策略名称、策略参数的描述:写成
中文|英文。 - 策略描述、使用说明等
Markdown文本:写成[trans]中文|英文[/trans]或[trans]中文||英文[/trans]。 - 策略代码中输出字符串的函数,例如
Log()、LogStatus():写法与Markdown文本相同;状态栏按钮的文字直接写中文|英文,不加[trans]标签。
javascript
function main() {
Log("[trans]日志|log[/trans]")
// 按钮中不用加[trans]标签
var btn = {"type": "button", "cmd": "coverAll", "name": "平仓|cover",
"description": "描述|description"}
var table = {
type: "table",
title: "[trans]操作|option[/trans]",
cols: ["[trans]列1|col1[/trans]", "[trans]列2|col2[/trans]", "[trans]操作|option[/trans]"],
rows: [
["[trans]比特币|BTC[/trans]", "[trans]以太坊|ETH[/trans]", btn]
]
}
LogStatus("[trans]信息|message[/trans]", "\n`" + JSON.stringify(table) + "`")
throw "[trans]错误|error[/trans]"
}
python
import json
def main():
Log("[trans]日志|log[/trans]")
btn = {"type": "button", "cmd": "coverAll", "name": "平仓|cover",
"description": "描述|description"}
table = {
"type": "table",
"title": "[trans]操作|option[/trans]",
"cols": ["[trans]列1|col1[/trans]", "[trans]列2|col2[/trans]", "[trans]操作|option[/trans]"],
"rows": [
["[trans]比特币|BTC[/trans]", "[trans]以太坊|ETH[/trans]", btn]
]
}
LogStatus("[trans]信息|message[/trans]", "\n`" + json.dumps(table) + "`")
raise Exception("[trans]错误|error[/trans]")
rust
fn main() {
Log!("[trans]日志|log[/trans]");
let table = r#"{
"type": "table",
"title": "[trans]操作|option[/trans]",
"cols": ["[trans]列1|col1[/trans]", "[trans]列2|col2[/trans]", "[trans]操作|option[/trans]"],
"rows": [
["[trans]比特币|BTC[/trans]", "[trans]以太坊|ETH[/trans]",
{"type": "button", "cmd": "coverAll", "name": "平仓|cover",
"description": "描述|description"}]
]
}"#;
LogStatus!("[trans]信息|message[/trans]", format!("\n`{}`", table));
Panic!("[trans]错误|error[/trans]");
}