Merge pull request #37 from adnan-nazir/fix_remove_diacritics

Removed Special characters (Diacritics)
This commit is contained in:
Chandra Abdul Fattah
2025-01-31 23:19:35 +07:00
committed by GitHub
3 changed files with 6 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
import 'package:collection/collection.dart' show IterableExtension;
import 'package:diacritic/diacritic.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart' show kDebugMode;
@@ -66,13 +67,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<String, dynamic> json) {
return CountryCode(
name: json['name'],
name: removeDiacritics(json['name']),
code: json['code'],
dialCode: json['dial_code'],
flagUri: 'flags/${json['code'].toLowerCase()}.png',

View File

@@ -119,7 +119,7 @@ class _CountryLocalizationsDelegate
@override
Future<CountryLocalizations> load(Locale locale) async {
CountryLocalizations localizations = CountryLocalizations(locale);
CountryLocalizations localizations = CountryLocalizations(const Locale('en'));//locale);
await localizations.load();
return localizations;
}