Add localizations
This commit is contained in:
parent
1f230c0a63
commit
a776ac1513
28 changed files with 3406 additions and 249 deletions
|
|
@ -3,6 +3,7 @@ import 'dart:math';
|
|||
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/views/login.dart';
|
||||
import 'package:fluffychat/views/sign_up_password.dart';
|
||||
|
|
@ -37,7 +38,7 @@ class _SignUpState extends State<SignUp> {
|
|||
void signUpAction(BuildContext context) async {
|
||||
MatrixState matrix = Matrix.of(context);
|
||||
if (usernameController.text.isEmpty) {
|
||||
setState(() => usernameError = "Please choose a username.");
|
||||
setState(() => usernameError = I18n.of(context).pleaseChooseAUsername);
|
||||
} else {
|
||||
setState(() => usernameError = null);
|
||||
}
|
||||
|
|
@ -60,12 +61,13 @@ class _SignUpState extends State<SignUp> {
|
|||
print("[Sign Up] Check server...");
|
||||
setState(() => loading = true);
|
||||
if (!await matrix.client.checkServer(homeserver)) {
|
||||
setState(() => serverError = "Homeserver is not compatible.");
|
||||
setState(
|
||||
() => serverError = I18n.of(context).homeserverIsNotCompatible);
|
||||
|
||||
return setState(() => loading = false);
|
||||
}
|
||||
} catch (exception) {
|
||||
setState(() => serverError = "Connection attempt failed!");
|
||||
setState(() => serverError = I18n.of(context).connectionAttemptFailed);
|
||||
return setState(() => loading = false);
|
||||
}
|
||||
|
||||
|
|
@ -94,6 +96,7 @@ class _SignUpState extends State<SignUp> {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: TextField(
|
||||
autocorrect: false,
|
||||
controller: serverController,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(Icons.domain),
|
||||
|
|
@ -125,8 +128,9 @@ class _SignUpState extends State<SignUp> {
|
|||
Icons.close,
|
||||
color: Colors.red,
|
||||
),
|
||||
title: Text(
|
||||
avatar == null ? "Set a profile picture" : "Discard picture"),
|
||||
title: Text(avatar == null
|
||||
? I18n.of(context).setAProfilePicture
|
||||
: I18n.of(context).discardPicture),
|
||||
onTap: avatar == null
|
||||
? setAvatarAction
|
||||
: () => setState(() => avatar = null),
|
||||
|
|
@ -137,12 +141,13 @@ class _SignUpState extends State<SignUp> {
|
|||
child: Icon(Icons.account_box),
|
||||
),
|
||||
title: TextField(
|
||||
autocorrect: false,
|
||||
controller: usernameController,
|
||||
onSubmitted: (s) => signUpAction(context),
|
||||
decoration: InputDecoration(
|
||||
hintText: "Username",
|
||||
hintText: I18n.of(context).username,
|
||||
errorText: usernameError,
|
||||
labelText: "Choose a username"),
|
||||
labelText: I18n.of(context).chooseAUsername),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
|
|
@ -157,7 +162,7 @@ class _SignUpState extends State<SignUp> {
|
|||
child: loading
|
||||
? CircularProgressIndicator()
|
||||
: Text(
|
||||
"Sign up",
|
||||
I18n.of(context).signUp,
|
||||
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||
),
|
||||
onPressed: () => signUpAction(context),
|
||||
|
|
@ -166,7 +171,7 @@ class _SignUpState extends State<SignUp> {
|
|||
Center(
|
||||
child: FlatButton(
|
||||
child: Text(
|
||||
"Already have an account?",
|
||||
I18n.of(context).alreadyHaveAnAccount,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: Colors.blue,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue