This commit is contained in:
yumoqing 2025-12-28 16:50:24 +08:00
parent 30041c08dc
commit 2a25a718be
2 changed files with 3 additions and 13 deletions

View File

@ -706,17 +706,8 @@ bricks.App = class extends bricks.Layout {
get_session(){ get_session(){
return this.session_id; return this.session_id;
} }
async setup_i18n(){
let params = {'lang':this.lang};
var jc = new bricks.HttpJson();
d = await jc.httpcall(desc.url, {
"method":desc.method||'GET',
params:params
}
);
this.i18n.setup_dict(d);
}
async build(){ async build(){
await this.i18n.change_lang(this.lang)
var opts = bricks.extend({}, this.opts.widget); var opts = bricks.extend({}, this.opts.widget);
var w = await bricks.widgetBuild(opts, bricks.Body); var w = await bricks.widgetBuild(opts, bricks.Body);
if (!w){ if (!w){

View File

@ -392,10 +392,9 @@ bricks.TextBase = class extends bricks.JsWidget {
if (this.opts.hasOwnProperty('i18n')){ if (this.opts.hasOwnProperty('i18n')){
this.i18n = this.opts.i18n; this.i18n = this.opts.i18n;
} }
this._i18n = new bricks.I18n();
this.set_style('flexShrink', '0'); this.set_style('flexShrink', '0');
if (this.i18n && this.otext) { if (this.i18n && this.otext) {
this.text = this._i18n._(this.otext); this.text = bricks.app.i18n._(this.otext);
} }
this.dom_element.innerHTML = this.text; this.dom_element.innerHTML = this.text;
} }
@ -403,7 +402,7 @@ bricks.TextBase = class extends bricks.JsWidget {
var text; var text;
this.otext = otxt; this.otext = otxt;
if (this.i18n) { if (this.i18n) {
text = this._i18n._(this.otext); text = bricks.app.i18n._(this.otext);
} else { } else {
text = this.otext; text = this.otext;
} }