fix(strings): make account_backup_password_min_length a plural

"At least %1$d characters" agrees with its count, which Czech and Polish
inflect three ways (znak / znaky / znaků). Convert it to <plurals>, point
the Android and Desktop call sites at pluralStringRes/pluralStringResource,
and give every locale that already had it (hu, hi, pl) plus cs, de, sv and
pt-BR its full CLDR category set.
This commit is contained in:
davotoula
2026-09-28 22:56:08 +02:00
parent c116af332e
commit e6030fa2ad
11 changed files with 42 additions and 7 deletions
@@ -135,6 +135,7 @@ import com.vitorpamplona.amethyst.commons.ui.loadStringRes
import com.vitorpamplona.amethyst.commons.ui.navigation.navs.EmptyNav
import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav
import com.vitorpamplona.amethyst.commons.ui.navigation.topbars.TopBarWithBackButton
import com.vitorpamplona.amethyst.commons.ui.pluralStringRes
import com.vitorpamplona.amethyst.commons.ui.stringRes
import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonRow
import com.vitorpamplona.amethyst.ui.note.authenticate
@@ -498,7 +499,7 @@ private fun EncryptedKeyCard(
label = { Text(stringRes(Res.string.account_backup_encrypted_password)) },
supportingText = {
Text(
text = stringRes(Res.string.account_backup_password_min_length, Nip49.MIN_PASSWORD_LENGTH),
text = pluralStringRes(Res.plurals.account_backup_password_min_length, Nip49.MIN_PASSWORD_LENGTH, Nip49.MIN_PASSWORD_LENGTH),
color = if (longEnough) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
)
},
@@ -6419,4 +6419,10 @@
<string name="cordn_voice_play">Přehrát hlasovou zprávu</string>
<string name="cordn_voice_record">Nahrát hlasovou zprávu</string>
<string name="cordn_voice_stop">Zastavit a odeslat</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">Alespoň %1$d znak</item>
<item quantity="few">Alespoň %1$d znaky</item>
<item quantity="many">Alespoň %1$d znaku</item>
<item quantity="other">Alespoň %1$d znaků</item>
</plurals>
</resources>
@@ -6087,4 +6087,8 @@
<string name="cordn_voice_play">Sprachnachricht abspielen</string>
<string name="cordn_voice_record">Sprachnachricht aufnehmen</string>
<string name="cordn_voice_stop">Stoppen und senden</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">Mindestens %1$d Zeichen</item>
<item quantity="other">Mindestens %1$d Zeichen</item>
</plurals>
</resources>
@@ -661,7 +661,10 @@
<string name="account_backup_encrypted_title">पारणशब्द रक्षित अनुकृति</string>
<string name="account_backup_encrypted_password">पारणशब्द</string>
<string name="account_backup_encrypted_body">एक ncryptsec1… जो केवल आपके पारणशब्द से कार्य करता है।</string>
<string name="account_backup_password_min_length">न्यूनतम %1$d अक्षर</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">न्यूनतम %1$d अक्षर</item>
<item quantity="other">न्यूनतम %1$d अक्षर</item>
</plurals>
<string name="account_backup_encrypted_repeat_password">पारणशब्द दोहराएँ</string>
<string name="account_backup_encrypted_password_mismatch">पारणशब्दों में मेल नहीं</string>
<string name="account_backup_encrypt">रहस्यीकरण कुंचिका</string>
@@ -661,7 +661,10 @@
<string name="account_backup_encrypted_title">Jelszóval védett másolat</string>
<string name="account_backup_encrypted_password">Jelszó</string>
<string name="account_backup_encrypted_body">Egy ncryptsec1…, amely csak az Ön jelszavával működik.</string>
<string name="account_backup_password_min_length">Legalább %1$d karakter</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">Legalább %1$d karakter</item>
<item quantity="other">Legalább %1$d karakter</item>
</plurals>
<string name="account_backup_encrypted_repeat_password">Jelszó ismét</string>
<string name="account_backup_encrypted_password_mismatch">A jelszavak nem egyeznek</string>
<string name="account_backup_encrypt">Kulcs titkosítása</string>
@@ -677,7 +677,12 @@
<string name="account_backup_encrypted_title">Kopia chroniona hasłem</string>
<string name="account_backup_encrypted_password">Hasło</string>
<string name="account_backup_encrypted_body">Ncryptsec1… który działa tylko z twoim hasłem.</string>
<string name="account_backup_password_min_length">Co najmniej %1$d znaków</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">Co najmniej %1$d znak</item>
<item quantity="few">Co najmniej %1$d znaki</item>
<item quantity="many">Co najmniej %1$d znaków</item>
<item quantity="other">Co najmniej %1$d znaku</item>
</plurals>
<string name="account_backup_encrypted_repeat_password">Powtórz hasło</string>
<string name="account_backup_encrypted_password_mismatch">Hasła nie są identyczne</string>
<string name="account_backup_encrypt">Zaszyfruj klucz</string>
@@ -6085,4 +6085,8 @@
<string name="cordn_voice_play">Reproduzir mensagem de voz</string>
<string name="cordn_voice_record">Gravar uma mensagem de voz</string>
<string name="cordn_voice_stop">Parar e enviar</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">Pelo menos %1$d caractere</item>
<item quantity="other">Pelo menos %1$d caracteres</item>
</plurals>
</resources>
@@ -6085,4 +6085,8 @@
<string name="cordn_voice_play">Spela upp röstmeddelande</string>
<string name="cordn_voice_record">Spela in ett röstmeddelande</string>
<string name="cordn_voice_stop">Stoppa och skicka</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">Minst %1$d tecken</item>
<item quantity="other">Minst %1$d tecken</item>
</plurals>
</resources>
@@ -675,7 +675,10 @@
<string name="account_backup_encrypted_title">Password-protected copy</string>
<string name="account_backup_encrypted_password">Password</string>
<string name="account_backup_encrypted_body">An ncryptsec1… that only works with your password.</string>
<string name="account_backup_password_min_length">At least %1$d characters</string>
<plurals name="account_backup_password_min_length">
<item quantity="one">At least %1$d character</item>
<item quantity="other">At least %1$d characters</item>
</plurals>
<string name="account_backup_encrypted_repeat_password">Repeat password</string>
<string name="account_backup_encrypted_password_mismatch">Passwords don't match</string>
<string name="account_backup_encrypt">Encrypt key</string>
@@ -99,6 +99,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringResource
private const val TOTAL_STEPS = 3
@@ -414,7 +415,7 @@ private fun EncryptedCopySection(nsec: String) {
if (error) {
Text(stringResource(Res.string.backup_keys_encrypt_failed))
} else {
Text(stringResource(Res.string.account_backup_password_min_length, Nip49.MIN_PASSWORD_LENGTH))
Text(pluralStringResource(Res.plurals.account_backup_password_min_length, Nip49.MIN_PASSWORD_LENGTH, Nip49.MIN_PASSWORD_LENGTH))
}
},
visualTransformation =
@@ -96,6 +96,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringResource
/**
@@ -378,7 +379,7 @@ private fun EncryptedCopy(nsec: String) {
if (error) {
Text(stringResource(Res.string.backup_keys_encrypt_failed))
} else {
Text(stringResource(Res.string.account_backup_password_min_length, Nip49.MIN_PASSWORD_LENGTH))
Text(pluralStringResource(Res.plurals.account_backup_password_min_length, Nip49.MIN_PASSWORD_LENGTH, Nip49.MIN_PASSWORD_LENGTH))
}
},
visualTransformation =