summaryrefslogtreecommitdiffhomepage
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
parentdd201019cc0c67740fb0971a194ee745fcbcee77 (diff)
downloadmullvadvpn-d2bf9793cdff2a67e0c1c56e779ca40a4cacd825.tar.xz
mullvadvpn-d2bf9793cdff2a67e0c1c56e779ca40a4cacd825.zip
Search in translated location names
-rw-r--r--CHANGELOG.md2
-rw-r--r--gui/src/renderer/lib/filter-locations.ts7
2 files changed, 7 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f085f02395..0a2cc74687 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -39,6 +39,8 @@ Line wrap the file at 100 chars. Th
to free up port 443 for other TCP based obfuscation later.
### Fixed
+- Fix location search in desktop app only searching for English location names.
+
#### Android
- Fix adaptive app icon which previously had a displaced nose and some other oddities.
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>);