improvement: Move more text phrases to translatable resources #626

This commit is contained in:
Artem Chepurnyi 2024-10-21 11:06:01 +03:00
parent 57e99557f6
commit 4ee3f2960f
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
4 changed files with 30 additions and 9 deletions

View File

@ -25,6 +25,9 @@
<string name="email_visibility">Email visibility</string>
<string name="public_url">Public URL</string>
<string name="url">URL</string>
<string name="conceal_value">Conceal value</string>
<string name="field_label">Label</string>
<string name="field_value">Value</string>
<!-- Access count increases every time someone opens a send and looks and the page -->
<string name="access_count">Access count</string>
<!--
@ -660,6 +663,7 @@
<string name="addaccount_captcha_need_client_secret_note">To pass the captcha verification on an unofficial Bitwarden client, you must specify the client secret. To find it, visit Web vault / Settings / API Key.</string>
<!-- A label on top of the Client secret field -->
<string name="addaccount_captcha_need_client_secret_label">Client secret</string>
<string name="addaccount_create_an_account_title">Create an account</string>
<string name="addaccount_sign_in_button">Sign in</string>
<string name="addaccount_region_section">Region</string>
<string name="addaccount_region_us_type">United States</string>
@ -826,6 +830,8 @@
<string name="generator_header_password_title">Password generator</string>
<string name="generator_generate_button">Generate</string>
<string name="generator_regenerate_button">Regenerate</string>
<!-- 'Use' generated password as a password -->
<string name="generator_use_button">Use</string>
<string name="generator_passphrase_type">Passphrase</string>
<string name="generator_passphrase_note">Random passphrases provide the best combination of memorability and security.</string>
<string name="generator_passphrase_delimiter_title">Delimiter</string>

View File

@ -410,7 +410,7 @@ fun LoginContent(
FlatItemTextContent(
title = {
Text(
text = "Create an account",
text = stringResource(Res.string.addaccount_create_an_account_title),
)
},
)

View File

@ -159,6 +159,7 @@ import kotlinx.collections.immutable.toPersistentMap
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.distinctUntilChanged
@ -1319,10 +1320,16 @@ class AddStateItemFieldTextFactory : AddStateItemFieldFactory() {
initial?.name.orEmpty()
}
val labelMutableState = mutableComposeState(labelSink)
val labelFlow = labelSink.map { label ->
val labelHintFlow = ioEffect {
translate(Res.string.field_label)
}.asFlow()
val labelFlow = combine(
labelSink,
labelHintFlow,
) { labelValue, labelHint ->
TextFieldModel2(
text = label,
hint = "Label",
text = labelValue,
hint = labelHint,
state = labelMutableState,
onChange = labelMutableState::value::set,
)
@ -1332,10 +1339,16 @@ class AddStateItemFieldTextFactory : AddStateItemFieldFactory() {
initial?.value.orEmpty()
}
val textMutableState = mutableComposeState(textSink)
val textFlow = textSink.map { text ->
val textHintFlow = ioEffect {
translate(Res.string.field_value)
}.asFlow()
val textFlow = combine(
textSink,
textHintFlow,
) { textValue, textHint ->
TextFieldModel2(
text = text,
hint = "Value",
text = textValue,
hint = textHint,
state = textMutableState,
onChange = textMutableState::value::set,
)
@ -1360,7 +1373,7 @@ class AddStateItemFieldTextFactory : AddStateItemFieldFactory() {
)
}
},
title = TextHolder.Value("Conceal value"),
title = TextHolder.Res(Res.string.conceal_value),
trailing = {
Checkbox(
checked = conceal,

View File

@ -343,7 +343,9 @@ private fun ColumnScope.GeneratorValue2(
)
},
text = {
Text("Use")
Text(
text = stringResource(Res.string.generator_use_button),
)
},
)
},