feat(ui): Localise more pages

This commit is contained in:
PapaTutuWawa 2022-11-17 21:33:00 +01:00
parent 1e3fc9be3d
commit a30b8f888d
9 changed files with 111 additions and 30 deletions

View File

@ -6,12 +6,50 @@
"loginButton": "Login",
"registerButton": "Register"
},
"login": {
"title": "Login",
"xmppAddress": "XMPP-Address",
"password": "Password",
"advancedOptions": "Advanced options",
"createAccount": "Create account on server"
},
"conversations": {
"speeddialNewChat": "New chat",
"speeddialJoinGroupchat": "Join groupchat",
"overlaySettings": "Settings",
"noOpenChats": "You have no open chats",
"startChat": "Start a chat"
},
"addcontact": {
"title": "Add new contact",
"xmppAddress": "XMPP-Address",
"subtitle": "You can add a contact either by typing in their XMPP address or by scanning their QR code",
"buttonAddToContact": "Add to contacts"
},
"newconversation": {
"title": "Start new chat",
"addContact": "Add contact",
"createGroupchat": "Create groupchat"
},
"crop": {
"setProfilePicture": "Set as profile picture"
},
"shareselection": {
"shareWith": "Share with...",
"confirmTitle": "Send file",
"confirmBody": "One or more chats are unencrypted. This means that the file will be leaked to the server. Do you still want to continue?"
},
"profile": {
"self": {
"devices": "Devices"
},
"conversation": {
"muteChatTooltip": "Mute chat",
"unmuteChatTooltip": "Unmute chat",
"muteChat": "Mute",
"unmuteChat": "Unmute",
"devices": "Devices"
}
}
}
}

View File

@ -6,12 +6,50 @@
"loginButton": "Einloggen",
"registerButton": "Registrieren"
},
"login": {
"title": "Login",
"xmppAddress": "XMPP-Adresse",
"password": "Passwort",
"advancedOptions": "Fortgeschrittene Optionen",
"createAccount": "Account auf dem Server erstellen"
},
"conversations": {
"speeddialNewChat": "Neuer chat",
"speeddialJoinGroupchat": "Gruppenchat beitreten",
"overlaySettings": "Einstellungen",
"noOpenChats": "Du hast keine offenen chats",
"startChat": "Einen chat anfangen"
},
"addcontact": {
"title": "Neuen Kontakt hinzufügen",
"xmppAddress": "XMPP-Adresse",
"subtitle": "Du kannst einen Kontakt hinzufügen, indem Du entweder die XMPP-Adresse eingibst oder den QR-Code deines Kontaktes scannst",
"buttonAddToContact": "Kontakt hinzufügen"
},
"newconversation": {
"title": "Neuer chat",
"addContact": "Kontakt hinzufügen",
"createGroupchat": "Gruppenchat erstellen"
},
"crop": {
"setProfilePicture": "Als Profilbild festlegen"
},
"shareselection": {
"shareWith": "Teilen mit...",
"confirmTitle": "Dateien senden?",
"confirmTitle": "Einer oder mehr Chats sind unverschlüsselt. Das bedeutet, dass die Dateien dem Server unverschlüsselt vorliegen. Dateien trotzdem senden?"
},
"profile": {
"self": {
"devices": "Geräte"
},
"conversation": {
"muteChatTooltip": "Chat stummschalten",
"unmuteChatTooltip": "Chat lautstellen",
"muteChat": "Stummschalten",
"unmuteChat": "Lautstellen",
"devices": "Geräte"
}
}
}
}

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/ui/bloc/addcontact_bloc.dart';
import 'package:moxxyv2/ui/constants.dart';
import 'package:moxxyv2/ui/helpers.dart';
@ -21,7 +22,7 @@ class AddContactPage extends StatelessWidget {
Widget build(BuildContext context) {
return BlocBuilder<AddContactBloc, AddContactState>(
builder: (context, state) => Scaffold(
appBar: BorderlessTopbar.simple('Add new contact'),
appBar: BorderlessTopbar.simple(t.pages.addcontact.title),
body: Column(
children: [
Visibility(
@ -32,7 +33,7 @@ class AddContactPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: paddingVeryLarge).add(const EdgeInsets.only(top: 8)),
child: CustomTextField(
labelText: 'XMPP-Address',
labelText: t.pages.addcontact.xmppAddress,
onChanged: (value) => context.read<AddContactBloc>().add(
JidChangedEvent(value),
),
@ -52,9 +53,7 @@ class AddContactPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: paddingVeryLarge).add(const EdgeInsets.only(top: 8)),
child: const Text(
'You can add a contact either by typing in their XMPP address or by scanning their QR code',
),
child: Text(t.pages.addcontact.subtitle),
),
Padding(
@ -66,7 +65,7 @@ class AddContactPage extends StatelessWidget {
cornerRadius: 32,
onTap: () => context.read<AddContactBloc>().add(AddedContactEvent()),
enabled: !state.working,
child: const Text('Add to contacts'),
child: Text(t.pages.addcontact.buttonAddToContact),
),
)
],

View File

@ -1,6 +1,7 @@
import 'package:crop_your_image/crop_your_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/ui/bloc/crop_bloc.dart';
import 'package:moxxyv2/ui/constants.dart';
import 'package:moxxyv2/ui/widgets/button.dart';
@ -60,7 +61,7 @@ class CropPage extends StatelessWidget {
RoundedButton(
cornerRadius: 100,
onTap: _controller.crop,
child: const Text('Set as profile picture'),
child: Text(t.pages.crop.setProfilePicture),
),
],
),

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/ui/bloc/login_bloc.dart';
import 'package:moxxyv2/ui/constants.dart';
import 'package:moxxyv2/ui/widgets/button.dart';
@ -21,7 +22,7 @@ class Login extends StatelessWidget {
builder: (BuildContext context, LoginState state) => WillPopScope(
onWillPop: () async => !state.working,
child: Scaffold(
appBar: BorderlessTopbar.simple('Login'),
appBar: BorderlessTopbar.simple(t.pages.login.title),
body: Column(
children: [
Visibility(
@ -35,7 +36,7 @@ class Login extends StatelessWidget {
child: CustomTextField(
// ignore: avoid_dynamic_calls
errorText: state.jidState.error,
labelText: 'XMPP-Address',
labelText: t.pages.login.xmppAddress,
enabled: !state.working,
cornerRadius: textfieldRadiusRegular,
borderColor: primaryColor,
@ -49,7 +50,7 @@ class Login extends StatelessWidget {
child: CustomTextField(
// ignore: avoid_dynamic_calls
errorText: state.passwordState.error,
labelText: 'Password',
labelText: t.pages.login.password,
suffixIcon: Padding(
padding: const EdgeInsetsDirectional.only(end: 8),
child: InkWell(
@ -71,12 +72,12 @@ class Login extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: paddingVeryLarge).add(const EdgeInsets.only(top: 8)),
child: ExpansionTile(
title: const Text('Advanced options'),
title: Text(t.pages.login.advancedOptions),
children: [
Column(
children: [
SwitchListTile(
title: const Text('Create account on server'),
title: Text(t.pages.login.createAccount),
value: false,
// TODO(Unknown): Implement
onChanged: state.working ? null : (value) {},

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/shared/constants.dart';
import 'package:moxxyv2/ui/bloc/newconversation_bloc.dart';
import 'package:moxxyv2/ui/constants.dart';
@ -49,7 +50,7 @@ class NewConversationPage extends StatelessWidget {
Widget build(BuildContext context) {
final maxTextWidth = MediaQuery.of(context).size.width * 0.6;
return Scaffold(
appBar: BorderlessTopbar.simple('Start new chat'),
appBar: BorderlessTopbar.simple(t.pages.newconversation.title),
body: BlocBuilder<NewConversationBloc, NewConversationState>(
builder: (BuildContext context, NewConversationState state) => ListView.builder(
itemCount: state.roster.length + 2,
@ -57,12 +58,12 @@ class NewConversationPage extends StatelessWidget {
switch(index) {
case 0: return _renderIconEntry(
Icons.person_add,
'Add contact',
t.pages.newconversation.addContact,
() => Navigator.pushNamed(context, addContactRoute),
);
case 1: return _renderIconEntry(
Icons.group_add,
'Create groupchat',
t.pages.newconversation.createGroupchat,
() => showNotImplementedDialog('groupchat', context),
);
default:

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/shared/models/conversation.dart';
import 'package:moxxyv2/ui/bloc/devices_bloc.dart';
import 'package:moxxyv2/ui/bloc/profile_bloc.dart';
@ -55,8 +56,8 @@ class ConversationProfileHeader extends StatelessWidget {
children: [
Tooltip(
message: conversation.muted ?
'Unmute chat' :
'Mute chat',
t.pages.profile.conversation.unmuteChatTooltip :
t.pages.profile.conversation.muteChatTooltip,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
@ -84,8 +85,8 @@ class ConversationProfileHeader extends StatelessWidget {
),
Text(
conversation.muted ?
'Unmute' :
'Mute',
t.pages.profile.conversation.unmuteChat :
t.pages.profile.conversation.muteChat,
style: const TextStyle(
fontSize: fontsizeAppbar,
),
@ -95,7 +96,7 @@ class ConversationProfileHeader extends StatelessWidget {
),
// TODO(PapaTutuWawa): Only show when the chat partner has OMEMO keys
Tooltip(
message: 'Devices',
message: t.pages.profile.conversation.devices,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@ -114,9 +115,9 @@ class ConversationProfileHeader extends StatelessWidget {
GetIt.I.get<DevicesBloc>().add(DevicesRequestedEvent(conversation.jid));
},
),
const Text(
'Devices',
style: TextStyle(
Text(
t.pages.profile.conversation.devices,
style: const TextStyle(
fontSize: fontsizeAppbar,
),
),

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/ui/bloc/own_devices_bloc.dart';
import 'package:moxxyv2/ui/constants.dart';
import 'package:moxxyv2/ui/helpers.dart';
@ -111,7 +112,7 @@ class SelfProfileHeader extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Tooltip(
message: 'Devices',
message: t.pages.profile.self.devices,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@ -130,9 +131,9 @@ class SelfProfileHeader extends StatelessWidget {
GetIt.I.get<OwnDevicesBloc>().add(OwnDevicesRequestedEvent());
},
),
const Text(
'Devices',
style: TextStyle(
Text(
t.pages.profile.self.devices,
style: const TextStyle(
fontSize: fontsizeAppbar,
),
),

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';
import 'package:move_to_background/move_to_background.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/shared/constants.dart';
import 'package:moxxyv2/ui/bloc/navigation_bloc.dart' as navigation;
import 'package:moxxyv2/ui/bloc/share_selection_bloc.dart';
@ -53,7 +54,7 @@ class ShareSelectionPage extends StatelessWidget {
child: BlocBuilder<ShareSelectionBloc, ShareSelectionState>(
buildWhen: _buildWhen,
builder: (context, state) => Scaffold(
appBar: BorderlessTopbar.simple('Share with...'),
appBar: BorderlessTopbar.simple(t.pages.shareselection.shareWith),
body: ListView.builder(
itemCount: state.items.length,
itemBuilder: (context, index) {
@ -101,8 +102,8 @@ class ShareSelectionPage extends StatelessWidget {
// Warn the user
if (hasUnencrypted && hasEncrypted) {
showConfirmationDialog(
'Send file',
'One or more chats are unencrypted. This means that the file will be leaked to the server. Do you still want to continue?',
t.pages.shareselection.confirmTitle,
t.pages.shareselection.confirmBody,
context,
() {
bloc.add(SubmittedEvent());