improvement(Localization): Move Camera permission strings to translatable resources #626

This commit is contained in:
Artem Chepurnoy 2024-10-11 12:54:06 +03:00
parent a7d3c8cece
commit 80fb5dd2b8
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
2 changed files with 8 additions and 12 deletions

View File

@ -112,24 +112,18 @@ private fun ScanQrCamera2(
modifier = Modifier
.padding(horizontal = Dimens.horizontalPadding),
) {
val textToShow = if (status.shouldShowRationale) {
// If the user has denied the permission but the rationale can be shown,
// then gently explain why the app requires this permission
"The camera is important for this app. Please grant the permission."
} else {
// If it's the first time the user lands on this feature, or the user
// doesn't want to be asked again for this permission, explain that the
// permission is required
"Camera permission required for this feature to be available. " +
"Please grant the permission"
}
val textToShow = stringResource(Res.string.scanqr_camera_permission_required_text)
Text(textToShow)
Button(
modifier = Modifier
.padding(top = Dimens.verticalPadding),
onClick = {
cameraPermissionState.launchPermissionRequest()
},
) {
Text("Request permission")
Text(
text = stringResource(Res.string.grant_permission),
)
}
}
}

View File

@ -175,6 +175,7 @@
<string name="passkey_available">Passkey available</string>
<string name="twofa_available">Two-factor authentication available</string>
<string name="custom">Custom</string>
<string name="grant_permission">Grant permission</string>
<string name="create_account">Create account</string>
<string name="follow_system_settings">Follow system settings</string>
<!-- A feature is coming soon! -->
@ -494,6 +495,7 @@
<string name="scanqr_title">Scan QR code</string>
<string name="scanqr_load_from_image_note">Load and parse a QR code from an image file.</string>
<string name="scanqr_camera_permission_required_text">Camera permission is required to scan the QR codes.</string>
<!-- Title of the 'Show as Barcode' dialog -->
<string name="barcodetype_title">Barcode</string>