dev add field locale for get info for view doc
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-15 13:27:29 +07:00
parent 8c8ae0eb3c
commit dfc24b77c4
@@ -41,7 +41,7 @@ public class GeoCountryService {
response.getCountry().getName();
} catch (Exception e) {
log.error("Failed for input: {}", input, e);
return "UNKNOWN";
return "unknow";
}
}
@@ -54,17 +54,17 @@ public class GeoCountryService {
for (String ip : ipList) {
try {
String country = getCountryByIp(ip, locale);
if (!"UNKNOWN".equals(country)) {
if (!"unknow".equals(country)) {
uniqueCountries.add(country);
}
String countryCode = getCountryCodeByIp(ip);
if (!"UNKNOWN".equals(countryCode)) {
if (!"unknow".equals(countryCode)) {
uniqueCountryCodes.add(countryCode);
}
String city = getCityByIp(ip, locale);
if (!"UNKNOWN".equals(city)) {
if (!"unknow".equals(city)) {
uniqueCities.add(city);
}
} catch (Exception e) {
@@ -88,7 +88,7 @@ public class GeoCountryService {
response.getCountry().getIsoCode();
} catch (Exception e) {
log.error("Failed for input: {}", input, e);
return "UNKNOWN";
return "unknow";
}
}
@@ -96,12 +96,13 @@ public class GeoCountryService {
try {
InetAddress ipAddress = InetAddress.getByName(ip);
CityResponse response = cityDbReader.city(ipAddress);
return response.getCity().getNames().getOrDefault(locale,
String cityName = response.getCity().getNames().getOrDefault(locale,
response.getCity().getName());
return cityName == null ? "unknow": cityName;
} catch (Exception e) {
log.error("Failed to get city for IP: {}", ip, e);
return "UNKNOWN";
return "unknow";
}
}
@@ -109,12 +110,13 @@ public class GeoCountryService {
try {
InetAddress ipAddress = InetAddress.getByName(ip);
CountryResponse response = countryDbReader.country(ipAddress);
return response.getCountry().getNames().getOrDefault(locale,
String countryName = response.getCountry().getNames().getOrDefault(locale,
response.getCountry().getName());
return countryName == null ? "unknow": countryName;
} catch (Exception e) {
log.error("Failed to get country for IP: {}", ip, e);
return "UNKNOWN";
return "unknow";
}
}
@@ -126,7 +128,7 @@ public class GeoCountryService {
return response.getCountry().getIsoCode();
} catch (Exception e) {
log.error("Failed to get country code for IP: {}", ip, e);
return "UNKNOWN";
return "unknow";
}
}