@@ -141,7 +141,7 @@ class _AddAccountPageState extends State<AddAccountPage> {
141
141
final error = _parseResult.error;
142
142
if (error != null ) {
143
143
showErrorDialog (context: context,
144
- title: 'Invalid input' ,
144
+ title: zulipLocalizations.errorLoginInvalidInputTitle ,
145
145
message: error.message (zulipLocalizations));
146
146
return ;
147
147
}
@@ -161,7 +161,8 @@ class _AddAccountPageState extends State<AddAccountPage> {
161
161
// TODO(#105) give more helpful feedback; see `fetchServerSettings`
162
162
// in zulip-mobile's src/message/fetchActions.js.
163
163
showErrorDialog (context: context,
164
- title: 'Could not connect' , message: 'Failed to connect to server:\n $url ' );
164
+ title: zulipLocalizations.errorLoginCouldNotConnectTitle,
165
+ message: zulipLocalizations.errorLoginCouldNotConnect (url.toString ()));
165
166
return ;
166
167
}
167
168
// https://github.com/dart-lang/linter/issues/4007
@@ -190,7 +191,7 @@ class _AddAccountPageState extends State<AddAccountPage> {
190
191
: error.message (zulipLocalizations);
191
192
192
193
return Scaffold (
193
- appBar: AppBar (title: const Text ('Add an account' ),
194
+ appBar: AppBar (title: Text (zulipLocalizations.loginAddAnAccount ),
194
195
bottom: _inProgress
195
196
? const PreferredSize (preferredSize: Size .fromHeight (4 ),
196
197
child: LinearProgressIndicator (minHeight: 4 )) // 4 restates default
@@ -215,7 +216,7 @@ class _AddAccountPageState extends State<AddAccountPage> {
215
216
// …but leave out unfocusing the input in case more editing is needed.
216
217
},
217
218
decoration: InputDecoration (
218
- labelText: 'Your Zulip server URL' ,
219
+ labelText: zulipLocalizations.loginServerUrlInputLabel ,
219
220
errorText: errorText,
220
221
helperText: kLayoutPinningHelperText,
221
222
hintText: 'your-org.zulipchat.com' )),
@@ -224,7 +225,7 @@ class _AddAccountPageState extends State<AddAccountPage> {
224
225
onPressed: ! _inProgress && errorText == null
225
226
? () => _onSubmitted (context)
226
227
: null ,
227
- child: const Text ('Continue' )),
228
+ child: Text (zulipLocalizations.dialogContinue )),
228
229
])))));
229
230
}
230
231
}
@@ -293,10 +294,13 @@ class _PasswordLoginPageState extends State<PasswordLoginPage> {
293
294
// TODO(#105) give more helpful feedback. The RN app is
294
295
// unhelpful here; we should at least recognize invalid auth errors, and
295
296
// errors for deactivated user or realm (see zulip-mobile#4571).
297
+ final zulipLocalizations = ZulipLocalizations .of (context);
296
298
final message = (e is ZulipApiException )
297
- ? 'The server said: \n\n ${ e .message }'
299
+ ? zulipLocalizations. errorServerMessage ( e.message)
298
300
: e.message;
299
- showErrorDialog (context: context, title: 'Login failed' , message: message);
301
+ showErrorDialog (context: context,
302
+ title: zulipLocalizations.errorLoginFailed,
303
+ message: message);
300
304
return ;
301
305
}
302
306
@@ -339,6 +343,7 @@ class _PasswordLoginPageState extends State<PasswordLoginPage> {
339
343
@override
340
344
Widget build (BuildContext context) {
341
345
assert (! PerAccountStoreWidget .debugExistsOf (context));
346
+ final zulipLocalizations = ZulipLocalizations .of (context);
342
347
final requireEmailFormatUsernames = widget.serverSettings.requireEmailFormatUsernames;
343
348
344
349
final usernameField = TextFormField (
@@ -354,8 +359,8 @@ class _PasswordLoginPageState extends State<PasswordLoginPage> {
354
359
validator: (value) {
355
360
if (value == null || value.trim ().isEmpty) {
356
361
return requireEmailFormatUsernames
357
- ? 'Please enter your email.'
358
- : 'Please enter your username.' ;
362
+ ? zulipLocalizations.loginErrorMissingEmail
363
+ : zulipLocalizations.loginErrorMissingUsername ;
359
364
}
360
365
if (requireEmailFormatUsernames) {
361
366
// TODO(#106): validate is in the shape of an email
@@ -364,7 +369,9 @@ class _PasswordLoginPageState extends State<PasswordLoginPage> {
364
369
},
365
370
textInputAction: TextInputAction .next,
366
371
decoration: InputDecoration (
367
- labelText: requireEmailFormatUsernames ? 'Email address' : 'Username' ,
372
+ labelText: requireEmailFormatUsernames
373
+ ? zulipLocalizations.loginEmailLabel
374
+ : zulipLocalizations.loginUsernameLabel,
368
375
helperText: kLayoutPinningHelperText,
369
376
));
370
377
@@ -376,14 +383,14 @@ class _PasswordLoginPageState extends State<PasswordLoginPage> {
376
383
autovalidateMode: AutovalidateMode .onUserInteraction,
377
384
validator: (value) {
378
385
if (value == null || value.isEmpty) {
379
- return 'Please enter your password.' ;
386
+ return zulipLocalizations.loginErrorMissingPassword ;
380
387
}
381
388
return null ;
382
389
},
383
390
textInputAction: TextInputAction .go,
384
391
onFieldSubmitted: (value) => _submit (),
385
392
decoration: InputDecoration (
386
- labelText: 'Password' ,
393
+ labelText: zulipLocalizations.loginPasswordLabel ,
387
394
helperText: kLayoutPinningHelperText,
388
395
// TODO(material-3): Simplify away `Semantics` by using IconButton's
389
396
// M3-only params `isSelected` / `selectedIcon`, after fixing
@@ -393,14 +400,14 @@ class _PasswordLoginPageState extends State<PasswordLoginPage> {
393
400
// [ButtonStyleButton].)
394
401
suffixIcon: Semantics (toggled: _obscurePassword,
395
402
child: IconButton (
396
- tooltip: 'Hide password' ,
403
+ tooltip: zulipLocalizations.loginHidePassword ,
397
404
onPressed: _handlePasswordVisibilityPress,
398
405
icon: _obscurePassword
399
406
? const Icon (Icons .visibility_off)
400
407
: const Icon (Icons .visibility)))));
401
408
402
409
return Scaffold (
403
- appBar: AppBar (title: const Text ('Log in' ),
410
+ appBar: AppBar (title: Text (zulipLocalizations.loginPageTitle ),
404
411
bottom: _inProgress
405
412
? const PreferredSize (preferredSize: Size .fromHeight (4 ),
406
413
child: LinearProgressIndicator (minHeight: 4 )) // 4 restates default
@@ -420,7 +427,7 @@ class _PasswordLoginPageState extends State<PasswordLoginPage> {
420
427
const SizedBox (height: 8 ),
421
428
ElevatedButton (
422
429
onPressed: _inProgress ? null : _submit,
423
- child: const Text ('Log in' )),
430
+ child: Text (zulipLocalizations.loginFormSubmitLabel )),
424
431
])))))));
425
432
}
426
433
}
0 commit comments