canewsin / flutter-localized-locales

Flutter plugin which provides locale code to name mappings for 563 locales.

Home Page:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


pub package

flutter_localized_locales is a Flutter plugin which enables obtaining localized locale names from locale codes (ISO 639‑2 and ISO 639-3) for 563 locales.

This package is based on the flutter_localized_countries package. Data is taken from

Getting started

Adding the localizations delegate

This package bundles required assets and provides a LocalizationsDelegate for loading them. Specify localizationsDelegates for your MaterialApp, CupertinoApp, or WidgetsApp.

import 'package:flutter_localized_locales/flutter_localized_locales.dart';

void main() {
    localizationsDelegates: [
      // ... more localization delegates


Locale name

LocaleNames.of(context)!.nameOf(String locale)

// Invalid locale string
print(LocaleNames.of(context)!.nameOf('zzzzz'));    // null

// On a device whose locale is English (en)
print(LocaleNames.of(context)!.nameOf('fr_CA'));   // French (Canada)

// On a device whose locale is Spanish (es)
print(LocaleNames.of(context)!.nameOf('fr_CA'));   // francés (Canadá)

// On a device whose locale isn't supported, an attempt is made to find a supported one
// e.g. for a device whose locale is German (United Kingdom), returns German (de) names
print(LocaleNames.of(context)!.nameOf('fr_CA'));   // Französisch (Kanada)

// On a device whose selected locale isn't supported, and no supported locale can be found,
// fallback to English (en) names. 
// You can specify a different fallback locale
// e.g. to fallback to Afrikaans (af) names instead of English
LocaleNamesLocalizationsDelegate(fallbackLocale: 'af')

Supported locales are listed in lib/locales.dart.

All locale names, sorted



Respective locale names


For convenience, this package provides a map of locale codes to their respective locale names. This always returns the same data, irrespective of the device locale.

print(LocaleNamesLocalizationsDelegate.nativeLocaleNames);      // { ... af_ZA: Afrikaans (Suid-Afrika), ... ar: ال العربية السعودية) ...  as: অসমীয়া ... fr: Français ... en: English ... }

Known Bugs

ezoic increase your site revenue


Flutter plugin which provides locale code to name mappings for 563 locales.

License:MIT License


Language:Dart 90.1%Language:Shell 3.5%Language:Swift 3.0%Language:HTML 2.9%Language:Kotlin 0.3%Language:Objective-C 0.1%