Skip to content

Commit

Permalink
language
Browse files Browse the repository at this point in the history
  • Loading branch information
RGTechPro committed Aug 26, 2022
1 parent eb9cbee commit c4a6515
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 55 deletions.
49 changes: 26 additions & 23 deletions lib/language_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Map translatedStrings = {};
Map strings = {
"aadharUpdationOrEnrollmentAtYourHome":
"Aadhar updation or Enrollment at your home",
"selectYourOwnTimeSlot": "Select your own Time Slot",
"selectYourOwnTimeSlot&Operator": "Select your own Time Slot & Operator",
// "b83ac7e5c93e97387c489386a49c7bbf": "b83ac7e5c93e97387c489386a49c7bbf",
// "मेराAadhar": "मेरा Aadhar",
// "surabhiMishra": "Surabhi Mishra",
Expand All @@ -17,24 +17,24 @@ Map strings = {
// "badOperator": "bad operator",
// "averageOperatorGg": "average operator gg",
// "bhb": "bhb",
// "bookOperator": "Book operator",
"bookOperator": "Book operator",
// "operators": "Operators",
// "morning": "morning",
// "evening": "evening",
// "pleaseSelectAnyOptionToContinue": "Please select any option to continue",
// "selectDateAndTime": "Select Date and Time",
// "morningSlots": "Morning Slots",
// "eveningSlots": "Evening Slots",
// "keepWithYourself": "Keep With yourself",
"keepWithYourself": "Keep With yourself",
// "dart:ffi": "dart:ffi",
// "proofOfIdentity": "Proof of Identity",
// "proofOfAddress": "Proof of Address",
// "proofOfRelationship": "Proof of Relationship",
"proofOfIdentity": "Proof of Identity",
"proofOfAddress": "Proof of Address",
"proofOfRelationship": "Proof of Relationship",
// "dateOfBirth": "Date of Birth",
// "clickHereForMoreInformationAboutTheDocumentNeeded":
// "Click here for more information about the document needed.",
// "pleaseCheckAllTheDocumentsToContinue":
// "Please check all the documents to continue",
"clickHereForMoreInformationAboutTheDocumentNeeded":
"Click here for more information about the document needed.",
"pleaseCheckAllTheDocumentsToContinue":
"Please check all the documents to continue",
// "myMap": "My Map",
// "searchLocation": "Search Location",
// "currentLocation": "Current Location",
Expand All @@ -58,7 +58,7 @@ Map strings = {
// "editAddressPage": "Edit Address Page",
// "clickMap": "CLICK MAP",
// "logout": "Logout",
// "operatorBooked": "Operator Booked",
"operatorBooked": "Operator Booked",
// "finishPage": "finish page",
// "modeSelectionPage": "Mode Selection Page",
// "serviceSelectionPage": "Service Selection Page",
Expand All @@ -78,8 +78,8 @@ Map strings = {
// "dart:async": "dart:async",
// "pleaseSelectAnySlotToContinue": "Please select any slot to continue",
// "selectaLanguage": "Select a language",
// "useHelpline": "Use Helpline",
// "selfUpdate": "Self Update",
"useHelpline": "Use Helpline",
"selfUpdate": "Self Update",
// "getting": "Getting...",
// "addOrUpdateLocationMarker": "Add or update location marker",
// "amHereForSure": "Am here for sure",
Expand All @@ -100,13 +100,13 @@ Map strings = {
// "aadharUpdationOrEnrollmentAtYourHome":
// "Aadhar updation or Enrollment at your home",
// "selectYourOwnTimeSlot": "Select your own Time Slot",
// "reviewYourAppointments": "Review your appointments",
"reviewYourAppointments": "Review your appointments",
// "getStarted": "Get Started",
// "yourOperator": "Your Operator",
"yourOperator": "Your Operator",
// "aadharUpdation": "Aadhar Updation",
// "aadharEnrollment": "Aadhar Enrollment",
// "confirmationOtp": "Confirmation OTP",
// "cancel": "Cancel",
"cancel": "Cancel",
// "loadingData": "Loading data...",
// "icon": "icon",
// "iconhigh": "iconhigh",
Expand All @@ -116,7 +116,7 @@ Map strings = {
// "widgetFinallyRebuild": "Widget finally rebuild",
// "123456789": "123456789",
// "streamClosed": "Stream closed!",
// "selectAnOperatorForYourself": "Select an operator for yourself",
"selectAnOperatorForYourself": "Select an operator for yourself",
// "youAreAllDone": "You are all done!",
// "completedBookingForId:": "Completed Booking for ID :",
// "xxxxxxx92": "XXX-XXX-X92",
Expand All @@ -138,14 +138,14 @@ Map strings = {
// "\\d{6}": "(\\d{6})",
// "mobileVerification": "MOBILE VERIFICATION",
// "verifyYourAccount": "VERIFY YOUR ACCOUNT",
// "login": "Login",
"login": "Login",
// "enterOtp": "Enter OTP",
// "pleaseEnterYourMobileNumber": "Please enter your mobile number.",
// "enterTheOtpReceivedOnYourPhone": "Enter the OTP received on your phone.",
// "[09]": "[0-9]",
// "phoneNumber": "Phone Number",
// "in": "IN",
// "resend": "Resend",
"resend": "Resend",
// "requestOtp": "Request OTP",
// "unknown": "Unknown",
// "operatorLoggedIn": "Operator Logged In!",
Expand Down Expand Up @@ -205,19 +205,22 @@ Map strings = {
// "@@last_modified": "2022-08-25T18:16:18.534899"
};

void superTranslate(BuildContext context) async {
Future<void> superTranslate(BuildContext context) async {
final translator = GoogleTranslator();

final input = "Здравствуйте. Ты в порядке?";
//final input = "Здравствуйте. Ты в порядке?";
String? conv = Provider.of<BookingProvider>(context, listen: false)
.languageToCode[
Provider.of<BookingProvider>(context, listen: false).selectedLanguage];
print(Provider.of<BookingProvider>(context, listen: false).selectedLanguage);
translator.translate(input, from: 'ru', to: 'en').then(print);
// translator.translate(input, from: 'ru', to: 'en').then(print);
print(conv);
strings.forEach((key, value) async {
await translator.translate(value, from: 'en', to: conv!).then((val) {
translatedStrings[key] = value;
translatedStrings[key] = val;
print(val);
print(key);
print(translatedStrings[key]);
});
});

Expand Down
13 changes: 7 additions & 6 deletions lib/screens/documentCheckPage.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:ffi';
import 'package:google_fonts/google_fonts.dart';
import 'package:flutter/material.dart';
import 'package:mera_aadhar/language_handler.dart';
import 'package:mera_aadhar/screens/MapIntroductionPage.dart';
import 'package:mera_aadhar/screens/date_page.dart';
import 'package:mera_aadhar/screens/operator_selection.dart';
Expand Down Expand Up @@ -53,7 +54,7 @@ class _DocumentCheckPageState extends State<DocumentCheckPage> {
),
Center(
child: Text(
"Keep With yourself",
translatedStrings["keepWithYourself"].toString(),
style: GoogleFonts.nunito(
textStyle: TextStyle(
fontSize: 35,
Expand Down Expand Up @@ -81,7 +82,7 @@ class _DocumentCheckPageState extends State<DocumentCheckPage> {
activeColor: Colors.green,
checkColor: Colors.white,
title: Text(
'Proof of Identity',
translatedStrings["proofOfIdentity"].toString(),
style: GoogleFonts.poppins(
textStyle: TextStyle(
fontWeight: FontWeight.w700,
Expand Down Expand Up @@ -113,7 +114,7 @@ class _DocumentCheckPageState extends State<DocumentCheckPage> {
activeColor: Colors.green,
checkColor: Colors.white,
title: Text(
'Proof of Address',
translatedStrings["proofOfAddress"].toString(),
style: GoogleFonts.poppins(
textStyle: TextStyle(
fontWeight: FontWeight.w700,
Expand Down Expand Up @@ -145,7 +146,7 @@ class _DocumentCheckPageState extends State<DocumentCheckPage> {
activeColor: Colors.green,
checkColor: Colors.white,
title: Text(
'Proof of Relationship',
translatedStrings["proofOfRelationship"].toString(),
style: GoogleFonts.poppins(
textStyle: TextStyle(
fontWeight: FontWeight.w700,
Expand Down Expand Up @@ -195,7 +196,7 @@ class _DocumentCheckPageState extends State<DocumentCheckPage> {
'https://uidai.gov.in/images/commdoc/List_of_Acceptable_documents_July2022.pdf');
},
child: Text(
'Click here for more information about the document needed.',
translatedStrings["clickHereForMoreInformationAboutTheDocumentNeeded."].toString(),
style: GoogleFonts.nunito(
textStyle: TextStyle(fontSize: 20, color: Colors.white),
),
Expand Down Expand Up @@ -223,7 +224,7 @@ class _DocumentCheckPageState extends State<DocumentCheckPage> {

else
showSnackBar(
'Please check all the documents to continue', context);
translatedStrings["pleaseCheckAllTheDocumentsToContinue"].toString(), context);
},
backgroundColor: Colors.white,
child: const Icon(
Expand Down
9 changes: 6 additions & 3 deletions lib/screens/language_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ class _LanguageSelectorScreenState extends State<LanguageSelectorScreen> {
height: 60,
width: 60,
child: FloatingActionButton(
onPressed: () {
onPressed: ()async {
if (Provider.of<BookingProvider>(context, listen: false)
.checkLanguage()) {
Provider.of<BookingProvider>(context, listen: false)
.lodgeLanguage();
Provider.of<BookingProvider>(context, listen: false)
.cleanLanguages();
// superTranslate(context);
Navigator.of(context).push(MaterialPageRoute(
await superTranslate(context);
Future.delayed(Duration(milliseconds: 1500), () {
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => OnBoardingScreen()));
});

} else {
showSnackBar('Please select any slot to continue', context);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/screens/login_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:flutter/material.dart';
import 'package:mera_aadhar/language_handler.dart';
import 'package:mera_aadhar/screens/verification.dart';
import 'package:mera_aadhar/widgets/my_card.dart';

Expand All @@ -27,7 +28,7 @@ class LoginType extends StatelessWidget {
),
Expanded(
child: MyCard(
text: "Use helpline",
text: translatedStrings["useHelpline"].toString(),
icon: FontAwesomeIcons.headphonesSimple,
onTheTap: () {
Navigator.push(context,
Expand All @@ -37,7 +38,7 @@ class LoginType extends StatelessWidget {
),
Expanded(
child: MyCard(
text: "Self Update",
text: translatedStrings["selfUpdate"].toString(),
icon: FontAwesomeIcons.fireBurner,
onTheTap: () {
Navigator.push(context,
Expand Down
7 changes: 4 additions & 3 deletions lib/screens/modeSelectionPage.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:google_fonts/google_fonts.dart';
import 'package:flutter/material.dart';
import 'package:mera_aadhar/language_handler.dart';
import 'package:mera_aadhar/screens/verification.dart';
import 'package:url_launcher/url_launcher.dart';

Expand Down Expand Up @@ -86,7 +87,7 @@ class _ModeSelectPageState extends State<ModeSelectPage> {
height: 10,
),
Text(
'Book Operator',
translatedStrings["bookOperator"].toString(),
style: GoogleFonts.poppins(
textStyle: const TextStyle(
fontWeight: FontWeight.w500,
Expand Down Expand Up @@ -129,7 +130,7 @@ class _ModeSelectPageState extends State<ModeSelectPage> {
height: 10,
),
Text(
'Use Helpline',
translatedStrings["useHelpline"].toString(),
style: GoogleFonts.poppins(
textStyle: const TextStyle(
fontWeight: FontWeight.w500,
Expand Down Expand Up @@ -173,7 +174,7 @@ class _ModeSelectPageState extends State<ModeSelectPage> {
height: 10,
),
Text(
'Self Update',
translatedStrings["selfUpdate"].toString(),
style: GoogleFonts.poppins(
textStyle: const TextStyle(
fontWeight: FontWeight.w500,
Expand Down
23 changes: 13 additions & 10 deletions lib/screens/onBoardingPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
} else {
_currentPage = 0;
}

if(_controller.hasClients)
_controller.animateToPage(
_currentPage,
duration: const Duration(milliseconds: 500),
curve: Curves.easeIn,
);
});
print('here');
print(translatedStrings["aadharUpdationOrEnrollmentAtYourHome"]);
}

@override
Expand All @@ -58,8 +60,10 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => ModeSelectPage()));},
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => ModeSelectPage()));
},
child: Text(
"SKIP >>",
style: GoogleFonts.nunito(
Expand Down Expand Up @@ -99,19 +103,18 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
children: [
WelcomeScreen(
vectorLink: "assets/card.png",
textelement: "Aadhar updation or Enrollment at your home",
// textelement: translatedStrings["aadharUpdationOrEnrollmentAtYourHome"],
// textelement: "Aadhar updation or Enrollment at your home",
textelement:
translatedStrings["aadharUpdationOrEnrollmentAtYourHome"].toString(),
),
WelcomeScreen(

vectorLink: "assets/time.png",
textelement: "Select your own Time Slot & operator",
textelement: translatedStrings["selectYourOwnTimeSlot&Operator"].toString(),
),
WelcomeScreen(
vectorLink: "assets/review.png",
textelement: "Review your on-going appointments",

)
textelement: translatedStrings["reviewYourAppointments"].toString(),
)
],
),
),
Expand Down
7 changes: 4 additions & 3 deletions lib/screens/operator_booked.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:mera_aadhar/firebase/booking_db.dart';
import 'package:mera_aadhar/language_handler.dart';
import 'package:mera_aadhar/provider/booking.dart';
import 'package:mera_aadhar/screens/finish_page.dart';
import 'package:mera_aadhar/utilities/constants.dart';
Expand Down Expand Up @@ -90,7 +91,7 @@ class _OperatorBookedState extends State<OperatorBooked> {
Padding(
padding: const EdgeInsets.only(bottom: 5),
child: Text(
'Operator Booked',
translatedStrings["operatorBooked"].tostring(),
style: textStyle.copyWith(fontWeight: FontWeight.bold),
),
),
Expand All @@ -115,7 +116,7 @@ class _OperatorBookedState extends State<OperatorBooked> {
child: Align(
alignment: Alignment.topLeft,
child: Text(
'Your Operator',
translatedStrings["yourOperator"].tostring(),
style: oTextStyle,
),
),
Expand Down Expand Up @@ -159,7 +160,7 @@ class _OperatorBookedState extends State<OperatorBooked> {
cancelCurrentBookingAndExit();
},
child: Text(
'Cancel',
translatedStrings["cancel"].toString(),
style: buttonTextStyle,
)
)
Expand Down
7 changes: 4 additions & 3 deletions lib/screens/operator_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:flutter/material.dart';
import 'package:mera_aadhar/firebase/booking_db.dart';
import 'package:mera_aadhar/language_handler.dart';
import 'package:mera_aadhar/models/booking_model.dart';
import 'package:mera_aadhar/provider/booking.dart';
import 'package:mera_aadhar/screens/operator_booked.dart';
Expand Down Expand Up @@ -340,7 +341,7 @@ class _OperatorSelectionScreenState extends State<OperatorSelectionScreen> {
borderRadius: BorderRadius.circular(30)),
child: Center(
child: Text(
'Select an operator for yourself',
translatedStrings["selectAnOperatorForYourself"].toString(),
style: GoogleFonts.poppins(
textStyle: const TextStyle(
fontWeight: FontWeight.w500,
Expand Down Expand Up @@ -420,9 +421,9 @@ class _OperatorSelectionScreenState extends State<OperatorSelectionScreen> {
decoration: BoxDecoration(
// color: Color(0xFFF8774A),
borderRadius: BorderRadius.circular(30)),
child: const Center(
child: Center(
child: Text(
'Book operator',
translatedStrings["bookOperator"].toString(),
style: buttonTextStyle,
),
),
Expand Down
Loading

0 comments on commit c4a6515

Please sign in to comment.