Skip to content

Commit

Permalink
Merge pull request #404 from jaivsh/patch1
Browse files Browse the repository at this point in the history
Added Arabic language support for the project
  • Loading branch information
avinashkranjan authored Aug 9, 2023
2 parents 25f1843 + 52eccd6 commit 521efab
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 57 deletions.
43 changes: 43 additions & 0 deletions lib/l10n/app_ar.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"friday": "الجمعة",
"hellosir": "مرحباً يا سيدي!",
"recentalerts": "تنبيهات حديثة",
"viewall": "عرض الكل",
"seefavourites": "عرض المفضلة",
"search": "بحث",
"recenthomework": "واجبات حديثة",
"favourites": "المفضلة",
"clearallfavourites": "مسح كل المفضلة",
"hoursleft": "ساعات متبقية",
"addnewclass": "إضافة صف دراسي جديد",
"mode": "الوضع",
"teachername": "اسم المعلم",
"date": "تاريخ",
"time": "وقت",
"joinlink": "الانضمام عبر الرابط",
"subject": "الموضوع",
"save": "حفظ",
"yourprofile": "ملفك الشخصي",
"loading": "جاري التحميل...",
"email": "البريد الإلكتروني",
"bio": "السيرة الذاتية",
"college": "الكلية",
"course": "نوع الدورة",
"departmentmajor": "القسم",
"currentacademicyear": "السنة الأكاديمية الحالية",
"gender": "الجنس",
"age": "العمر",
"logout": "تسجيل الخروج",
"settings": "الإعدادات",
"common": "شائع",
"language": "اللغة",
"lightmode": "وضع الإضاءة",
"notifications": "الإشعارات",
"notificationsdesc": "تفعيل أو تعطيل إشعارات التطبيق",
"help": "المساعدة",
"helpdesc": "راجع وحدة المساعدة للاستفسارات",
"faqs": "الأسئلة الشائعة",
"faqsdesc": "إرشادات الاستخدام الأساسية",
"supportdevelopment": "دعم تطوير التطبيق",
"supportdevelopmentdesc": "حل المشاكل، والإبلاغ عن الأخطاء، وما إلى ذلك."
}
84 changes: 84 additions & 0 deletions lib/localizationTexts/arabic.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import 'package:flutter/material.dart';

class ArabicTexts {

String get friday => 'الجمعة';

String get hellosir => 'مرحبًا سيدي!';

String get recentalerts => 'تنبيهات حديثة';

String get viewall => 'عرض الكل';

String get seefavourites => 'عرض المفضلة';

String get search => 'بحث';

String get recenthomework => 'واجبات حديثة';

String get favourites => 'المفضلة';

String get clearallfavourites => 'مسح كل المفضلة';

String get hoursleft => 'الساعات المتبقية';

String get addnewclass => 'إضافة صف جديد';

String get mode => 'الوضع';

String get teachername => 'اسم المعلم';

String get date => 'التاريخ';

String get time => 'الوقت';

String get joinlink => 'الانضمام عبر الرابط';

String get subject => 'الموضوع';

String get save => 'حفظ';

String get yourprofile => 'ملفك الشخصي';

String get loading => 'جاري التحميل...';

String get email => 'البريد الإلكتروني';

String get bio => 'السيرة الذاتية';

String get college => 'الكلية';

String get course => 'نوع الدورة';

String get departmentmajor => 'القسم';

String get currentacademicyear => 'العام الأكاديمي الحالي';

String get gender => 'الجنس';

String get age => 'العمر';

String get settings => 'الإعدادات';

String get common => 'مشترك';

String get language => 'اللغة';

String get lightmode => 'وضع الإضاءة';

String get notifications => 'الإشعارات';

String get notificationsdesc => 'تفعيل أو تعطيل إشعارات التطبيق';

String get help => 'المساعدة';

String get helpdesc => 'راجع وحدة المساعدة للاستفسارات';

String get faqs => 'الأسئلة الشائعة';

String get faqsdesc => 'إرشادات الاستخدام الأساسية';

String get supportdevelopment => 'دعم تطوير التطبيق';

String get supportdevelopmentdesc => 'حل المشاكل، والإبلاغ عن الأخطاء، وما إلى ذلك.';
}
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ class _MyAppState extends State<MyApp> {
supportedLocales: [
Locale('ru'),
Locale('en'), // English
Locale('hi'), // Hindi
Locale('hi'),
Locale('ar')// Hindi
],
debugShowCheckedModeBanner: false,
title: 'Friday',
Expand Down
60 changes: 4 additions & 56 deletions lib/screens/settings_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:friday/main.dart';
import 'package:friday/screens/faqs_screen.dart';
import 'package:friday/screens/help_screen.dart';
import 'package:friday/screens/themes.dart';
Expand All @@ -15,32 +14,6 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:shared_preferences/shared_preferences.dart';


class MyApps extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();

static _MyAppState? of(BuildContext context) => context.findAncestorStateOfType<_MyAppState>();
}

class _MyAppState extends State<MyApps> {
late Locale _locale;

void setLocale(Locale value) {
setState(() {
_locale = value;
});
}

@override
Widget build(BuildContext context) {
return MaterialApp(
locale: _locale,
home: MyApp(),
);
}
}


class SettingsScreen extends StatefulWidget {
@override
State<SettingsScreen> createState() => _SettingsScreenState();
Expand Down Expand Up @@ -145,40 +118,15 @@ class _SettingsScreenState extends State<SettingsScreen> {

,sections: [
SettingsSection(

title: Text(AppLocalizations.of(context).common),
tiles: <SettingsTile>[
SettingsTile.navigation(
leading: Icon(Icons.language),
onPressed: (c) {
var languages = ['English','Russian','Hindi'];
showDialog(context: context, builder: (BuildContext context) {
return new AlertDialog(
backgroundColor: Colors.black,
actions: [TextButton(onPressed: () {
Navigator.pop(context);
}, child: Text('OK', style: TextStyle(color: Colors.deepPurpleAccent),))],
title: new Text('Select a Language', style: TextStyle(color: Colors.deepPurpleAccent),),
content: Container(height:200, width: MediaQuery.of(context).size.width ,child:ListView.builder(
itemCount: languages.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(languages[index],style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),),
onTap: () {
if(index == 0) {
MyApps.of(context)!.setLocale(Locale.fromSubtags(languageCode: 'en'));
}
else if(index == 1) {
MyApps.of(context)!.setLocale(Locale.fromSubtags(languageCode: 'hi'));
}
else if(index == 2) {
MyApps.of(context)!.setLocale(Locale.fromSubtags(languageCode: 'ru'));
}
},
);
},
),
));
});
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text("Currently support is for Single language only. Stay tuned!"),
));
},
title: Text(AppLocalizations.of(context).language),
value: Text('English'),
Expand Down

0 comments on commit 521efab

Please sign in to comment.