From 297f7c368b0913b471a165b7eb1ec490e3bcd52b Mon Sep 17 00:00:00 2001 From: Abdusalom G'ayratov Date: Tue, 9 Dec 2025 19:06:51 +0500 Subject: [PATCH] BASE: Implement Localization. --- assets/translations/en.json | 7 +++- lib/constant/const_texts.dart | 20 ++++++++++ .../dash_board_e_commerce_screen.dart | 19 +++++----- .../dine_in_screeen/dine_in_screen.dart | 38 +++++++++---------- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index edebe12..2ea5a06 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -160,6 +160,11 @@ "stories": "Stories", "bestFoodStories": "Best Food Stories Ever", "error": "Error", - "couldNotLaunch": "Could not launch" + "couldNotLaunch": "Could not launch", + "exploreCategories": "Explore the Categories", + "noStoreFound": "No Store Found in Your Area", + "currentlyNoAvailableStoreInZone": "Currently, there are no available store in your zone. Try changing your location to find nearby options.", + "dineInReservations": "Dine-In Reservations", + "bookATable": "Book a table at your favorite restaurant and enjoy a delightful dining experience." } \ No newline at end of file diff --git a/lib/constant/const_texts.dart b/lib/constant/const_texts.dart index 54dce03..0b0cbb8 100644 --- a/lib/constant/const_texts.dart +++ b/lib/constant/const_texts.dart @@ -162,4 +162,24 @@ class ConstTexts { "doYouWantChangeTheDeliverOption"; static String stories = "stories"; static String couldNotLaunch = "couldNotLaunch"; + static String exploreCategories = "exploreCategories"; + static String changeZone = "Change Zone"; + static String noStoreFound = "noStoreFound"; + static String currentlyNoAvailableStoreInZone = "currentlyNoAvailableStoreInZone"; + static String dineInReservations = "dineInReservations"; + static String bookATable = "bookATable"; + // static String orders = "orders"; + // static String takeAway = "takeAway"; + // static String seeAll = "seeAll"; + // static String bestServingFood = "bestServingFood"; + // static String ourCategories = "outCategories"; + // static String saveUpTo50Perc = "saveUpTo50Perc"; + // static String error = "error"; + // static String bestFoodStories = "bestFoodStories"; + // static String doYouWantChangeTheDeliverOption = + // "doYouWantChangeTheDeliverOption"; + // static String stories = "stories"; + // static String couldNotLaunch = "couldNotLaunch"; + // static String exploreCategories = "exploreCategories"; + // static String changeZone = "Change Zone"; } diff --git a/lib/screen_ui/ecommarce/dash_board_e_commerce_screen.dart b/lib/screen_ui/ecommarce/dash_board_e_commerce_screen.dart index 8e42832..108312c 100644 --- a/lib/screen_ui/ecommarce/dash_board_e_commerce_screen.dart +++ b/lib/screen_ui/ecommarce/dash_board_e_commerce_screen.dart @@ -1,3 +1,4 @@ +import 'package:customer/constant/const_texts.dart'; import 'package:customer/constant/constant.dart'; import 'package:customer/controllers/dash_board_controller.dart'; import 'package:customer/controllers/dash_board_ecommarce_controller.dart'; @@ -52,28 +53,28 @@ class DashBoardEcommerceScreen extends StatelessWidget { isDark, index: 0, assetIcon: "assets/icons/ic_home.svg", - label: 'Home'.tr, + label: ConstTexts.home.tr, controller: controller, ), navigationBarItem( isDark, index: 1, assetIcon: "assets/icons/ic_fav.svg", - label: 'Favourites'.tr, + label: ConstTexts.favourites.tr, controller: controller, ), navigationBarItem( isDark, index: 2, assetIcon: "assets/icons/ic_orders.svg", - label: 'Orders'.tr, + label: ConstTexts.orders.tr, controller: controller, ), navigationBarItem( isDark, index: 3, assetIcon: "assets/icons/ic_profile.svg", - label: 'Profile'.tr, + label: ConstTexts.profile.tr, controller: controller, ), ] @@ -82,35 +83,35 @@ class DashBoardEcommerceScreen extends StatelessWidget { isDark, index: 0, assetIcon: "assets/icons/ic_home.svg", - label: 'Home'.tr, + label: ConstTexts.home.tr, controller: controller, ), navigationBarItem( isDark, index: 1, assetIcon: "assets/icons/ic_fav.svg", - label: 'Favourites'.tr, + label: ConstTexts.favourites.tr, controller: controller, ), navigationBarItem( isDark, index: 2, assetIcon: "assets/icons/ic_wallet.svg", - label: 'Wallet'.tr, + label: ConstTexts.wallet.tr, controller: controller, ), navigationBarItem( isDark, index: 3, assetIcon: "assets/icons/ic_orders.svg", - label: 'Orders'.tr, + label: ConstTexts.orders.tr, controller: controller, ), navigationBarItem( isDark, index: 4, assetIcon: "assets/icons/ic_profile.svg", - label: 'Profile'.tr, + label: ConstTexts.profile.tr, controller: controller, ), ], diff --git a/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart b/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart index fda2471..7dea2d8 100644 --- a/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart +++ b/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart @@ -1,3 +1,5 @@ +// ignore_for_file: depend_on_referenced_packages + import 'package:customer/constant/const_texts.dart'; import 'package:customer/constant/constant.dart'; import 'package:customer/controllers/dine_in_controller.dart'; @@ -11,7 +13,6 @@ import 'package:customer/themes/app_them_data.dart'; import 'package:customer/themes/responsive.dart'; import 'package:customer/themes/round_button_fill.dart'; import 'package:customer/utils/network_image_widget.dart'; - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -82,7 +83,7 @@ class DineInScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "Dine-In Reservations".tr, + ConstTexts.dineInReservations.tr, style: TextStyle( fontSize: 24, fontFamily: AppThemeData.semiBold, @@ -94,8 +95,7 @@ class DineInScreen extends StatelessWidget { ), ), Text( - "Book a table at your favorite restaurant and enjoy a delightful dining experience." - .tr, + ConstTexts.bookATable.tr, textAlign: TextAlign.center, style: TextStyle( fontSize: 14, @@ -133,7 +133,7 @@ class DineInScreen extends StatelessWidget { ), const SizedBox(height: 12), Text( - "No Store Found in Your Area".tr, + ConstTexts.noStoreFound.tr, style: TextStyle( color: isDark @@ -145,8 +145,7 @@ class DineInScreen extends StatelessWidget { ), const SizedBox(height: 5), Text( - "Currently, there are no available store in your zone. Try changing your location to find nearby options." - .tr, + ConstTexts.currentlyNoAvailableStoreInZone.tr, textAlign: TextAlign.center, style: TextStyle( color: @@ -160,7 +159,7 @@ class DineInScreen extends StatelessWidget { const SizedBox(height: 20), RoundedButtonFill( borderRadius: 10.r, - title: "Change Zone".tr, + title: ConstTexts.changeZone.tr, width: 55, height: 5.5, color: AppThemeData.primary300, @@ -184,7 +183,7 @@ class DineInScreen extends StatelessWidget { const SizedBox(height: 10), titleView( isDark, - "Explore the Categories".tr, + ConstTexts.exploreCategories.tr, () { Get.to(const ViewAllCategoryDineInScreen()); }, @@ -220,7 +219,7 @@ class DineInScreen extends StatelessWidget { children: [ Expanded( child: Text( - "New Arrivals".tr, + ConstTexts.newArrivals.tr, textAlign: TextAlign.start, style: TextStyle( fontFamily: @@ -241,12 +240,13 @@ class DineInScreen extends StatelessWidget { "vendorList": controller .newArrivalRestaurantList, - "title": "New Arrival", + "title": + ConstTexts.newArrival.tr, }, ); }, child: Text( - "View all".tr, + ConstTexts.viewAll.tr, textAlign: TextAlign.center, style: TextStyle( fontFamily: @@ -318,7 +318,7 @@ class DineInScreen extends StatelessWidget { vertical: 10, ), child: Text( - "Popular Stores".tr, + ConstTexts.popularStores.tr, textAlign: TextAlign.center, style: TextStyle( fontFamily: @@ -359,7 +359,7 @@ class DineInScreen extends StatelessWidget { vertical: 10, ), child: Text( - "All Stores".tr, + ConstTexts.allStores.tr, textAlign: TextAlign.center, style: TextStyle( fontFamily: @@ -427,7 +427,7 @@ class DineInScreen extends StatelessWidget { onPress!(); }, child: Text( - "View all".tr, + ConstTexts.viewAll.tr, textAlign: TextAlign.center, style: TextStyle( fontFamily: AppThemeData.regular, @@ -494,7 +494,7 @@ class PopularRestaurant extends StatelessWidget { begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [ - Colors.black.withOpacity(0), + Colors.black.withValues(alpha: 0), const Color(0xFF111827), ], ), @@ -757,7 +757,7 @@ class AllRestaurant extends StatelessWidget { begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [ - Colors.black.withOpacity(0), + Colors.black.withValues(alpha: 0), const Color(0xFF111827), ], ), @@ -1019,7 +1019,7 @@ class NewArrival extends StatelessWidget { begin: const Alignment(0.00, 1.00), end: const Alignment(0, -1), colors: [ - Colors.black.withOpacity(0), + Colors.black.withValues(alpha: 0), AppThemeData.grey900, ], ), @@ -1326,7 +1326,7 @@ class BannerBottomView extends StatelessWidget { if (await canLaunchUrl(uri)) { await launchUrl(uri); } else { - ShowToastDialog.showToast("Could not launch".tr); + ShowToastDialog.showToast(ConstTexts.couldNotLaunch.tr); } } }, -- 2.49.1