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

This commit is contained in:
2026-05-14 12:44:19 +07:00
parent 48cdca56a2
commit 5dc3bb7157
4 changed files with 10 additions and 8 deletions
@@ -92,12 +92,12 @@ public class GeoCountryService {
}
}
public String getCityByIp(String ip) {
public String getCityByIp(String ip, String locale) {
try {
InetAddress ipAddress = InetAddress.getByName(ip);
CityResponse response = cityDbReader.city(ipAddress);
return response.getCity().getNames().getOrDefault("ru",
return response.getCity().getNames().getOrDefault(locale,
response.getCity().getName());
} catch (Exception e) {
log.error("Failed to get city for IP: {}", ip, e);
@@ -105,12 +105,12 @@ public class GeoCountryService {
}
}
public String getCountryByIp(String ip) {
public String getCountryByIp(String ip, String locale) {
try {
InetAddress ipAddress = InetAddress.getByName(ip);
CountryResponse response = countryDbReader.country(ipAddress);
return response.getCountry().getNames().getOrDefault("ru",
return response.getCountry().getNames().getOrDefault(locale,
response.getCountry().getName());
} catch (Exception e) {
log.error("Failed to get country for IP: {}", ip, e);