Skip to content

Commit 0da4078

Browse files
committed
add i18n for file input button label
1 parent e262ea4 commit 0da4078

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

webiojs/src/i18n.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const translations: { [lang: string]: { [msgid: string]: string } } = {
1515
"reset": "Reset",
1616
"cancel": "Cancel",
1717
"duplicated_pin_name": "This pin widget has expired (due to the output of a new pin widget with the same name ).",
18+
"browse_file": "Browse",
1819
},
1920
"zh": {
2021
"disconnected_with_server": "与服务器连接已断开,请刷新页面重新操作",
@@ -26,6 +27,7 @@ const translations: { [lang: string]: { [msgid: string]: string } } = {
2627
"reset": "重置",
2728
"cancel": "取消",
2829
"duplicated_pin_name": "该 Pin widget 已失效(由于输出了新的同名 pin widget)",
30+
"browse_file": "浏览文件",
2931
},
3032
};
3133

webiojs/src/models/input/file.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const file_input_tpl = `
77
{{#label}}<label for="{{id_name}}">{{label}}</label>{{/label}}
88
<div class="custom-file">
99
<input type="file" name="{{name}}" class="custom-file-input" id="{{id_name}}" aria-describedby="{{id_name}}_help">
10-
<label class="custom-file-label" for="{{id_name}}"><span>{{placeholder}}</span></label>
10+
<label class="custom-file-label" for="{{id_name}}" data-browse="{{browse_file}}"><span>{{placeholder}}</span></label>
1111
<div class="invalid-feedback">{{invalid_feedback}}</div> <!-- input 添加 is-invalid 类 -->
1212
<div class="valid-feedback">{{valid_feedback}}</div> <!-- input 添加 is-valid 类 -->
1313
<small id="{{id_name}}_help" class="form-text text-muted">{{help_text}}</small>
@@ -29,7 +29,7 @@ export class File extends InputItem {
2929
const id_name = spec.name + '-' + Math.floor(Math.random() * Math.floor(9999));
3030
spec['id_name'] = id_name;
3131

32-
const html = Mustache.render(file_input_tpl, spec);
32+
const html = Mustache.render(file_input_tpl, {...spec, browse_file: t('browse_file')});
3333
this.element = $(html);
3434
let input_elem = this.element.find('input[type="file"]');
3535

0 commit comments

Comments
 (0)