-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor improve localizations #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
30c29a9
63a3ae0
719d736
efb3484
36b64cb
a09d30e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -371,8 +371,7 @@ class AppLocalizationsAr extends AppLocalizations { | |
String get androidStoreUrlLabel => 'رابط متجر Android'; | ||
|
||
@override | ||
String get androidStoreUrlDescription => | ||
'رابط التطبيق على متجر Google Play Store.'; | ||
String get androidUpdateUrlDescription => 'رابط تحديثات تطبيق Android.'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an inconsistency between the English and Arabic localizations for To ensure consistency, the Arabic translation should also refer to the Google Play Store URL.
|
||
|
||
@override | ||
String get guestDaysBetweenInAppPromptsLabel => | ||
|
@@ -785,5 +784,67 @@ class AppLocalizationsAr extends AppLocalizations { | |
String get androidUpdateUrlLabel => 'رابط تحديث Android'; | ||
|
||
@override | ||
String get androidUpdateUrlDescription => 'رابط تحديثات تطبيق Android.'; | ||
String get followedItemsLimitLabel => 'حد العناصر المتابعة'; | ||
|
||
@override | ||
String get followedItemsLimitDescription => | ||
'الحد الأقصى لعدد البلدان أو مصادر الأخبار أو المواضيع التي يمكن لهذا الدور المستخدم متابعتها (لكل نوع حد خاص به).'; | ||
|
||
@override | ||
String get savedHeadlinesLimitLabel => 'حد العناوين المحفوظة'; | ||
|
||
@override | ||
String get savedHeadlinesLimitDescription => | ||
'الحد الأقصى لعدد العناوين الرئيسية التي يمكن لهذا الدور المستخدم حفظها.'; | ||
|
||
@override | ||
String get adFrequencyLabel => 'تكرار الإعلان'; | ||
|
||
@override | ||
String get adFrequencyDescription => | ||
'عدد مرات ظهور الإعلان لهذا الدور المستخدم (على سبيل المثال، قيمة 5 تعني أنه يمكن وضع إعلان بعد كل 5 عناصر إخبارية).'; | ||
|
||
@override | ||
String get adPlacementIntervalLabel => 'فترة وضع الإعلان'; | ||
|
||
@override | ||
String get adPlacementIntervalDescription => | ||
'الحد الأدنى لعدد عناصر الأخبار التي يجب عرضها قبل ظهور الإعلان الأول لهذا الدور المستخدم.'; | ||
|
||
@override | ||
String get articlesBeforeInterstitialAdsLabel => | ||
'مقالات قبل الإعلانات البينية'; | ||
|
||
@override | ||
String get articlesBeforeInterstitialAdsDescription => | ||
'عدد المقالات التي يحتاج هذا الدور المستخدم لقراءتها قبل عرض إعلان بيني بملء الشاشة.'; | ||
|
||
@override | ||
String get daysSuffix => 'أيام'; | ||
|
||
@override | ||
String daysBetweenPromptDescription(String actionType) { | ||
return 'الحد الأدنى لعدد الأيام قبل عرض تنبيه $actionType.'; | ||
} | ||
|
||
@override | ||
String get retryButtonText => 'إعادة المحاولة'; | ||
|
||
@override | ||
String get feedActionTypeLinkAccount => 'ربط الحساب'; | ||
|
||
@override | ||
String get feedActionTypeRateApp => 'تقييم التطبيق'; | ||
|
||
@override | ||
String get feedActionTypeFollowTopics => 'متابعة المواضيع'; | ||
|
||
@override | ||
String get feedActionTypeFollowSources => 'متابعة المصادر'; | ||
|
||
@override | ||
String get feedActionTypeUpgrade => 'ترقية'; | ||
|
||
@override | ||
String get feedActionTypeEnableNotifications => 'تفعيل الإشعارات'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These four methods are very repetitive, each containing a similar
switch
statement. This leads to code duplication and makes maintenance harder, especially if new user roles are added in the future.A more declarative and maintainable approach would be to use
Map
s to associate user roles with their corresponding localization functions. You could replace these four methods with static maps inside the_UserPreferenceLimitsFormState
class.For example:
Then, in your
build
method, you would access the localized strings like this:This refactoring would significantly reduce code duplication and improve the code's readability and maintainability.