mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
界面语言切换功能,修复nav异常
This commit is contained in:
1 parent
7e7dee4074
commit
0923d6e72b
16 files changed
+53
-36
No files matched your search
@@ -130,7 +130,7 @@ class Handler {
|
||||
this.hasPerm = (perm) => this.user.hasPerm(perm);
|
||||
const res = await template.render(name, Object.assign(context, {
|
||||
handler: this,
|
||||
_: (str) => (str ? str.toString().translate(this.user.language) : ''),
|
||||
_: (str) => (str ? str.toString().translate(this.user.viewLang || this.session.viewLang) : ''),
|
||||
user: this.user,
|
||||
}));
|
||||
console.timeEnd(name);
|
||||
@@ -173,7 +173,7 @@ class Handler {
|
||||
}
|
||||
|
||||
translate(str) {
|
||||
return str ? str.toString().translate(this.user.language) : '';
|
||||
return str ? str.toString().translate(this.user.viewLang || this.session.viewLang) : '';
|
||||
}
|
||||
|
||||
binary(data, name) {
|
||||
@@ -364,11 +364,10 @@ class ConnectionHandler {
|
||||
}
|
||||
|
||||
async renderHTML(name, context) {
|
||||
console.time(name);
|
||||
this.hasPerm = (perm) => this.user.hasPerm(perm);
|
||||
const res = await template.render(name, Object.assign(context, {
|
||||
handler: this,
|
||||
_: (str) => (str ? str.toString().translate(this.user.language) : ''),
|
||||
_: (str) => (str ? str.toString().translate(this.user.viewLang || this.session.viewLang) : ''),
|
||||
user: this.user,
|
||||
}));
|
||||
return res;
|
||||
|
||||
@@ -156,7 +156,7 @@ async function setup() {
|
||||
else resolve();
|
||||
});
|
||||
});
|
||||
console.log('Done! Please restart.');
|
||||
console.log('Done! Restarting...');
|
||||
}
|
||||
|
||||
module.exports = { setup };
|
||||
Reference in new issue
Block a user