This commit is contained in:
yumoqing 2025-12-17 16:42:13 +08:00
parent cd23cc239a
commit 19b1ed7b30
2 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,13 @@
var bricks = window.bricks || {}; var bricks = window.bricks || {};
bricks.get_current_language=function(){
var lang = navigator.language.substring(0, 2);
if (bricks.app){
if (bricks.app.lang) return bricks.app.lang;
bricks.app.lang = lang;
return lang;
}
return;
}
bricks.app = null; bricks.app = null;
/* /*
all type of bind action's desc has the following attributes: all type of bind action's desc has the following attributes:
@ -571,7 +580,7 @@ bricks.App = class extends bricks.Layout {
this.lang = this.opts.language; this.lang = this.opts.language;
} }
else { else {
this.lang = navigator.language; this.lang = navigator.language.substring(0,2);
} }
this.lang_x = this.observable('lang', this.lang); this.lang_x = this.observable('lang', this.lang);
this.zindex = 10000; this.zindex = 10000;
@ -719,7 +728,7 @@ bricks.App = class extends bricks.Layout {
return w; return w;
} }
async run(){ async run(){
await (this.change_language(this)); await (this.change_language(this.lang));
var w = await this.build(); var w = await this.build();
this.root = w; this.root = w;
if (!w){ if (!w){

View File

@ -52,7 +52,6 @@ bricks.HttpText = class {
width = bricks.app.screenWidth(); width = bricks.app.screenWidth();
height = bricks.app.screenHeight(); height = bricks.app.screenHeight();
} }
this.params = { this.params = {
"_webbricks_":1, "_webbricks_":1,
"_width":width, "_width":width,
@ -90,6 +89,10 @@ bricks.HttpText = class {
if (! params) if (! params)
params = {}; params = {};
var p = bricks.extend({}, this.params); var p = bricks.extend({}, this.params);
var lang = bricks.get_current_language()
if (lang){
p._lang = lang;
}
p = bricks.extend(p, params); p = bricks.extend(p, params);
if (session){ if (session){
bricks.extend(p,{session:session}); bricks.extend(p,{session:session});