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:flutter_bloc/flutter_bloc.dart';
import 'package:kmobile/di/injection.dart';
@@ -110,8 +112,8 @@ class LoginScreenState extends State<LoginScreen>
),
const SizedBox(height: 16),
// Title
const Text(
'KCCB',
Text(
AppLocalizations.of(context).kccb,
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
@@ -121,8 +123,8 @@ class LoginScreenState extends State<LoginScreen>
TextFormField(
controller: _customerNumberController,
decoration: const InputDecoration(
labelText: 'Customer Number',
decoration: InputDecoration(
labelText: AppLocalizations.of(context).customerNumber,
// prefixIcon: Icon(Icons.person),
border: OutlineInputBorder(),
isDense: true,
@@ -139,7 +141,7 @@ class LoginScreenState extends State<LoginScreen>
textInputAction: TextInputAction.next,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your username';
return AppLocalizations.of(context).pleaseEnterUsername;
}
return null;
},
@@ -153,7 +155,7 @@ class LoginScreenState extends State<LoginScreen>
onFieldSubmitted: (_) =>
_submitForm(), // ⌨️ Enter key submits
decoration: InputDecoration(
labelText: 'Password',
labelText: AppLocalizations.of(context).password,
border: const OutlineInputBorder(),
isDense: true,
filled: true,
@@ -179,7 +181,7 @@ class LoginScreenState extends State<LoginScreen>
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your password';
return AppLocalizations.of(context).pleaseEnterPassword;
}
return null;
},
@@ -200,22 +202,22 @@ class LoginScreenState extends State<LoginScreen>
),
child: state is AuthLoading
? const CircularProgressIndicator()
: const Text(
"Login",
: Text(
AppLocalizations.of(context).login,
style: TextStyle(fontSize: 16),
),
),
),
const SizedBox(height: 15),
const Padding(
Padding(
padding: EdgeInsets.symmetric(vertical: 16),
child: Row(
children: [
Expanded(child: Divider()),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Text('OR'),
child: Text(AppLocalizations.of(context).or),
),
Expanded(child: Divider()),
],
@@ -235,7 +237,7 @@ class LoginScreenState extends State<LoginScreen>
padding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Colors.lightBlue[100],
foregroundColor: Colors.black),
child: const Text('Register'),
child: Text(AppLocalizations.of(context).register),
),
),
],
@@ -471,4 +473,4 @@ class LoginScreenState extends State<LoginScreen> {
);
}
}
*/
*/

View File

@@ -1,3 +1,5 @@
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'dart:developer';
import 'package:flutter/material.dart';
@@ -44,7 +46,7 @@ class _MPinScreenState extends State<MPinScreen> {
final auth = LocalAuthentication();
if (await auth.canCheckBiometrics) {
final didAuth = await auth.authenticate(
localizedReason: 'Authenticate to access kMobile',
localizedReason: AppLocalizations.of(context).authenticateToAccess,
options: const AuthenticationOptions(biometricOnly: true),
);
if (didAuth && mounted) {
@@ -91,7 +93,7 @@ class _MPinScreenState extends State<MPinScreen> {
widget.onCompleted?.call(pin);
} else {
setState(() {
errorText = "Incorrect mPIN. Try again.";
errorText = AppLocalizations.of(context).incorrectMPIN;
mPin.clear();
});
}
@@ -123,7 +125,7 @@ class _MPinScreenState extends State<MPinScreen> {
}
} else {
setState(() {
errorText = "Pins do not match. Try again.";
errorText = AppLocalizations.of(context).pinsDoNotMatch;
mPin.clear();
});
}
@@ -172,7 +174,8 @@ class _MPinScreenState extends State<MPinScreen> {
_handleComplete();
} else {
setState(() {
errorText = "Please enter 4 digits";
errorText =
AppLocalizations.of(context).pleaseEnter4Digits;
});
}
} else if (key.isNotEmpty) {
@@ -208,11 +211,11 @@ class _MPinScreenState extends State<MPinScreen> {
String getTitle() {
switch (widget.mode) {
case MPinMode.enter:
return "Enter your mPIN";
return AppLocalizations.of(context).enterMPIN;
case MPinMode.set:
return "Set your new mPIN";
return AppLocalizations.of(context).setMPIN;
case MPinMode.confirm:
return "Confirm your mPIN";
return AppLocalizations.of(context).confirmMPIN;
}
}

View File

@@ -1,3 +1,5 @@
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'dart:async';
@@ -38,9 +40,9 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: const [
children: [
Text(
'Kconnect',
AppLocalizations.of(context).kconnect,
style: TextStyle(
fontSize: 36,
fontWeight: FontWeight.bold,
@@ -50,7 +52,7 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
),
SizedBox(height: 12),
Text(
'Kangra Central Co-operative Bank',
AppLocalizations.of(context).kccBankFull,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,