summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-12-08 19:57:18 +0100
committerOskar Nyberg <oskar@mullvad.net>2021-12-08 19:57:18 +0100
commit327f13f19be9e0bfab7af1490aacb5a33951901d (patch)
treedf2a94fb8444a1355a00b0f867f9c80517e8b7f1
parent60179b610c9aaa79961dcd4628a7cb1fb50349e9 (diff)
downloadmullvadvpn-327f13f19be9e0bfab7af1490aacb5a33951901d.tar.xz
mullvadvpn-327f13f19be9e0bfab7af1490aacb5a33951901d.zip
Translate label in select location button
-rw-r--r--gui/src/renderer/containers/ConnectPage.tsx19
1 files changed, 8 insertions, 11 deletions
diff --git a/gui/src/renderer/containers/ConnectPage.tsx b/gui/src/renderer/containers/ConnectPage.tsx
index c9ae60897b..9d507ede18 100644
--- a/gui/src/renderer/containers/ConnectPage.tsx
+++ b/gui/src/renderer/containers/ConnectPage.tsx
@@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { sprintf } from 'sprintf-js';
-import { messages } from '../../shared/gettext';
+import { messages, relayLocations } from '../../shared/gettext';
import log from '../../shared/logging';
import Connect from '../components/Connect';
import withAppContext, { IAppContext } from '../context';
@@ -9,32 +9,29 @@ import { RoutePath } from '../lib/routes';
import { IRelayLocationRedux, RelaySettingsRedux } from '../redux/settings/reducers';
import { IReduxState, ReduxDispatch } from '../redux/store';
-function getRelayName(
- relaySettings: RelaySettingsRedux,
- relayLocations: IRelayLocationRedux[],
-): string {
+function getRelayName(relaySettings: RelaySettingsRedux, locations: IRelayLocationRedux[]): string {
if ('normal' in relaySettings) {
const location = relaySettings.normal.location;
if (location === 'any') {
return 'Automatic';
} else if ('country' in location) {
- const country = relayLocations.find(({ code }) => code === location.country);
+ const country = locations.find(({ code }) => code === location.country);
if (country) {
- return country.name;
+ return relayLocations.gettext(country.name);
}
} else if ('city' in location) {
const [countryCode, cityCode] = location.city;
- const country = relayLocations.find(({ code }) => code === countryCode);
+ const country = locations.find(({ code }) => code === countryCode);
if (country) {
const city = country.cities.find(({ code }) => code === cityCode);
if (city) {
- return city.name;
+ return relayLocations.gettext(city.name);
}
}
} else if ('hostname' in location) {
const [countryCode, cityCode, hostname] = location.hostname;
- const country = relayLocations.find(({ code }) => code === countryCode);
+ const country = locations.find(({ code }) => code === countryCode);
if (country) {
const city = country.cities.find(({ code }) => code === cityCode);
if (city) {
@@ -46,7 +43,7 @@ function getRelayName(
// TRANSLATORS: %(hostname)s - a hostname
messages.pgettext('connect-container', '%(city)s (%(hostname)s)'),
{
- city: city.name,
+ city: relayLocations.gettext(city.name),
hostname,
},
);