summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/lib
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-03-27 16:45:35 +0200
committerOskar Nyberg <oskar@mullvad.net>2023-03-28 08:39:27 +0200
commitd2bf9793cdff2a67e0c1c56e779ca40a4cacd825 (patch)
treebc76ded8a1d9ab7c3d65da1e7c690ea465502d71 /gui/src/renderer/lib
parentdd201019cc0c67740fb0971a194ee745fcbcee77 (diff)
downloadmullvadvpn-d2bf9793cdff2a67e0c1c56e779ca40a4cacd825.tar.xz
mullvadvpn-d2bf9793cdff2a67e0c1c56e779ca40a4cacd825.zip
Search in translated location names
Diffstat (limited to 'gui/src/renderer/lib')
-rw-r--r--gui/src/renderer/lib/filter-locations.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/gui/src/renderer/lib/filter-locations.ts b/gui/src/renderer/lib/filter-locations.ts
index 93d20f0c88..e2a4c5d96d 100644
--- a/gui/src/renderer/lib/filter-locations.ts
+++ b/gui/src/renderer/lib/filter-locations.ts
@@ -1,4 +1,5 @@
import { Ownership, RelayEndpointType, RelayLocation } from '../../shared/daemon-rpc-types';
+import { relayLocations } from '../../shared/gettext';
import { SpecialLocation } from '../components/select-location/select-location-types';
import {
IRelayLocationCityRedux,
@@ -97,7 +98,8 @@ export function searchForLocations(
return countries.reduce((countries, country) => {
const matchingCities = searchCities(country.cities, searchTerm);
const expanded = matchingCities.length > 0;
- const match = search(searchTerm, country.code) || search(searchTerm, country.name);
+ const match =
+ search(searchTerm, country.code) || search(searchTerm, relayLocations.gettext(country.name));
const resultingCities = match ? country.cities : matchingCities;
return expanded || match ? [...countries, { ...country, cities: resultingCities }] : countries;
}, [] as Array<IRelayLocationRedux>);
@@ -110,7 +112,8 @@ function searchCities(
return cities.reduce((cities, city) => {
const matchingRelays = city.relays.filter((relay) => search(searchTerm, relay.hostname));
const expanded = matchingRelays.length > 0;
- const match = search(searchTerm, city.code) || search(searchTerm, city.name);
+ const match =
+ search(searchTerm, city.code) || search(searchTerm, relayLocations.gettext(city.name));
const resultingRelays = match ? city.relays : matchingRelays;
return expanded || match ? [...cities, { ...city, relays: resultingRelays }] : cities;
}, [] as Array<IRelayLocationCityRedux>);