contacts-and-mailbox-cannot-be-translated.diff (18284B)
1 diff --git a/wallet/src/main/java/net/taler/wallet/contacts/ContactScreen.kt b/wallet/src/main/java/net/taler/wallet/contacts/ContactScreen.kt 2 index d59b0b00..9bc840ec 100644 3 --- a/wallet/src/main/java/net/taler/wallet/contacts/ContactScreen.kt 4 +++ b/wallet/src/main/java/net/taler/wallet/contacts/ContactScreen.kt 5 @@ -139,7 +139,12 @@ fun ContactScreen( 6 Scaffold( 7 topBar = { 8 TopAppBar( 9 - title = { Text(if (sendUri != null) "Send to Contact" else "Contacts") }, 10 + title = { 11 + Text(stringResource( 12 + if (sendUri != null) R.string.contacts_send_title 13 + else R.string.contacts_title 14 + )) 15 + }, 16 navigationIcon = { 17 IconButton(onClick = onNavigateBack) { 18 Icon( 19 @@ -152,7 +157,7 @@ fun ContactScreen( 20 }, 21 floatingActionButton = { 22 FloatingActionButton(onClick = { showAddDialog = true }) { 23 - Icon(Icons.Default.Add, contentDescription = "Add Contact") 24 + Icon(Icons.Default.Add, contentDescription = stringResource(R.string.contacts_add)) 25 } 26 } 27 ) { innerPadding -> 28 @@ -167,14 +172,20 @@ fun ContactScreen( 29 modifier = Modifier 30 .fillMaxWidth() 31 .padding(horizontal = 16.dp, vertical = 8.dp), 32 - placeholder = { Text("Search contacts...") }, 33 + placeholder = { Text(stringResource(R.string.contacts_search)) }, 34 leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) }, 35 singleLine = true, 36 ) 37 38 when (val res = contactResult) { 39 - is ContactResult.Loading -> Text("Loading...", modifier = Modifier.padding(16.dp)) 40 - is ContactResult.Error -> Text("Error: ${res.error}", modifier = Modifier.padding(16.dp)) 41 + is ContactResult.Loading -> Text( 42 + stringResource(R.string.loading), 43 + modifier = Modifier.padding(16.dp), 44 + ) 45 + is ContactResult.Error -> Text( 46 + stringResource(R.string.contacts_error, res.error.toString()), 47 + modifier = Modifier.padding(16.dp), 48 + ) 49 is ContactResult.Success -> { 50 val filteredContacts = res.contacts.filter { contact -> 51 contact.petname.fuzzyMatches(searchQuery) || 52 @@ -196,8 +207,12 @@ fun ContactScreen( 53 contactToConfirm?.let { contact -> 54 AlertDialog( 55 onDismissRequest = { contactToConfirm = null }, 56 - title = { Text("Send to ${contact.petname}") }, 57 - text = { Text("Are you sure you want to send this to ${contact.petname}?") }, 58 + title = { Text(stringResource(R.string.contacts_send_confirm_title, contact.petname)) }, 59 + text = { 60 + Text(stringResource( 61 + R.string.contacts_send_confirm_message, contact.petname, 62 + )) 63 + }, 64 confirmButton = { 65 TextButton(onClick = { 66 model.mailboxManager.sendMessage(contact, sendUri!!) 67 @@ -290,19 +305,19 @@ fun AddContactDialog( 68 69 AlertDialog( 70 onDismissRequest = onDismiss, 71 - title = { Text("Add Contact") }, 72 + title = { Text(stringResource(R.string.contacts_add)) }, 73 text = { 74 Column(modifier = Modifier.verticalScroll(rememberScrollState())) { 75 OutlinedTextField( 76 value = petname, 77 onValueChange = { petname = it }, 78 - label = { Text("Petname") }, 79 + label = { Text(stringResource(R.string.contacts_petname)) }, 80 modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp) 81 ) 82 OutlinedTextField( 83 value = alias, 84 onValueChange = { alias = it }, 85 - label = { Text("Alias") }, 86 + label = { Text(stringResource(R.string.contacts_alias)) }, 87 placeholder = { 88 Text( 89 if (aliasType == stringResource(R.string.alias_registration_alias_email)) { 90 @@ -327,7 +342,7 @@ fun AddContactDialog( 91 value = aliasType, 92 onValueChange = {}, 93 readOnly = true, 94 - label = { Text("Alias Type") }, 95 + label = { Text(stringResource(R.string.contacts_alias_type)) }, 96 trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = aliasTypeExpanded) }, 97 colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(), 98 modifier = Modifier 99 @@ -354,7 +369,7 @@ fun AddContactDialog( 100 101 if (isDuplicate) { 102 Text( 103 - text = "A contact with this alias and type already exists.", 104 + text = stringResource(R.string.contacts_duplicate), 105 color = MaterialTheme.colorScheme.error, 106 style = MaterialTheme.typography.bodySmall, 107 modifier = Modifier.padding(bottom = 8.dp) 108 @@ -373,13 +388,13 @@ fun AddContactDialog( 109 enabled = alias.isNotBlank() && aliasType.isNotBlank(), 110 modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp) 111 ) { 112 - Text("Lookup with Taldir") 113 + Text(stringResource(R.string.contacts_lookup_taldir)) 114 } 115 } 116 117 if (lookupResult is LookupResult.Error) { 118 Text( 119 - text = "Lookup failed: ${lookupResult.error.userFacingMsg}", 120 + text = stringResource(R.string.contacts_lookup_failed, lookupResult.error.userFacingMsg), 121 color = MaterialTheme.colorScheme.error, 122 style = MaterialTheme.typography.bodySmall, 123 modifier = Modifier.padding(bottom = 8.dp) 124 @@ -389,7 +404,7 @@ fun AddContactDialog( 125 OutlinedTextField( 126 value = mailbox, 127 onValueChange = { mailbox = it }, 128 - label = { Text("Mailbox") }, 129 + label = { Text(stringResource(R.string.contacts_mailbox)) }, 130 modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp) 131 ) 132 } 133 @@ -425,7 +440,7 @@ fun ContactList( 134 onSelect: ((ContactEntry) -> Unit)? = null, 135 ) { 136 if (contacts.isEmpty()) { 137 - Text("No contacts yet.", modifier = Modifier.padding(16.dp)) 138 + Text(stringResource(R.string.contacts_empty), modifier = Modifier.padding(16.dp)) 139 } else { 140 LazyColumn { 141 items(contacts) { contact -> 142 @@ -470,7 +485,7 @@ fun ContactItem( 143 Text(contact.mailboxBaseUri, style = MaterialTheme.typography.bodySmall) 144 } 145 IconButton(onClick = { onDelete(contact) }) { 146 - Icon(Icons.Default.Delete, contentDescription = "Delete") 147 + Icon(Icons.Default.Delete, contentDescription = stringResource(R.string.transactions_delete)) 148 } 149 } 150 } 151 diff --git a/wallet/src/main/java/net/taler/wallet/mailbox/MailboxScreen.kt b/wallet/src/main/java/net/taler/wallet/mailbox/MailboxScreen.kt 152 index 01073ef5..053b8c3f 100644 153 --- a/wallet/src/main/java/net/taler/wallet/mailbox/MailboxScreen.kt 154 +++ b/wallet/src/main/java/net/taler/wallet/mailbox/MailboxScreen.kt 155 @@ -111,7 +111,7 @@ fun MailboxScreen( 156 Scaffold( 157 topBar = { 158 TopAppBar( 159 - title = { Text("Mailbox") }, 160 + title = { Text(stringResource(R.string.mailbox_title)) }, 161 navigationIcon = { 162 IconButton(onClick = onNavigateBack) { 163 Icon( 164 @@ -124,15 +124,15 @@ fun MailboxScreen( 165 val state = mailboxState 166 if (state is MailboxResult.Success) { 167 IconButton(onClick = { showAddressDialog = true }) { 168 - Icon(Icons.Default.Info, contentDescription = "Show Mailbox Address") 169 + Icon(Icons.Default.Info, contentDescription = stringResource(R.string.mailbox_show_address)) 170 } 171 } 172 IconButton(onClick = { showUrlDialog = true }) { 173 - Icon(Icons.Default.Settings, contentDescription = "Configure Mailbox") 174 + Icon(Icons.Default.Settings, contentDescription = stringResource(R.string.mailbox_configure)) 175 } 176 if (state is MailboxResult.Success) { 177 IconButton(onClick = { mailboxManager.refreshMailbox(state.config) }) { 178 - Icon(Icons.Default.Refresh, contentDescription = "Refresh") 179 + Icon(Icons.Default.Refresh, contentDescription = stringResource(R.string.mailbox_refresh)) 180 } 181 } 182 } 183 @@ -146,8 +146,14 @@ fun MailboxScreen( 184 .padding(innerPadding) 185 ) { 186 when (val res = mailboxState) { 187 - is MailboxResult.Loading -> Text("Loading...", modifier = Modifier.padding(16.dp)) 188 - is MailboxResult.Error -> Text("Error: ${res.error}", modifier = Modifier.padding(16.dp)) 189 + is MailboxResult.Loading -> Text( 190 + stringResource(R.string.loading), 191 + modifier = Modifier.padding(16.dp), 192 + ) 193 + is MailboxResult.Error -> Text( 194 + stringResource(R.string.mailbox_error, res.error.toString()), 195 + modifier = Modifier.padding(16.dp), 196 + ) 197 is MailboxResult.Success -> { 198 MessageList(res.messages, onNavigate) { message -> 199 mailboxManager.deleteMessage(res.config, message) 200 @@ -161,9 +167,10 @@ fun MailboxScreen( 201 val state = mailboxState 202 if (state is MailboxResult.Success) { 203 val mailboxAddressURI = "${state.config.mailboxBaseUrl}/${state.config.hAddress}" 204 + val addressCopiedMessage = stringResource(R.string.mailbox_address_copied) 205 AlertDialog( 206 onDismissRequest = { showAddressDialog = false }, 207 - title = { Text("Your Mailbox Address") }, 208 + title = { Text(stringResource(R.string.mailbox_your_address)) }, 209 text = { 210 Text(mailboxAddressURI) 211 }, 212 @@ -171,7 +178,7 @@ fun MailboxScreen( 213 TextButton(onClick = { 214 clipboardManager.setText(AnnotatedString(mailboxAddressURI)) 215 scope.launch { 216 - snackbarHostState.showSnackbar("Mailbox address URI copied to clipboard") 217 + snackbarHostState.showSnackbar(addressCopiedMessage) 218 } 219 showAddressDialog = false 220 }) { 221 @@ -191,12 +198,12 @@ fun MailboxScreen( 222 var url by remember { mutableStateOf("https://mailbox.gnunet.org") } 223 AlertDialog( 224 onDismissRequest = { showUrlDialog = false }, 225 - title = { Text("Configure Mailbox URL") }, 226 + title = { Text(stringResource(R.string.mailbox_configure_url)) }, 227 text = { 228 OutlinedTextField( 229 value = url, 230 onValueChange = { url = it }, 231 - label = { Text("Mailbox Base URL") }, 232 + label = { Text(stringResource(R.string.mailbox_base_url)) }, 233 modifier = Modifier.fillMaxWidth() 234 ) 235 }, 236 @@ -224,7 +231,7 @@ fun MessageList( 237 onDelete: (MailboxMessageRecord) -> Unit, 238 ) { 239 if (messages.isEmpty()) { 240 - Text("No messages yet.", modifier = Modifier.padding(16.dp)) 241 + Text(stringResource(R.string.mailbox_empty), modifier = Modifier.padding(16.dp)) 242 } else { 243 LazyColumn { 244 items(messages) { message -> 245 @@ -255,22 +262,28 @@ fun MessageItem( 246 Button( 247 onClick = { onNavigate(WalletDestination.HandleUri(message.talerUri), false) } 248 ) { 249 - Text(if (isPayPush) "Accept payment" else "Pay invoice") 250 + Text(stringResource( 251 + if (isPayPush) R.string.mailbox_accept_payment 252 + else R.string.mailbox_pay_invoice 253 + )) 254 } 255 } else { 256 Text(message.talerUri, style = MaterialTheme.typography.bodyMedium) 257 } 258 Text( 259 - "From: ${message.originMailboxBaseUrl}", 260 + stringResource(R.string.mailbox_from, message.originMailboxBaseUrl), 261 style = MaterialTheme.typography.bodySmall 262 ) 263 Text( 264 - "Received: ${message.downloadedAt.ms.toAbsoluteTime(context)}", 265 + stringResource( 266 + R.string.mailbox_received, 267 + message.downloadedAt.ms.toAbsoluteTime(context), 268 + ), 269 style = MaterialTheme.typography.bodySmall 270 ) 271 } 272 IconButton(onClick = { onDelete(message) }) { 273 - Icon(Icons.Default.Delete, contentDescription = "Delete") 274 + Icon(Icons.Default.Delete, contentDescription = stringResource(R.string.transactions_delete)) 275 } 276 } 277 } 278 diff --git a/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt b/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt 279 index 5d904900..afadd1e7 100644 280 --- a/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt 281 +++ b/wallet/src/main/java/net/taler/wallet/settings/SettingsScreen.kt 282 @@ -254,22 +254,22 @@ fun SettingsScreen( 283 ) 284 285 SettingsItem( 286 - title = "Contacts", 287 - summary = "Contacts", 288 + title = stringResource(R.string.contacts_title), 289 + summary = stringResource(R.string.settings_contacts_summary), 290 icon = Icons.Default.Person, 291 onClick = { onNavigate(WalletDestination.Contacts(), false) } 292 ) 293 294 SettingsItem( 295 - title = "Mailbox", 296 - summary = "P2P Messaging", 297 + title = stringResource(R.string.mailbox_title), 298 + summary = stringResource(R.string.mailbox_summary), 299 icon = ImageVector.vectorResource(R.drawable.ic_adjust), 300 onClick = { onNavigate(WalletDestination.Mailbox, false) } 301 ) 302 303 SettingsItem( 304 title = stringResource(R.string.alias_registration_title), 305 - summary = "Taldir Registration", 306 + summary = stringResource(R.string.settings_taldir_summary), 307 icon = Icons.Default.Person, 308 onClick = { onNavigate(WalletDestination.AliasRegistration, false) } 309 ) 310 diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml 311 index 905e4390..eb80f552 100644 312 --- a/wallet/src/main/res/values/strings.xml 313 +++ b/wallet/src/main/res/values/strings.xml 314 @@ -519,6 +519,40 @@ GNU Taler is immune to many types of fraud such as credit card data theft, phish 315 <string name="contact_mailbox_base_uri">Mailbox Base URI</string> 316 <string name="contact_petname">Petname</string> 317 <string name="contacts_title">Contacts</string> 318 + <!-- Contacts --> 319 + <string name="contacts_send_title">Send to Contact</string> 320 + <string name="contacts_add">Add Contact</string> 321 + <string name="contacts_search">Search contacts…</string> 322 + <string name="contacts_empty">No contacts yet.</string> 323 + <string name="contacts_error">Error: %1$s</string> 324 + <string name="contacts_send_confirm_title">Send to %1$s</string> 325 + <string name="contacts_send_confirm_message">Are you sure you want to send this to %1$s?</string> 326 + <string name="contacts_petname">Petname</string> 327 + <string name="contacts_alias">Alias</string> 328 + <string name="contacts_alias_type">Alias Type</string> 329 + <string name="contacts_mailbox">Mailbox</string> 330 + <string name="contacts_lookup_taldir">Lookup with Taldir</string> 331 + <string name="contacts_lookup_failed">Lookup failed: %1$s</string> 332 + <string name="contacts_duplicate">A contact with this alias and type already exists.</string> 333 + <!-- Mailbox --> 334 + <string name="mailbox_title">Mailbox</string> 335 + <string name="mailbox_summary">P2P Messaging</string> 336 + <string name="mailbox_show_address">Show Mailbox Address</string> 337 + <string name="mailbox_configure">Configure Mailbox</string> 338 + <string name="mailbox_refresh">Refresh</string> 339 + <string name="mailbox_error">Error: %1$s</string> 340 + <string name="mailbox_your_address">Your Mailbox Address</string> 341 + <string name="mailbox_address_copied">Mailbox address URI copied to clipboard</string> 342 + <string name="mailbox_configure_url">Configure Mailbox URL</string> 343 + <string name="mailbox_base_url">Mailbox Base URL</string> 344 + <string name="mailbox_empty">No messages yet.</string> 345 + <string name="mailbox_accept_payment">Accept payment</string> 346 + <string name="mailbox_pay_invoice">Pay invoice</string> 347 + <string name="mailbox_from">From: %1$s</string> 348 + <string name="mailbox_received">Received: %1$s</string> 349 + <!-- Settings entries for the two above --> 350 + <string name="settings_contacts_summary">Manage the people you send to</string> 351 + <string name="settings_taldir_summary">Taldir Registration</string> 352 353 <!-- Settings --> 354