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

+1 -1
View File
@@ -22,7 +22,7 @@ export default class GeoIPService extends Service {
provider = '<a href="http://www.maxmind.com" target="_blank">MaxMind</a>';
lookup(ip: string, locale: string): Result {
const res: any = reader.get(ip);
if (!res) return { display: 'Unknown address'.translate(locale) };
if (!res) return { display: this.ctx.i18n.translate('Unknown address', [locale]) };
const ret: Result = { display: '' };
if (res.location) ret.location = res.location;
if (res.continent) ret.continent = res.continent.names[locale] || res.continent.names.en;