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

View File

@ -404,11 +404,21 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"securityKey": "Security key",
"@securityKey": {
"type": "text",
"placeholders": {}
},
"copy": "Copy", "copy": "Copy",
"@copy": { "@copy": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"copyToClipboard": "Copy to clipboard",
"@copyToClipboard": {
"type": "text",
"placeholders": {}
},
"couldNotDecryptMessage": "Could not decrypt message: {error}", "couldNotDecryptMessage": "Could not decrypt message: {error}",
"@couldNotDecryptMessage": { "@couldNotDecryptMessage": {
"type": "text", "type": "text",
@ -438,6 +448,36 @@
"type": "text", "type": "text",
"placeholders": {} "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": "Create account now",
"@createAccountNow": { "@createAccountNow": {
"type": "text", "type": "text",
@ -2107,6 +2147,16 @@
"type": "text", "type": "text",
"placeholders": {} "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": "User has an unknown verification status",
"@userUnknownVerification": { "@userUnknownVerification": {
"type": "text", "type": "text",

View File

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

View File

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