Skip to content

feat(l10n): localize country picker form field #40

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

Merged
merged 1 commit into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,24 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Enable Notifications'**
String get feedActionTypeEnableNotifications;

/// Label for the search input in the country picker
///
/// In en, this message translates to:
/// **'Search'**
String get countryPickerSearchLabel;

/// Hint text for the search input in the country picker
///
/// In en, this message translates to:
/// **'Start typing to search...'**
String get countryPickerSearchHint;

/// Label displayed when no country is selected in the picker form field
///
/// In en, this message translates to:
/// **'Select a country'**
String get countryPickerSelectCountryLabel;
}

class _AppLocalizationsDelegate
Expand Down
9 changes: 9 additions & 0 deletions lib/l10n/app_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -868,4 +868,13 @@ class AppLocalizationsAr extends AppLocalizations {

@override
String get feedActionTypeEnableNotifications => 'تفعيل الإشعارات';

@override
String get countryPickerSearchLabel => 'بحث';

@override
String get countryPickerSearchHint => 'ابدأ الكتابة للبحث...';

@override
String get countryPickerSelectCountryLabel => 'اختر دولة';
}
9 changes: 9 additions & 0 deletions lib/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -867,4 +867,13 @@ class AppLocalizationsEn extends AppLocalizations {

@override
String get feedActionTypeEnableNotifications => 'Enable Notifications';

@override
String get countryPickerSearchLabel => 'Search';

@override
String get countryPickerSearchHint => 'Start typing to search...';

@override
String get countryPickerSelectCountryLabel => 'Select a country';
}
13 changes: 13 additions & 0 deletions lib/l10n/arb/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1077,4 +1077,17 @@
"@feedActionTypeEnableNotifications": {
"description": "نوع إجراء الموجز لتفعيل الإشعارات"
}
,
"countryPickerSearchLabel": "بحث",
"@countryPickerSearchLabel": {
"description": "تسمية حقل البحث في منتقي البلد"
},
"countryPickerSearchHint": "ابدأ الكتابة للبحث...",
"@countryPickerSearchHint": {
"description": "نص تلميح لحقل البحث في منتقي البلد"
},
"countryPickerSelectCountryLabel": "اختر دولة",
"@countryPickerSelectCountryLabel": {
"description": "التسمية المعروضة عند عدم اختيار أي دولة في حقل نموذج منتقي البلد"
}
}
13 changes: 13 additions & 0 deletions lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1077,4 +1077,17 @@
"@feedActionTypeEnableNotifications": {
"description": "Feed action type for enabling notifications"
}
,
"countryPickerSearchLabel": "Search",
"@countryPickerSearchLabel": {
"description": "Label for the search input in the country picker"
},
"countryPickerSearchHint": "Start typing to search...",
"@countryPickerSearchHint": {
"description": "Hint text for the search input in the country picker"
},
"countryPickerSelectCountryLabel": "Select a country",
"@countryPickerSelectCountryLabel": {
"description": "Label displayed when no country is selected in the picker form field"
}
}
9 changes: 5 additions & 4 deletions lib/shared/widgets/country_picker_form_field.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:country_picker/country_picker.dart' as picker;
import 'package:flutter/material.dart';
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart';
import 'package:ui_kit/ui_kit.dart';

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

@override
Widget build(BuildContext context) {
final l10n = AppLocalizationsX(context).l10n;
return InkWell(
onTap: () {
picker.showCountryPicker(
Expand All @@ -37,9 +39,8 @@ class CountryPickerFormField extends StatelessWidget {
topRight: Radius.circular(AppSpacing.md),
),
inputDecoration: InputDecoration(
labelText: 'Search', // TODO(fulleni): Localize this string
hintText:
'Start typing to search...', // TODO(fulleni): Localize this
labelText: l10n.countryPickerSearchLabel,
hintText: l10n.countryPickerSearchHint,
prefixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderSide: BorderSide(
Expand Down Expand Up @@ -74,7 +75,7 @@ class CountryPickerFormField extends StatelessWidget {
] else
Expanded(
child: Text(
'Select a country', // TODO(you): Localize this string
l10n.countryPickerSelectCountryLabel,
style: Theme.of(context)
.textTheme
.bodyLarge
Expand Down
Loading