core: i18n: better performance

This commit is contained in:
undefined committed 2025-03-13 23:03:51 +08:00
1 parent 985fd7224d
commit ebc2eaecba
5 files changed
+10 -27

No files matched your search

+2 -2
View File
@@ -160,8 +160,8 @@ export async function apply(ctx: Context) {
if (!str) return '';
const lang = this.user?.viewLang || this.session?.viewLang;
const res = lang
? str.toString().translate(lang, ...this.context.acceptsLanguages())
: str.toString().translate(...this.context.acceptsLanguages(), system.get('server.language'));
? ctx.i18n.translate(str.toString(), [lang, ...this.context.acceptsLanguages()])
: ctx.i18n.translate(str.toString(), [...this.context.acceptsLanguages(), system.get('server.language')]);
return res;
},
paginate<T>(cursor: FindCursor<T>, page: number, key: string | number) {