summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2019-09-18 18:24:00 +0200
committerAndrej Mihajlov <and@mullvad.net>2019-09-19 09:38:06 +0200
commit7b1b2dc335c88dd6d87bd774e15d6087e31ff7b9 (patch)
treeae1ec91106229e552c348013a0e73d0dd4b4c0f1 /gui/src
parent1660952f9249ca1cf4d132594c1e276f317a0c51 (diff)
downloadmullvadvpn-7b1b2dc335c88dd6d87bd774e15d6087e31ff7b9.tar.xz
mullvadvpn-7b1b2dc335c88dd6d87bd774e15d6087e31ff7b9.zip
Translate location
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/renderer/app.tsx30
1 files changed, 24 insertions, 6 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index a8dca3ca6e..39e6f56fda 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -149,6 +149,11 @@ export default class AppRenderer {
this.settings = initialState.settings;
this.guiSettings = initialState.guiSettings;
+ // Load translations
+ for (const catalogue of [messages, countries, cities, relayLocations]) {
+ loadTranslations(this.locale, catalogue);
+ }
+
this.setAccountExpiry(initialState.accountData && initialState.accountData.expiry);
this.setAccountHistory(initialState.accountHistory);
this.setSettings(initialState.settings);
@@ -173,11 +178,6 @@ export default class AppRenderer {
// disable pinch to zoom
webFrame.setVisualZoomLevelLimits(1, 1);
-
- // Load translations
- for (const catalogue of [messages, countries, cities, relayLocations]) {
- loadTranslations(this.locale, catalogue);
- }
}
public renderView() {
@@ -546,7 +546,25 @@ export default class AppRenderer {
}
private setLocation(location: ILocation) {
- this.reduxActions.connection.newLocation(location);
+ this.reduxActions.connection.newLocation(this.translateLocation(location));
+ }
+
+ private translateLocation(inputLocation: ILocation): ILocation {
+ const location = { ...inputLocation };
+
+ if (location.city) {
+ const city = location.city;
+
+ location.city = relayLocations.gettext(city) || cities.gettext(city) || city;
+ }
+
+ if (location.country) {
+ const country = location.country;
+
+ location.country = countries.gettext(country) || country;
+ }
+
+ return location;
}
private convertRelayListToLocationList(relayList: IRelayList): IRelayLocationRedux[] {