Skip to content

Commit acf62ce

Browse files
authored
Merge pull request #40 from flutter-news-app-full-source-code/l10n-country-picker
feat(l10n): localize country picker form field
2 parents 81366e4 + 74016ef commit acf62ce

File tree

6 files changed

+67
-4
lines changed

6 files changed

+67
-4
lines changed

lib/l10n/app_localizations.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,24 @@ abstract class AppLocalizations {
16451645
/// In en, this message translates to:
16461646
/// **'Enable Notifications'**
16471647
String get feedActionTypeEnableNotifications;
1648+
1649+
/// Label for the search input in the country picker
1650+
///
1651+
/// In en, this message translates to:
1652+
/// **'Search'**
1653+
String get countryPickerSearchLabel;
1654+
1655+
/// Hint text for the search input in the country picker
1656+
///
1657+
/// In en, this message translates to:
1658+
/// **'Start typing to search...'**
1659+
String get countryPickerSearchHint;
1660+
1661+
/// Label displayed when no country is selected in the picker form field
1662+
///
1663+
/// In en, this message translates to:
1664+
/// **'Select a country'**
1665+
String get countryPickerSelectCountryLabel;
16481666
}
16491667

16501668
class _AppLocalizationsDelegate

lib/l10n/app_localizations_ar.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,4 +868,13 @@ class AppLocalizationsAr extends AppLocalizations {
868868

869869
@override
870870
String get feedActionTypeEnableNotifications => 'تفعيل الإشعارات';
871+
872+
@override
873+
String get countryPickerSearchLabel => 'بحث';
874+
875+
@override
876+
String get countryPickerSearchHint => 'ابدأ الكتابة للبحث...';
877+
878+
@override
879+
String get countryPickerSelectCountryLabel => 'اختر دولة';
871880
}

lib/l10n/app_localizations_en.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,4 +867,13 @@ class AppLocalizationsEn extends AppLocalizations {
867867

868868
@override
869869
String get feedActionTypeEnableNotifications => 'Enable Notifications';
870+
871+
@override
872+
String get countryPickerSearchLabel => 'Search';
873+
874+
@override
875+
String get countryPickerSearchHint => 'Start typing to search...';
876+
877+
@override
878+
String get countryPickerSelectCountryLabel => 'Select a country';
870879
}

lib/l10n/arb/app_ar.arb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,4 +1077,17 @@
10771077
"@feedActionTypeEnableNotifications": {
10781078
"description": "نوع إجراء الموجز لتفعيل الإشعارات"
10791079
}
1080+
,
1081+
"countryPickerSearchLabel": "بحث",
1082+
"@countryPickerSearchLabel": {
1083+
"description": "تسمية حقل البحث في منتقي البلد"
1084+
},
1085+
"countryPickerSearchHint": "ابدأ الكتابة للبحث...",
1086+
"@countryPickerSearchHint": {
1087+
"description": "نص تلميح لحقل البحث في منتقي البلد"
1088+
},
1089+
"countryPickerSelectCountryLabel": "اختر دولة",
1090+
"@countryPickerSelectCountryLabel": {
1091+
"description": "التسمية المعروضة عند عدم اختيار أي دولة في حقل نموذج منتقي البلد"
1092+
}
10801093
}

lib/l10n/arb/app_en.arb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,4 +1077,17 @@
10771077
"@feedActionTypeEnableNotifications": {
10781078
"description": "Feed action type for enabling notifications"
10791079
}
1080+
,
1081+
"countryPickerSearchLabel": "Search",
1082+
"@countryPickerSearchLabel": {
1083+
"description": "Label for the search input in the country picker"
1084+
},
1085+
"countryPickerSearchHint": "Start typing to search...",
1086+
"@countryPickerSearchHint": {
1087+
"description": "Hint text for the search input in the country picker"
1088+
},
1089+
"countryPickerSelectCountryLabel": "Select a country",
1090+
"@countryPickerSelectCountryLabel": {
1091+
"description": "Label displayed when no country is selected in the picker form field"
1092+
}
10801093
}

lib/shared/widgets/country_picker_form_field.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:country_picker/country_picker.dart' as picker;
22
import 'package:flutter/material.dart';
3+
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart';
34
import 'package:ui_kit/ui_kit.dart';
45

56
/// A form field for selecting a country using the `country_picker` package.
@@ -23,6 +24,7 @@ class CountryPickerFormField extends StatelessWidget {
2324

2425
@override
2526
Widget build(BuildContext context) {
27+
final l10n = AppLocalizationsX(context).l10n;
2628
return InkWell(
2729
onTap: () {
2830
picker.showCountryPicker(
@@ -37,9 +39,8 @@ class CountryPickerFormField extends StatelessWidget {
3739
topRight: Radius.circular(AppSpacing.md),
3840
),
3941
inputDecoration: InputDecoration(
40-
labelText: 'Search', // TODO(fulleni): Localize this string
41-
hintText:
42-
'Start typing to search...', // TODO(fulleni): Localize this
42+
labelText: l10n.countryPickerSearchLabel,
43+
hintText: l10n.countryPickerSearchHint,
4344
prefixIcon: const Icon(Icons.search),
4445
border: OutlineInputBorder(
4546
borderSide: BorderSide(
@@ -74,7 +75,7 @@ class CountryPickerFormField extends StatelessWidget {
7475
] else
7576
Expanded(
7677
child: Text(
77-
'Select a country', // TODO(you): Localize this string
78+
l10n.countryPickerSelectCountryLabel,
7879
style: Theme.of(context)
7980
.textTheme
8081
.bodyLarge

0 commit comments

Comments
 (0)