Skip to content

mikicleverppc/flutter-localized-countries

 
 

Repository files navigation

flutter_localized_countries

For 122 languages

  • Country code to name mappings.
  • Locale code to name mappings.

This is a port of an npm package localized-countries for Flutter.

Data is taken from https://github.com/umpirsky/country-list and https://github.com/umpirsky/locale-list.

This package bundles required assets and provides custom LocalizationsDelegates for loading them.

Usage

Country names

import 'package:flutter_localized_countries/flutter_localized_countries.dart';

void main() {
  runApp(MaterialApp(
    localizationsDelegates: [
      CountryNamesLocalizationsDelegate(),
      // ... more localization delegates
      GlobalMaterialLocalizations.delegate,
      GlobalWidgetsLocalizations.delegate,
    ],
    ...
  );
  
  ...
  
  print(CountryNames.of(context).nameOf('NL')); // Netherlands;
}

Locale names

import 'package:flutter_localized_countries/flutter_localized_countries.dart';

void main() {
  runApp(MaterialApp(
    localizationsDelegates: [
      LocaleNamesLocalizationsDelegate(),
      // ... more localization delegates
      GlobalMaterialLocalizations.delegate,
      GlobalWidgetsLocalizations.delegate,
    ],
    ...
  );
  
  ...
  
  print(LocaleNames.of(context).nameOf('en_GB')); // English (United Kingdom)
}

Known Bugs

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 93.7%
  • Shell 6.3%