Skip to content

Commit d4bf8f4

Browse files
committed
Localize the "Country, City" strings
1 parent 6024fd3 commit d4bf8f4

File tree

27 files changed

+49
-33
lines changed

27 files changed

+49
-33
lines changed

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -630,16 +630,13 @@ private fun ConnectionCardHeader(
630630
}
631631
}
632632

633+
@Composable
633634
private fun GeoIpLocation?.asString(): String {
634-
return if (this == null) ""
635-
else {
636-
buildString {
637-
append(country)
638-
if (!city.isNullOrBlank()) {
639-
append(", ")
640-
append(city)
641-
}
642-
}
635+
val city = this?.city
636+
return when {
637+
this == null -> ""
638+
city.isNullOrBlank() -> country
639+
else -> stringResource(R.string.country_comma_city, country, city)
643640
}
644641
}
645642

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/RelayListContent.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,14 @@ private fun RecentListItem(
154154
onUpdateBottomSheetState: (LocationBottomSheetState) -> Unit,
155155
) {
156156
val subtitle =
157-
when (listItem.item) {
158-
is RelayItem.Location.Relay -> "${listItem.cityName}, ${listItem.countryName}"
159-
is RelayItem.Location.City -> listItem.countryName
157+
when (val relayItem = listItem.item) {
158+
is RelayItem.Location.Relay ->
159+
stringResource(
160+
R.string.country_comma_city,
161+
relayItem.countryName,
162+
relayItem.cityName,
163+
)
164+
is RelayItem.Location.City -> relayItem.countryName
160165
is RelayItem.Location.Country,
161166
is RelayItem.CustomList -> null
162167
}

android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/RelayListItem.kt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,6 @@ sealed interface RelayListItem {
112112
override val depth: Int = 0
113113
override val contentType = RelayListItemContentType.RECENT_LIST_ITEM
114114
override val canExpand: Boolean = false
115-
116-
val countryName: String? =
117-
when (item) {
118-
is RelayItem.CustomList -> null
119-
is RelayItem.Location.City -> item.countryName
120-
is RelayItem.Location.Country -> item.name
121-
is RelayItem.Location.Relay -> item.countryName
122-
}
123-
val cityName: String? =
124-
when (item) {
125-
is RelayItem.CustomList -> null
126-
is RelayItem.Location.City -> item.name
127-
is RelayItem.Location.Country -> null
128-
is RelayItem.Location.Relay -> item.cityName
129-
}
130115
}
131116

132117
data object RecentsListFooter : RelayListItem {

android/lib/ui/resource/src/main/res/values-ar/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<string name="copied_mullvad_account_number">تم نسخ رقم حساب Mullvad إلى الحافظة</string>
107107
<string name="copy">نسخ</string>
108108
<string name="copy_account_number">نسخ رقم الحساب</string>
109+
<string name="country_comma_city">%1$s، %2$s</string>
109110
<string name="create">إنشاء</string>
110111
<string name="create_account_fail_title">فشل إنشاء الحساب</string>
111112
<string name="create_custom_list_message">تم إنشاء \"%1$s\"</string>

android/lib/ui/resource/src/main/res/values-da/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<string name="copied_mullvad_account_number">Kopierede Mullvad-kontonummer til udklipsholder</string>
107107
<string name="copy">Kopiér</string>
108108
<string name="copy_account_number">Kopiér kontonummer</string>
109+
<string name="country_comma_city">%1$s, %2$s</string>
109110
<string name="create">Opret</string>
110111
<string name="create_account_fail_title">Oprettelse af konto mislykkedes</string>
111112
<string name="create_custom_list_message">\"%1$s\" blev oprettet</string>

android/lib/ui/resource/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<string name="copied_mullvad_account_number">Mullvad-Kontonummer wurde in die Zwischenablage kopiert</string>
107107
<string name="copy">Kopieren</string>
108108
<string name="copy_account_number">Kontonummer kopieren</string>
109+
<string name="country_comma_city">%1$s, %2$s</string>
109110
<string name="create">Erstellen</string>
110111
<string name="create_account_fail_title">Kontoerstellung fehlgeschlagen</string>
111112
<string name="create_custom_list_message">„%1$s“ wurde erstellt</string>

android/lib/ui/resource/src/main/res/values-es/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<string name="copied_mullvad_account_number">El número de cuenta de Mullvad se copió en el Portapapeles</string>
107107
<string name="copy">Copiar</string>
108108
<string name="copy_account_number">Copiar número de cuenta</string>
109+
<string name="country_comma_city">%1$s, %2$s</string>
109110
<string name="create">Crear</string>
110111
<string name="create_account_fail_title">Error al crear la cuenta</string>
111112
<string name="create_custom_list_message">Se ha creado «%1$s»</string>

android/lib/ui/resource/src/main/res/values-fa/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<string name="copied_mullvad_account_number">شمارهٔ حساب Mullvad در کلیپ‌بورد کپی شد</string>
107107
<string name="copy">کپی</string>
108108
<string name="copy_account_number">کپی کردن شمارهٔ حساب</string>
109+
<string name="country_comma_city">%1$s, %2$s</string>
109110
<string name="create">ایجاد کردن</string>
110111
<string name="create_account_fail_title">ایجاد حساب کاربری ناموفق بود</string>
111112
<string name="create_custom_list_message">%1$s ایجاد شد</string>

android/lib/ui/resource/src/main/res/values-fi/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<string name="copied_mullvad_account_number">Mullvad-tilin numero kopioitu leikepöydälle</string>
107107
<string name="copy">Kopioi</string>
108108
<string name="copy_account_number">Kopioi tilin numero</string>
109+
<string name="country_comma_city">%1$s, %2$s</string>
109110
<string name="create">Luo</string>
110111
<string name="create_account_fail_title">Tilin luominen epäonnistui</string>
111112
<string name="create_custom_list_message">\"%1$s\" luotiin</string>

android/lib/ui/resource/src/main/res/values-fr/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<string name="copied_mullvad_account_number">Numéro de compte Mullvad copié dans le presse-papiers</string>
107107
<string name="copy">Copier</string>
108108
<string name="copy_account_number">Copier le numéro de compte</string>
109+
<string name="country_comma_city">%1$s, %2$s</string>
109110
<string name="create">Créer</string>
110111
<string name="create_account_fail_title">Échec de la création du compte</string>
111112
<string name="create_custom_list_message">« %1$s » a été créé</string>

0 commit comments

Comments
 (0)