This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user