연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
flutter_localized_locales

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(),
],
...
);
Usage
Locale name
LocaleNames.of(context)!.nameOf(String locale)
print(LocaleNames.of(context)!.nameOf('zzzzz'));
print(LocaleNames.of(context)!.nameOf('fr_CA'));
print(LocaleNames.of(context)!.nameOf('fr_CA'));
print(LocaleNames.of(context)!.nameOf('fr_CA'));
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);
Known Bugs