Search packages, repositories and app categories

Package detailsv2.0.5

flutter_localized_locales

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

AndroidiOSWebmacOSWindowsLinux
30-day downloads
656K
Likes
64
Pub points
150

Install package

flutter pub add flutter_localized_locales

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that provides mappings from locale codes to their human-readable names for 563 locales. It simplifies localization by enabling developers to display localized language and country names in apps, improving user experience across international audiences. The package supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux. It is ideal for applications requiring accurate and consistent locale naming without manual data management.

Use cases

  • Displaying localized language names in dropdowns
  • Supporting multi-language app interfaces
  • Enhancing user settings with readable locale labels
  • Building language selection screens
  • Internationalizing app metadata
  • Providing accurate country and language labels

Key features

  • 563 locale code to name mappings
  • Cross-platform compatibility
  • Simple API integration
  • No external dependencies
  • Maintained and up-to-date
  • Open-source on GitHub

Suitable for

  • Apps targeting global users
  • Localization-heavy applications
  • Language picker components
  • Internationalized UI elements
  • Developers seeking ready-made locale data

Considerations

  • Does not include translations or strings
  • Requires additional packages for full i18n
  • Locale names are static and not customizable
  • Not intended for runtime translation
  • Limited to name mapping only

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

flutter_localized_locales

pub package

flutter_localized_locales is a Flutter package which enables obtaining localized locale names from locale codes (ISO 639‑1) for 563 locales.

This package is based on the flutter_localized_countries package. Data is taken from https://github.com/umpirsky/locale-list.

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() {
  runApp(MaterialApp(
    localizationsDelegates: [
      LocaleNamesLocalizationsDelegate(),
      // ... more localization delegates
    ],
    ...
  );

Usage

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

LocaleNames.sortedByCode()

LocaleNames.sortedByName()

Respective locale names

LocaleNamesLocalizationsDelegate.nativeLocaleNames

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

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package