BASE: Initialize Localization.

This commit is contained in:
2025-12-03 18:21:19 +05:00
parent cf58d069ab
commit b04050384d
141 changed files with 1577 additions and 1419 deletions

View File

@@ -3,6 +3,7 @@ import 'package:customer/service/localization_service.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:customer/themes/easy_loading_config.dart';
import 'package:customer/utils/preferences.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
@@ -14,6 +15,7 @@ import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
await Firebase.initializeApp(
name: 'default',
options: DefaultFirebaseOptions.currentPlatform,
@@ -24,7 +26,18 @@ void main() async {
Get.put(ThemeController());
await configEasyLoading();
runApp(MyApp());
runApp(
EasyLocalization(
supportedLocales: [
Locale('en', 'US'),
Locale('uz', 'UZ'),
Locale('ru', 'RU'),
],
path: 'assets/translations',
fallbackLocale: Locale('en', 'US'),
child: MyApp(),
),
);
}
class MyApp extends StatelessWidget {
@@ -41,6 +54,9 @@ class MyApp extends StatelessWidget {
minTextAdapt: true,
splitScreenMode: true,
child: GetMaterialApp(
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
debugShowCheckedModeBanner: false,
builder: (context, child) {
return SafeArea(
@@ -50,7 +66,6 @@ class MyApp extends StatelessWidget {
);
},
translations: LocalizationService(),
locale: LocalizationService.locale,
fallbackLocale: LocalizationService.locale,
themeMode: themeController.themeMode,
theme: ThemeData(