From d67fa413a6fa522c0116d7df447a3b44c2a0c2ae Mon Sep 17 00:00:00 2001 From: Fahad Hassan Date: Tue, 3 Sep 2024 17:22:32 +0500 Subject: [PATCH 1/2] removed Diacritics --- lib/src/country_code.dart | 6 ++++-- pubspec.yaml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/country_code.dart b/lib/src/country_code.dart index b8a3863..fa206c4 100644 --- a/lib/src/country_code.dart +++ b/lib/src/country_code.dart @@ -1,4 +1,5 @@ import 'package:collection/collection.dart' show IterableExtension; +import 'package:diacritic/diacritic.dart'; import 'package:flutter/cupertino.dart'; import 'country_codes.dart'; @@ -47,13 +48,14 @@ class CountryCode { } CountryCode localize(BuildContext context) { + final nam = CountryLocalizations.of(context)?.translate(code) ?? name; return this - ..name = CountryLocalizations.of(context)?.translate(code) ?? name; + ..name = nam == null? name : removeDiacritics(nam); } factory CountryCode.fromJson(Map json) { return CountryCode( - name: json['name'], + name: removeDiacritics(json['name']), code: json['code'], dialCode: json['dial_code'], flagUri: 'flags/${json['code'].toLowerCase()}.png', diff --git a/pubspec.yaml b/pubspec.yaml index ebc0837..c35a942 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,6 +12,7 @@ dependencies: flutter: sdk: flutter collection: ^1.15.0 + diacritic: ^0.1.5 flutter: assets: From b279411802dd21fa0bcf28d2663ef24ce78828ac Mon Sep 17 00:00:00 2001 From: Adnan Nazir Date: Mon, 9 Dec 2024 15:53:56 +0500 Subject: [PATCH 2/2] disabled localization --- lib/src/country_localizations.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/country_localizations.dart b/lib/src/country_localizations.dart index b079091..ec24d2e 100644 --- a/lib/src/country_localizations.dart +++ b/lib/src/country_localizations.dart @@ -119,7 +119,7 @@ class _CountryLocalizationsDelegate @override Future load(Locale locale) async { - CountryLocalizations localizations = CountryLocalizations(locale); + CountryLocalizations localizations = CountryLocalizations(const Locale('en'));//locale); await localizations.load(); return localizations; }