mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-06 00:01:05 +00:00
fix: 增强国际化函数的健壮性,处理无效键值
This commit is contained in:
1 parent
7a01193593
commit
e2931058cb
2 files changed
+6
-1
No files matched your search
@@ -647,6 +647,7 @@ let _dirty = {}; // { "section.key": newValue }
|
||||
let _activeTab = SCHEMA_DEF[0].id;
|
||||
|
||||
function tr(key, params, fallback) {
|
||||
if (!key) return fallback ?? '';
|
||||
const value = t(key, params);
|
||||
return value === key ? (fallback ?? key) : value;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@
|
||||
return b||'zh';
|
||||
}
|
||||
|
||||
function get(o,k){ for(var p=k.split('.'),i=0;i<p.length;i++){if(o==null)return; o=o[p[i]];} return o; }
|
||||
function get(o,k){
|
||||
if(typeof k!=='string' || !k) return;
|
||||
for(var p=k.split('.'),i=0;i<p.length;i++){if(o==null)return; o=o[p[i]];}
|
||||
return o;
|
||||
}
|
||||
|
||||
function merge(base, extra){
|
||||
if(extra==null) return base;
|
||||
|
||||
Reference in new issue
Block a user