feat: bricks i18n — 硬编码字符串改用 i18n._() + 翻译文件
编译的 dist/ 目录新增 i18n/{zh,en,jp,ko}/ 自动注入到 sage wwwroot/bricks/i18n/
翻译的字符串:
- conform.js: Conform/Discard → i18n._()
- dynamicaccordion.js: add a new record → i18n._()
- form.js: Submit/Reset/Cancel/Requirement → i18n._()
- jsoncall.js: access error → i18n._()
- llm.js: 知识库/召回数量/模版 → i18n._()
build.sh 新增 i18n 目录复制到 dist
This commit is contained in:
parent
aa81a38241
commit
dc74074bdd
@ -42,4 +42,9 @@ cp -a ../examples/* ../dist/examples
|
||||
cp -a ../3parties/* ../dist/3parties
|
||||
cp -a ../docs/* ../dist/docs
|
||||
cp *.tmpl ../dist
|
||||
if [ ! -d ../dist/i18n ];then
|
||||
rm -rf ../dist/i18n
|
||||
mkdir ../dist/i18n
|
||||
fi
|
||||
cp -a ../i18n/* ../dist/i18n
|
||||
echo "Finished ..."
|
||||
|
||||
@ -29,12 +29,12 @@ bricks.Conform = class extends bricks.PopupWindow {
|
||||
bricks.extend({
|
||||
"name":"conform",
|
||||
"icon":bricks_resource('imgs/conform.svg'),
|
||||
"label":'Conform'
|
||||
"label":bricks.app.i18n._('Conform')
|
||||
}, this.opts.conform||{}),
|
||||
bricks.extend({
|
||||
"name":"discard",
|
||||
"icon":bricks_resource('imgs/cancel.svg'),
|
||||
"label":"Discard"
|
||||
"label":bricks.app.i18n._("Discard")
|
||||
}, this.opts.discard||{})
|
||||
]
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
||||
"tools":[
|
||||
{
|
||||
"name":"add",
|
||||
"tip":"add a new record",
|
||||
"tip":bricks.app.i18n._("add a new record"),
|
||||
"icon":this.editable.add_icon || bricks_resource('imgs/add.svg')
|
||||
}
|
||||
]
|
||||
|
||||
@ -251,19 +251,19 @@ bricks.FormBase = class extends bricks.Layout {
|
||||
icon:bricks_resource('imgs/submit.svg'),
|
||||
name:'submit',
|
||||
css:'submit_btn',
|
||||
label:'Submit'
|
||||
label:bricks.app.i18n._('Submit')
|
||||
},
|
||||
{
|
||||
icon:bricks_resource('imgs/reset.svg'),
|
||||
name:'reset',
|
||||
css:'reset_btn',
|
||||
label:'Reset'
|
||||
label:bricks.app.i18n._('Reset')
|
||||
},
|
||||
{
|
||||
icon:bricks_resource('imgs/cancel.svg'),
|
||||
name:'cancel',
|
||||
css:'clear_btn',
|
||||
label:'Cancel'
|
||||
label:bricks.app.i18n._('Cancel')
|
||||
}
|
||||
]
|
||||
var tb_desc={};
|
||||
@ -338,7 +338,7 @@ bricks.FormBase = class extends bricks.Layout {
|
||||
var d = w.getValue();
|
||||
if (w.required && ( d[name] == '' || d[name] === null)){
|
||||
bricks.debug('data=', data, 'd=', d);
|
||||
new bricks.Error({title:'Requirement', message:'required field must input"' + w.label + '"'})
|
||||
new bricks.Error({title:bricks.app.i18n._('Requirement'), message:bricks.app.i18n._('required field must input') + '"' + w.label + '"'})
|
||||
w.focus();
|
||||
return;
|
||||
}
|
||||
@ -392,7 +392,7 @@ bricks.FormBase = class extends bricks.Layout {
|
||||
if (w.parent.is_disabled()) continue;
|
||||
var d = w.getValue();
|
||||
if (w.required && ( d[name] == '' || d[name] === null)){
|
||||
new bricks.Error({title:'Requirement', message:'required field must input"' + w.label + '"'})
|
||||
new bricks.Error({title:bricks.app.i18n._('Requirement'), message:bricks.app.i18n._('required field must input') + '"' + w.label + '"'})
|
||||
w.focus();
|
||||
return;
|
||||
}
|
||||
@ -544,7 +544,7 @@ bricks.InlineForm = class extends bricks.HBox {
|
||||
build_submit(){
|
||||
this.add_widget(new bricks.Filler());
|
||||
var btnopts = {
|
||||
label: this.opts.submit_label || 'Submit',
|
||||
label: this.opts.submit_label || bricks.app.i18n._('Submit'),
|
||||
css: this.opts.submit_css || 'primary'
|
||||
};
|
||||
if (this.opts.submit_icon) btnopts.icon = this.opts.submit_icon;
|
||||
|
||||
@ -137,7 +137,7 @@ bricks.HttpText = class {
|
||||
}
|
||||
if (fetchResult.status == 403){
|
||||
var w = new bricks.Error({
|
||||
"title":"access error",
|
||||
"title":bricks.app.i18n._("access error"),
|
||||
"auto_open":true,
|
||||
"message":"you are forbidden to access it",
|
||||
"archor":"cc",
|
||||
@ -149,7 +149,7 @@ bricks.HttpText = class {
|
||||
}
|
||||
if (! fetchResult.ok){
|
||||
var w = new bricks.Error({
|
||||
"title":"access error",
|
||||
"title":bricks.app.i18n._("access error"),
|
||||
"auto_open":true,
|
||||
"message":"server return error with error code" + fetchResult.status,
|
||||
"archor":"cc",
|
||||
|
||||
@ -531,7 +531,7 @@ bricks.LlmIO = class extends bricks.VBox {
|
||||
"uitype":"checkbox",
|
||||
"multicheck": true,
|
||||
"required": true,
|
||||
"label":"知识库",
|
||||
"label":bricks.app.i18n._("知识库"),
|
||||
"valueField":"id",
|
||||
"textField":"name",
|
||||
"dataurl":this.get_kdb_url
|
||||
@ -540,14 +540,14 @@ bricks.LlmIO = class extends bricks.VBox {
|
||||
"name":"recall_cnt",
|
||||
"uitype":"int",
|
||||
"value": data.recall_cnt,
|
||||
"label":"召回数量"
|
||||
"label":bricks.app.i18n._("召回数量")
|
||||
},
|
||||
{
|
||||
"name":"prompt_tmpl",
|
||||
"value":data.prompt_tmpl,
|
||||
"uitype":"text",
|
||||
"required": true,
|
||||
"label":"模版"
|
||||
"label":bricks.app.i18n._("模版")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
12
i18n/en/msg.txt
Normal file
12
i18n/en/msg.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Conform: Confirm
|
||||
Discard: Discard
|
||||
add a new record: Add a new record
|
||||
Submit: Submit
|
||||
Reset: Reset
|
||||
Cancel: Cancel
|
||||
Requirement: Requirement
|
||||
required field must input: Required field must input
|
||||
access error: Access error
|
||||
知识库: Knowledge Base
|
||||
召回数量: Recall Count
|
||||
模版: Template
|
||||
12
i18n/jp/msg.txt
Normal file
12
i18n/jp/msg.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Conform: 確認
|
||||
Discard: 破棄
|
||||
add a new record: 新規レコード追加
|
||||
Submit: 提出
|
||||
Reset: リセット
|
||||
Cancel: キャンセル
|
||||
Requirement: 必須
|
||||
required field must input: 必須フィールドを入力してください
|
||||
access error: アクセスエラー
|
||||
知识库: 知識ベース
|
||||
召回数量: 検索数
|
||||
模版: テンプレート
|
||||
12
i18n/ko/msg.txt
Normal file
12
i18n/ko/msg.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Conform: 확인
|
||||
Discard: 취소
|
||||
add a new record: 새 레코드 추가
|
||||
Submit: 제출
|
||||
Reset: 재설정
|
||||
Cancel: 취소
|
||||
Requirement: 필수
|
||||
required field must input: 필수 필드를 입력하세요
|
||||
access error: 액세스 오류
|
||||
知识库: 지식 베이스
|
||||
召回数量: 검색 수
|
||||
模版: 템플릿
|
||||
12
i18n/zh/msg.txt
Normal file
12
i18n/zh/msg.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Conform: 确认
|
||||
Discard: 放弃
|
||||
add a new record: 添加新记录
|
||||
Submit: 提交
|
||||
Reset: 重置
|
||||
Cancel: 取消
|
||||
Requirement: 必填
|
||||
required field must input: 必填字段必须输入
|
||||
access error: 访问错误
|
||||
知识库: 知识库
|
||||
召回数量: 召回数量
|
||||
模版: 模版
|
||||
Loading…
x
Reference in New Issue
Block a user