Migrate translatable strings from fragment to xml.
This commit is contained in:
parent
3551e7ec00
commit
3f1cb65e02
2 changed files with 99 additions and 50 deletions
|
@ -79,8 +79,6 @@ import java.util.Locale
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remote backups settings fragment.
|
* Remote backups settings fragment.
|
||||||
*
|
|
||||||
* TODO [message-backups] -- All copy in this file is non-final
|
|
||||||
*/
|
*/
|
||||||
class RemoteBackupsSettingsFragment : ComposeFragment() {
|
class RemoteBackupsSettingsFragment : ComposeFragment() {
|
||||||
|
|
||||||
|
@ -208,7 +206,7 @@ private fun RemoteBackupsSettingsContent(
|
||||||
}
|
}
|
||||||
|
|
||||||
Scaffolds.Settings(
|
Scaffolds.Settings(
|
||||||
title = "Signal Backups",
|
title = stringResource(id = R.string.RemoteBackupsSettingsFragment__signal_backups),
|
||||||
onNavigationClick = contentCallbacks::onNavigationClick,
|
onNavigationClick = contentCallbacks::onNavigationClick,
|
||||||
navigationIconPainter = painterResource(id = R.drawable.symbol_arrow_left_24),
|
navigationIconPainter = painterResource(id = R.drawable.symbol_arrow_left_24),
|
||||||
snackbarHost = {
|
snackbarHost = {
|
||||||
|
@ -230,7 +228,7 @@ private fun RemoteBackupsSettingsContent(
|
||||||
if (messageBackupsType == null) {
|
if (messageBackupsType == null) {
|
||||||
item {
|
item {
|
||||||
Rows.TextRow(
|
Rows.TextRow(
|
||||||
text = "Payment history",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__payment_history),
|
||||||
onClick = contentCallbacks::onViewPaymentHistory
|
onClick = contentCallbacks::onViewPaymentHistory
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -240,7 +238,7 @@ private fun RemoteBackupsSettingsContent(
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
Texts.SectionHeader(text = "Backup Details")
|
Texts.SectionHeader(text = stringResource(id = R.string.RemoteBackupsSettingsFragment__backup_details))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backupProgress == null || backupProgress.type == BackupV2Event.Type.FINISHED) {
|
if (backupProgress == null || backupProgress.type == BackupV2Event.Type.FINISHED) {
|
||||||
|
@ -260,7 +258,7 @@ private fun RemoteBackupsSettingsContent(
|
||||||
Rows.TextRow(text = {
|
Rows.TextRow(text = {
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = "Backup size",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__backup_size),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
|
@ -278,7 +276,7 @@ private fun RemoteBackupsSettingsContent(
|
||||||
text = {
|
text = {
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = "Backup frequency",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__backup_frequency),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
|
@ -296,7 +294,7 @@ private fun RemoteBackupsSettingsContent(
|
||||||
item {
|
item {
|
||||||
Rows.ToggleRow(
|
Rows.ToggleRow(
|
||||||
checked = canBackUpUsingCellular,
|
checked = canBackUpUsingCellular,
|
||||||
text = "Back up using cellular",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__back_up_using_cellular),
|
||||||
onCheckChanged = contentCallbacks::onBackUpUsingCellularClick
|
onCheckChanged = contentCallbacks::onBackUpUsingCellularClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -307,7 +305,7 @@ private fun RemoteBackupsSettingsContent(
|
||||||
|
|
||||||
item {
|
item {
|
||||||
Rows.TextRow(
|
Rows.TextRow(
|
||||||
text = "Turn off and delete backup",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__turn_off_and_delete_backup),
|
||||||
foregroundTint = MaterialTheme.colorScheme.error,
|
foregroundTint = MaterialTheme.colorScheme.error,
|
||||||
onClick = contentCallbacks::onTurnOffAndDeleteBackupsClick
|
onClick = contentCallbacks::onTurnOffAndDeleteBackupsClick
|
||||||
)
|
)
|
||||||
|
@ -341,34 +339,26 @@ private fun RemoteBackupsSettingsContent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val snackbarMessageId = remember(requestedSnackbar) {
|
||||||
|
when (requestedSnackbar) {
|
||||||
|
RemoteBackupsSettingsState.Snackbar.NONE -> -1
|
||||||
|
RemoteBackupsSettingsState.Snackbar.BACKUP_DELETED_AND_TURNED_OFF -> R.string.RemoteBackupsSettingsFragment__backup_deleted_and_turned_off
|
||||||
|
RemoteBackupsSettingsState.Snackbar.BACKUP_TYPE_CHANGED_AND_SUBSCRIPTION_CANCELLED -> R.string.RemoteBackupsSettingsFragment__backup_type_changed_and_subcription_deleted
|
||||||
|
RemoteBackupsSettingsState.Snackbar.SUBSCRIPTION_CANCELLED -> R.string.RemoteBackupsSettingsFragment__subscription_cancelled
|
||||||
|
RemoteBackupsSettingsState.Snackbar.DOWNLOAD_COMPLETE -> R.string.RemoteBackupsSettingsFragment__download_complete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val snackbarText = if (snackbarMessageId == -1) "" else stringResource(id = snackbarMessageId)
|
||||||
|
|
||||||
LaunchedEffect(requestedSnackbar) {
|
LaunchedEffect(requestedSnackbar) {
|
||||||
when (requestedSnackbar) {
|
when (requestedSnackbar) {
|
||||||
RemoteBackupsSettingsState.Snackbar.NONE -> {
|
RemoteBackupsSettingsState.Snackbar.NONE -> {
|
||||||
snackbarHostState.currentSnackbarData?.dismiss()
|
snackbarHostState.currentSnackbarData?.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteBackupsSettingsState.Snackbar.BACKUP_DELETED_AND_TURNED_OFF -> {
|
else -> {
|
||||||
snackbarHostState.showSnackbar(
|
snackbarHostState.showSnackbar(snackbarText)
|
||||||
"Backup deleted and turned off"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteBackupsSettingsState.Snackbar.BACKUP_TYPE_CHANGED_AND_SUBSCRIPTION_CANCELLED -> {
|
|
||||||
snackbarHostState.showSnackbar(
|
|
||||||
"Backup type changed and subscription cancelled"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteBackupsSettingsState.Snackbar.SUBSCRIPTION_CANCELLED -> {
|
|
||||||
snackbarHostState.showSnackbar(
|
|
||||||
"Subscription cancelled"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteBackupsSettingsState.Snackbar.DOWNLOAD_COMPLETE -> {
|
|
||||||
snackbarHostState.showSnackbar(
|
|
||||||
"Download complete"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentCallbacks.onSnackbarDismissed()
|
contentCallbacks.onSnackbarDismissed()
|
||||||
|
@ -392,14 +382,14 @@ private fun BackupTypeRow(
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Backup type",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__backup_type),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
|
|
||||||
if (messageBackupsType == null) {
|
if (messageBackupsType == null) {
|
||||||
Text(
|
Text(
|
||||||
text = "Backups disabled",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__backups_disabled),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
|
@ -410,14 +400,14 @@ private fun BackupTypeRow(
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "${messageBackupsType.title} · $formattedCurrency/month"
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__s_dot_s_per_month, messageBackupsType.title, formattedCurrency)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageBackupsType == null) {
|
if (messageBackupsType == null) {
|
||||||
Buttons.Small(onClick = onEnableBackupsClick) {
|
Buttons.Small(onClick = onEnableBackupsClick) {
|
||||||
Text(text = "Enable backups")
|
Text(text = stringResource(id = R.string.RemoteBackupsSettingsFragment__enable_backups))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,11 +429,14 @@ private fun InProgressBackupRow(
|
||||||
if (totalProgress == null || totalProgress == 0) {
|
if (totalProgress == null || totalProgress == 0) {
|
||||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth())
|
LinearProgressIndicator(modifier = Modifier.fillMaxWidth())
|
||||||
} else {
|
} else {
|
||||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth(), progress = ((progress ?: 0) / totalProgress).toFloat())
|
LinearProgressIndicator(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
progress = { ((progress ?: 0) / totalProgress).toFloat() }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "$progress/$totalProgress",
|
text = stringResource(R.string.RemoteBackupsSettingsFragment__d_slash_d, progress ?: 0, totalProgress ?: 0),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
|
@ -465,7 +458,7 @@ private fun LastBackupRow(
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Last backup",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__last_backup),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
|
@ -482,13 +475,13 @@ private fun LastBackupRow(
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "$day at $time",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__s_at_s, day, time),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Text(
|
Text(
|
||||||
text = "Never",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__never),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
|
@ -496,7 +489,7 @@ private fun LastBackupRow(
|
||||||
}
|
}
|
||||||
|
|
||||||
Buttons.Small(onClick = onBackupNowClick) {
|
Buttons.Small(onClick = onBackupNowClick) {
|
||||||
Text(text = "Back up now")
|
Text(text = stringResource(id = R.string.RemoteBackupsSettingsFragment__back_up_now))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,9 +500,9 @@ private fun TurnOffAndDeleteBackupsDialog(
|
||||||
onDismiss: () -> Unit
|
onDismiss: () -> Unit
|
||||||
) {
|
) {
|
||||||
Dialogs.SimpleAlertDialog(
|
Dialogs.SimpleAlertDialog(
|
||||||
title = "Turn off and delete backups?",
|
title = stringResource(id = R.string.RemoteBackupsSettingsFragment__turn_off_and_delete_backups),
|
||||||
body = "You will not be charged again. Your backup will be deleted and no new backups will be created.",
|
body = stringResource(id = R.string.RemoteBackupsSettingsFragment__you_will_not_be_charged_again),
|
||||||
confirm = "Turn off and delete",
|
confirm = stringResource(id = R.string.RemoteBackupsSettingsFragment__turn_off_and_delete),
|
||||||
dismiss = stringResource(id = android.R.string.cancel),
|
dismiss = stringResource(id = android.R.string.cancel),
|
||||||
confirmColor = MaterialTheme.colorScheme.error,
|
confirmColor = MaterialTheme.colorScheme.error,
|
||||||
onConfirm = onConfirm,
|
onConfirm = onConfirm,
|
||||||
|
@ -591,7 +584,7 @@ private fun BackupFrequencyDialog(
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Backup frequency",
|
text = stringResource(id = R.string.RemoteBackupsSettingsFragment__backup_frequency),
|
||||||
style = MaterialTheme.typography.headlineMedium,
|
style = MaterialTheme.typography.headlineMedium,
|
||||||
modifier = Modifier.padding(24.dp)
|
modifier = Modifier.padding(24.dp)
|
||||||
)
|
)
|
||||||
|
@ -601,7 +594,7 @@ private fun BackupFrequencyDialog(
|
||||||
selected = selected == it,
|
selected = selected == it,
|
||||||
text = getTextForFrequency(backupsFrequency = it),
|
text = getTextForFrequency(backupsFrequency = it),
|
||||||
label = when (it) {
|
label = when (it) {
|
||||||
BackupFrequency.MANUAL -> "By tapping \"Back up now\""
|
BackupFrequency.MANUAL -> stringResource(id = R.string.RemoteBackupsSettingsFragment__by_tapping_back_up_now)
|
||||||
else -> null
|
else -> null
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
@ -632,10 +625,10 @@ private fun BackupFrequencyDialog(
|
||||||
@Composable
|
@Composable
|
||||||
private fun getTextForFrequency(backupsFrequency: BackupFrequency): String {
|
private fun getTextForFrequency(backupsFrequency: BackupFrequency): String {
|
||||||
return when (backupsFrequency) {
|
return when (backupsFrequency) {
|
||||||
BackupFrequency.DAILY -> "Daily"
|
BackupFrequency.DAILY -> stringResource(id = R.string.RemoteBackupsSettingsFragment__daily)
|
||||||
BackupFrequency.WEEKLY -> "Weekly"
|
BackupFrequency.WEEKLY -> stringResource(id = R.string.RemoteBackupsSettingsFragment__weekly)
|
||||||
BackupFrequency.MONTHLY -> "Monthly"
|
BackupFrequency.MONTHLY -> stringResource(id = R.string.RemoteBackupsSettingsFragment__monthly)
|
||||||
BackupFrequency.MANUAL -> "Manually back up"
|
BackupFrequency.MANUAL -> stringResource(id = R.string.RemoteBackupsSettingsFragment__manually_back_up)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7032,10 +7032,66 @@
|
||||||
<string name="DeleteSyncEducation_acknowledge_button">OK</string>
|
<string name="DeleteSyncEducation_acknowledge_button">OK</string>
|
||||||
|
|
||||||
<!-- RemoteBackupsSettingsFragment -->
|
<!-- RemoteBackupsSettingsFragment -->
|
||||||
|
<!-- Displayed on the title bar -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__signal_backups">Signal Backups</string>
|
||||||
|
<!-- Row label to launch payment history screen -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__payment_history">Payment history</string>
|
||||||
|
<!-- Section header for backup information -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__backup_details">Backup details</string>
|
||||||
|
<!-- Row label for backup size -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__backup_size">Backup size</string>
|
||||||
|
<!-- Row label for backup frequency -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__backup_frequency">Backup frequency</string>
|
||||||
|
<!-- Toggle row label for allowing backups to occur while on cellular connection -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__back_up_using_cellular">Back up using cellular</string>
|
||||||
|
<!-- Row label for cancelling and deleting backup -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__turn_off_and_delete_backup">Turn off and delete backup</string>
|
||||||
|
<!-- Snackbar text displayed when backup has been deleted and turned off -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__backup_deleted_and_turned_off">Backup deleted and turned off.</string>
|
||||||
|
<!-- Snackbar text displayed when backup type is downgraded -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__backup_type_changed_and_subcription_deleted">Backup type changed and subscription cancelled</string>
|
||||||
|
<!-- Snackbar text displayed when backup subscription is cancelled -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__subscription_cancelled">Subscription cancelled</string>
|
||||||
|
<!-- Snackbar text displayed when backup is successfully downloaded -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__download_complete">Download complete</string>
|
||||||
|
<!-- Title text in row detailing selected backup type -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__backup_type">Backup type</string>
|
||||||
|
<!-- Subtitle text in row detailing selected backup type displayed when backups are disabled -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__backups_disabled">Backups disabled</string>
|
||||||
|
<!-- Format string for backup and cost. First placeholder is backup title, second is cost per month. -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__s_dot_s_per_month">%1$s · %2$s/month</string>
|
||||||
|
<!-- Button label to enable backups -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__enable_backups">Enable backups</string>
|
||||||
|
<!-- Progress indicator subtext displayed when a backup is in progress -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__d_slash_d">%1$d/%2$d</string>
|
||||||
|
<!-- Title text in row detailing last backup -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__last_backup">Last backup</string>
|
||||||
|
<!-- Subtext describing when a backup took place. First placeholder is the day, second is time. -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__s_at_s">%1$s at %2$s</string>
|
||||||
|
<!-- Subtext describing when a backup has never taken place. -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__never">Never</string>
|
||||||
|
<!-- Button label to perform a backup immediately -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__back_up_now">Back up now</string>
|
||||||
|
<!-- Dialog title when confirming whether to turn off and deleting backups -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__turn_off_and_delete_backups">Turn off and delete backups?</string>
|
||||||
|
<!-- Dialog message when confirming whether to turn off and delete backups -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__you_will_not_be_charged_again">You will not be charged again. Your backup will be deleted and no new backups will be created.</string>
|
||||||
|
<!-- Confirmation action on dialog to turn off and delete backups -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__turn_off_and_delete">Turn off and delete</string>
|
||||||
<!-- Text on dialog while user backup is being deleted -->
|
<!-- Text on dialog while user backup is being deleted -->
|
||||||
<string name="RemoteBackupsSettingsFragment__deleting_backup">Deleting backup…</string>
|
<string name="RemoteBackupsSettingsFragment__deleting_backup">Deleting backup…</string>
|
||||||
<!-- Text on dialog when user backup is deleted -->
|
<!-- Text on dialog when user backup is deleted -->
|
||||||
<string name="RemoteBackupsSettingsFragment__backup_deleted">Backup deleted</string>
|
<string name="RemoteBackupsSettingsFragment__backup_deleted">Backup deleted</string>
|
||||||
|
<!-- Subtitle for frequency option MANUAL for backup frequency -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__by_tapping_back_up_now">By tapping "Back up now"</string>
|
||||||
|
<!-- Title for frequency option DAILY for backup frequency -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__daily">Daily</string>
|
||||||
|
<!-- Title for frequency option DAILY for backup frequency -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__weekly">Weekly</string>
|
||||||
|
<!-- Title for frequency option DAILY for backup frequency -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__monthly">Monthly</string>
|
||||||
|
<!-- Title for frequency option DAILY for backup frequency -->
|
||||||
|
<string name="RemoteBackupsSettingsFragment__manually_back_up">Manually back up</string>
|
||||||
|
|
||||||
<!-- EOF -->
|
<!-- EOF -->
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Reference in a new issue