Language Change

This commit is contained in:
Nilanjan Chakrabarti
2025-07-10 13:19:31 +05:30
parent 9b439338a9
commit d4de89a91f
22 changed files with 334 additions and 227 deletions

View File

@@ -1,3 +1,5 @@
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'package:kmobile/api/services/auth_service.dart';
import 'package:kmobile/di/injection.dart';
@@ -53,7 +55,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
await authService.setTpin(pin);
} catch (e) {
setState(() {
_errorText = "Failed to set TPIN. Please try again.";
_errorText = "${AppLocalizations.of(context).tpinFailed}";
_tpin.clear();
});
return;
@@ -66,15 +68,16 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
builder: (ctx) => AlertDialog(
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(18)),
title: const Column(
title: Column(
children: [
Icon(Icons.check_circle, color: Colors.green, size: 60),
SizedBox(height: 12),
Text('Success!', style: TextStyle(fontWeight: FontWeight.bold)),
Text(AppLocalizations.of(context).success,
style: TextStyle(fontWeight: FontWeight.bold)),
],
),
content: const Text(
'Your TPIN was set up successfully.',
content: Text(
AppLocalizations.of(context).tpinSetSuccess,
textAlign: TextAlign.center,
),
actions: [
@@ -82,7 +85,8 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
onPressed: () {
Navigator.of(ctx).pop();
},
child: const Text('OK', style: TextStyle(fontSize: 16)),
child: Text(AppLocalizations.of(context).ok,
style: TextStyle(fontSize: 16)),
),
],
),
@@ -92,7 +96,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
}
} else {
setState(() {
_errorText = "Pins do not match. Try again.";
_errorText = AppLocalizations.of(context).pinsMismatchRetry;
_tpin.clear();
});
}
@@ -140,7 +144,8 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
_handleComplete();
} else {
setState(() {
_errorText = "Please enter 6 digits";
_errorText =
AppLocalizations.of(context).pleaseEnter6Digits;
});
}
} else if (key.isNotEmpty) {
@@ -176,16 +181,16 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
String getTitle() {
switch (_mode) {
case TPinMode.set:
return "Set your new TPIN";
return AppLocalizations.of(context).setNewTpin;
case TPinMode.confirm:
return "Confirm your new TPIN";
return AppLocalizations.of(context).confirmNewTpin;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Set TPIN')),
appBar: AppBar(title: Text(AppLocalizations.of(context).setTpin)),
body: SafeArea(
child: Column(
children: [