mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: i18n: better performance
This commit is contained in:
5 files changed
+10
-27
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user