feat: localize bootstrap

This commit is contained in:
Christian Pauly 2021-02-13 14:33:43 +01:00
parent e4db84a798
commit 395e62e96a
4 changed files with 63 additions and 16 deletions

View File

@ -66,9 +66,8 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
titleText = widget.l10n.loadingPleaseWait;
if (bootstrap == null) {
titleText = 'Chat backup';
body = Text(
'To make sure that only you have access to your encrypted messages, we have generated a security key for you.');
titleText = widget.l10n.chatBackup;
body = Text(widget.l10n.chatBackupDescription);
buttons.add(AdaptiveFlatButton(
child: Text(widget.l10n.next),
onPressed: () => _createBootstrap(false),
@ -76,7 +75,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
} else if (bootstrap.newSsssKey?.recoveryKey != null &&
_recoveryKeyStored == false) {
final key = bootstrap.newSsssKey.recoveryKey;
titleText = 'Security key';
titleText = widget.l10n.securityKey;
body = Container(
alignment: Alignment.center,
width: 200,
@ -91,7 +90,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
),
);
buttons.add(AdaptiveFlatButton(
child: Text('Copy to clipboard'),
child: Text(widget.l10n.copyToClipboard),
onPressed: () => Clipboard.setData(ClipboardData(text: key)),
));
buttons.add(AdaptiveFlatButton(
@ -122,7 +121,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
case BootstrapState.openExistingSsss:
_recoveryKeyStored = true;
titleText =
_recoveryKeyInputError ?? 'Please enter your security key!';
_recoveryKeyInputError ?? widget.l10n.pleaseEnterSecurityKey;
body = PlatformInfos.isCupertinoStyle
? CupertinoTextField(
minLines: 2,
@ -151,9 +150,8 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
if (OkCancelResult.ok ==
await showOkCancelAlertDialog(
context: context,
title: 'Lost security key',
message:
'Wipe your chat backup to create a new security key?',
title: widget.l10n.securityKeyLost,
message: widget.l10n.wipeChatBackup,
isDestructiveAction: true,
)) {
_createBootstrap(true);
@ -161,7 +159,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
},
));
buttons.add(AdaptiveFlatButton(
child: Text('Transfer from another device'),
child: Text(widget.l10n.transferFromAnotherDevice),
onPressed: () async {
final req = await widget
.client.userDeviceKeys[widget.client.userID]
@ -202,7 +200,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
} catch (e, s) {
Logs().w('Unable to unlock SSSS', e, s);
setState(() => _recoveryKeyInputError =
L10n.of(context).oopsSomethingWentWrong);
widget.l10n.oopsSomethingWentWrong);
} finally {
setState(() => _recoveryKeyInputLoading = false);
}
@ -247,11 +245,11 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
));
break;
case BootstrapState.done:
titleText = 'Process completed';
titleText = L10n.of(context).everythingReady;
body = ListTile(
contentPadding: EdgeInsets.zero,
leading: Icon(Icons.check_circle, color: Colors.green),
title: Text('Chat backup has been initialized!'),
title: Text(L10n.of(context).keysCached),
);
buttons.add(AdaptiveFlatButton(
child: Text(widget.l10n.close),

View File

@ -404,11 +404,21 @@
"type": "text",
"placeholders": {}
},
"securityKey": "Security key",
"@securityKey": {
"type": "text",
"placeholders": {}
},
"copy": "Copy",
"@copy": {
"type": "text",
"placeholders": {}
},
"copyToClipboard": "Copy to clipboard",
"@copyToClipboard": {
"type": "text",
"placeholders": {}
},
"couldNotDecryptMessage": "Could not decrypt message: {error}",
"@couldNotDecryptMessage": {
"type": "text",
@ -438,6 +448,36 @@
"type": "text",
"placeholders": {}
},
"chatBackup": "Chat backup",
"@chatBackup": {
"type": "text",
"placeholders": {}
},
"securityKeyLost": "Security key lost?",
"@securityKeyLost": {
"type": "text",
"placeholders": {}
},
"everythingReady": "Everything ready!",
"@everythingReady": {
"type": "text",
"placeholders": {}
},
"transferFromAnotherDevice": "Transfer from another device",
"@transferFromAnotherDevice": {
"type": "text",
"placeholders": {}
},
"pleaseEnterSecurityKey": "Please enter your security key",
"@pleaseEnterSecurityKey": {
"type": "text",
"placeholders": {}
},
"chatBackupDescription": "Your chat backup is secured with a security key. Please make sure you don't lose it.",
"@chatBackupDescription": {
"type": "text",
"placeholders": {}
},
"createAccountNow": "Create account now",
"@createAccountNow": {
"type": "text",
@ -2107,6 +2147,16 @@
"type": "text",
"placeholders": {}
},
"fontSize": "Font size",
"@fontSize": {
"type": "text",
"placeholders": {}
},
"wipeChatBackup": "Wipe your chat backup to create a new security key?",
"@wipeChatBackup": {
"type": "text",
"placeholders": {}
},
"userUnknownVerification": "User has an unknown verification status",
"@userUnknownVerification": {
"type": "text",

View File

@ -510,8 +510,7 @@ class _SettingsState extends State<Settings> {
await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).keysCached,
message:
'Wipe your chat backup to create a new security key?',
message: L10n.of(context).wipeChatBackup,
isDestructiveAction: true,
)) {
return BootstrapDialog(

View File

@ -109,7 +109,7 @@ class _SettingsStyleState extends State<SettingsStyle> {
Divider(height: 1),
ListTile(
title: Text(
'Font size',
L10n.of(context).fontSize,
style: TextStyle(
color: Theme.of(context).accentColor,
fontWeight: FontWeight.bold,