diff options
| author | Albin <albin@mullvad.net> | 2024-12-11 17:48:20 +0100 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2024-12-13 11:07:08 +0100 |
| commit | 59ba08ab1bf95779b5bb0cb374687b7fae1b2c83 (patch) | |
| tree | 408ce733d574ea2d34d274ca9078bd8671c721cb /android | |
| parent | efecc8e7e4914a8dc12c55642919661206c014db (diff) | |
| download | mullvadvpn-59ba08ab1bf95779b5bb0cb374687b7fae1b2c83.tar.xz mullvadvpn-59ba08ab1bf95779b5bb0cb374687b7fae1b2c83.zip | |
Fix android daita strings
Diffstat (limited to 'android')
6 files changed, 90 insertions, 32 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt index c31608949d..6d032e1af0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt @@ -91,7 +91,7 @@ private fun FeatureIndicator.text(): String { FeatureIndicator.CUSTOM_DNS -> R.string.feature_custom_dns FeatureIndicator.SERVER_IP_OVERRIDE -> R.string.feature_server_ip_override FeatureIndicator.CUSTOM_MTU -> R.string.feature_custom_mtu - FeatureIndicator.DAITA -> R.string.feature_daita + FeatureIndicator.DAITA -> R.string.daita FeatureIndicator.MULTIHOP -> R.string.feature_multihop } return textResource(resource) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DaitaDirectOnlyConfirmationDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DaitaDirectOnlyConfirmationDialog.kt index a1b6e7bba0..13c3d04e77 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DaitaDirectOnlyConfirmationDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DaitaDirectOnlyConfirmationDialog.kt @@ -29,11 +29,16 @@ fun DaitaDirectOnlyConfirmation(navigator: ResultBackNavigator<Boolean>) { InfoConfirmationDialog( navigator = navigator, titleType = InfoConfirmationDialogTitleType.IconOnly, - confirmButtonTitle = stringResource(R.string.enable_direct_only), + confirmButtonTitle = + stringResource(R.string.enable_direct_only, stringResource(R.string.direct_only)), cancelButtonTitle = stringResource(R.string.cancel), ) { Text( - text = stringResource(id = R.string.direct_only_description), + text = + stringResource( + id = R.string.direct_only_description, + stringResource(id = R.string.daita), + ), color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.bodySmall, modifier = Modifier.fillMaxWidth(), diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/info/DaitaDirectOnlyInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/info/DaitaDirectOnlyInfoDialog.kt index 64e5cd46de..3a16bb83b3 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/info/DaitaDirectOnlyInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/info/DaitaDirectOnlyInfoDialog.kt @@ -22,7 +22,12 @@ private fun PreviewDaitaDirectOnlyInfoDialog() { @Composable fun DaitaDirectOnlyInfo(navigator: DestinationsNavigator) { InfoDialog( - message = stringResource(id = R.string.daita_info), + message = + stringResource( + id = R.string.daita_info, + stringResource(id = R.string.direct_only), + stringResource(id = R.string.daita), + ), onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DaitaScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DaitaScreen.kt index c7c3b61752..a6a2a279dc 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DaitaScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DaitaScreen.kt @@ -138,25 +138,29 @@ private fun DescriptionPager(pagerState: PagerState) { contentDescription = stringResource(R.string.daita), ) DescriptionText( - firstParagraph = page.textFirstParagraph, - secondParagraph = page.textSecondParagraph, - thirdParagraph = page.textThirdParagraph, + firstParagraph = page.textFirstParagraph(), + secondParagraph = page.textSecondParagraph(), + thirdParagraph = page.textThirdParagraph(), ) } } } @Composable -private fun DescriptionText(firstParagraph: Int, secondParagraph: Int, thirdParagraph: Int) { +private fun DescriptionText( + firstParagraph: String, + secondParagraph: String, + thirdParagraph: String, +) { SwitchComposeSubtitleCell( modifier = Modifier.padding(vertical = Dimens.smallPadding), text = buildString { - appendLine(stringResource(firstParagraph)) + appendLine(firstParagraph) appendLine() - appendLine(stringResource(secondParagraph)) + appendLine(secondParagraph) appendLine() - append(stringResource(thirdParagraph)) + append(thirdParagraph) }, ) } @@ -185,20 +189,55 @@ private fun PageIndicator(pagerState: PagerState) { private enum class DaitaPages( val image: Int, - val textFirstParagraph: Int, - val textSecondParagraph: Int, - val textThirdParagraph: Int, + val textFirstParagraph: @Composable () -> String, + val textSecondParagraph: @Composable () -> String, + val textThirdParagraph: @Composable () -> String, ) { FIRST( image = R.drawable.daita_illustration_1, - textFirstParagraph = R.string.daita_description_slide_1_first_paragraph, - textSecondParagraph = R.string.daita_description_slide_1_second_paragraph, - textThirdParagraph = R.string.daita_description_slide_1_third_paragraph, + textFirstParagraph = + @Composable { + stringResource( + R.string.daita_description_slide_1_first_paragraph, + stringResource(id = R.string.daita), + stringResource(id = R.string.daita_full), + ) + }, + textSecondParagraph = + @Composable { stringResource(R.string.daita_description_slide_1_second_paragraph) }, + textThirdParagraph = + @Composable { + stringResource( + R.string.daita_description_slide_1_third_paragraph, + stringResource(id = R.string.daita), + ) + }, ), SECOND( image = R.drawable.daita_illustration_2, - textFirstParagraph = R.string.daita_description_slide_2_first_paragraph, - textSecondParagraph = R.string.daita_description_slide_2_second_paragraph, - textThirdParagraph = R.string.daita_description_slide_2_third_paragraph, + textFirstParagraph = + @Composable { + stringResource( + R.string.daita_description_slide_2_first_paragraph, + stringResource(id = R.string.daita), + ) + }, + textSecondParagraph = + @Composable { + stringResource( + R.string.daita_description_slide_2_second_paragraph, + // Duplicated argument to keep compatibility with our common string template + // (messages.pot) while also keeping lint happy. + stringResource(id = R.string.daita), + stringResource(id = R.string.daita), + ) + }, + textThirdParagraph = + @Composable { + stringResource( + R.string.daita_description_slide_2_third_paragraph, + stringResource(id = R.string.daita), + ) + }, ), } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SelectLocationList.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SelectLocationList.kt index 3538aacff1..08a35f13d8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SelectLocationList.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/location/SelectLocationList.kt @@ -19,7 +19,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.toLowerCase import androidx.lifecycle.compose.collectAsStateWithLifecycle import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.button.PrimaryButton @@ -106,7 +108,14 @@ private fun LazyListScope.loading() { private fun LazyListScope.entryBlocked(openDaitaSettings: () -> Unit) { item(contentType = ContentType.DESCRIPTION) { Text( - text = stringResource(R.string.multihop_entry_disabled_description), + text = + stringResource( + R.string.multihop_entry_disabled_description, + stringResource(R.string.multihop).toLowerCase(Locale.current), + stringResource(id = R.string.daita), + stringResource(R.string.direct_only), + stringResource(id = R.string.daita), + ), style = MaterialTheme.typography.labelMedium, textAlign = TextAlign.Center, color = MaterialTheme.colorScheme.onSurfaceVariant, @@ -118,7 +127,8 @@ private fun LazyListScope.entryBlocked(openDaitaSettings: () -> Unit) { } item(contentType = ContentType.BUTTON) { PrimaryButton( - text = stringResource(R.string.open_daita_settings), + text = + stringResource(R.string.open_feature_settings, stringResource(id = R.string.daita)), onClick = openDaitaSettings, modifier = Modifier.padding(horizontal = Dimens.mediumPadding), ) diff --git a/android/lib/resource/src/main/res/values/strings.xml b/android/lib/resource/src/main/res/values/strings.xml index cd71db65b3..3d3c9a159f 100644 --- a/android/lib/resource/src/main/res/values/strings.xml +++ b/android/lib/resource/src/main/res/values/strings.xml @@ -359,7 +359,7 @@ <string name="failed_to_set_current_unknown_error">Failed to set to current - Unknown reason</string> <string name="location_was_removed_from_list">%s was removed from \"%s\"</string> <string name="create_custom_list_message">\"%s\" was created</string> - <string name="daita_info">By enabling \"Direct Only\" you will have to manually select a server that is DAITA-enabled. This can cause you to end up in a blocked state until you have selected a compatible server in the \"Select location\" view.</string> + <string name="daita_info">By enabling “%1$s” you will have to manually select a server that is %2$s-enabled. This can cause you to end up in a blocked state until you have selected a compatible server in the “Select location” view.</string> <string name="daita_warning">Attention: Since this increases your total network traffic, be cautious if you have a limited data plan. It can also negatively impact your network speed and battery usage.</string> <string name="setting_chip">Setting: %s</string> <string name="enable_anyway">Enable anyway</string> @@ -375,7 +375,6 @@ <string name="feature_custom_dns">Custom DNS</string> <string name="feature_server_ip_override">Server IP override</string> <string name="feature_custom_mtu">MTU</string> - <string name="feature_daita">DAITA</string> <string name="feature_multihop">Multihop</string> <string name="feature_dns_content_blockers">DNS content blockers</string> <string name="connection_details_ipv4">IPv4</string> @@ -410,16 +409,16 @@ <string name="search_results">Search results</string> <string name="filters">Filters:</string> <string name="search_query_empty">Type at least 2 characters to start searching.</string> - <string name="daita_description_slide_1_first_paragraph">DAITA (Defense against AI-guided Traffic Analysis) hides patterns in your encrypted VPN traffic.</string> + <string name="daita_description_slide_1_first_paragraph">%1$s (%2$s) hides patterns in your encrypted VPN traffic.</string> <string name="daita_description_slide_1_second_paragraph">By using sophisticated AI it’s possible to analyze the traffic of data packets going in and out of your device (even if the traffic is encrypted).</string> - <string name="daita_description_slide_1_third_paragraph">If an observer monitors these data packets, DAITA makes it significantly harder for them to identify which websites you are visiting or with whom you are communicating.</string> - <string name="daita_description_slide_2_first_paragraph">DAITA does this by carefully adding network noise and making all network packets the same size.</string> - <string name="daita_description_slide_2_second_paragraph">Not all our servers are DAITA-enabled. Therefore, we use multihop automatically to enable DAITA with any server.</string> + <string name="daita_description_slide_1_third_paragraph">If an observer monitors these data packets, %1$s makes it significantly harder for them to identify which websites you are visiting or with whom you are communicating.</string> + <string name="daita_description_slide_2_first_paragraph">%1$s does this by carefully adding network noise and making all network packets the same size.</string> + <string name="daita_description_slide_2_second_paragraph">Not all our servers are %1$s-enabled. Therefore, we use multihop automatically to enable %2$s with any server.</string> <string name="daita_description_slide_2_third_paragraph">Attention: Be cautious if you have a limited data plan as this feature will increase your network traffic.</string> <string name="direct_only">Direct only</string> - <string name="enable_direct_only">Enable \"Direct only\"</string> - <string name="direct_only_description">Not all our servers are DAITA-enabled. In order to use the internet, you might have to select a new location after enabling.</string> - <string name="multihop_entry_disabled_description">The entry server for multihop is currently overridden by DAITA. To select an entry server, please first enable “Direct only” or disable “DAITA” in the settings.</string> - <string name="open_daita_settings">Open DAITA settings</string> + <string name="enable_direct_only">Enable %1$s</string> + <string name="direct_only_description">Not all our servers are %1$s-enabled. In order to use the internet, you might have to select a new location after enabling.</string> + <string name="multihop_entry_disabled_description">The entry server for %1$s is currently overridden by %2$s. To select an entry server, please first enable “%3$s” or disable \"%4$s\" in the settings.</string> + <string name="open_feature_settings">Open %1$s settings</string> <string name="search">Search</string> </resources> |
