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