Last updated:
0 purchases
locale names
Locale Names #
A Flutter package that provide locale display names in locales, by adding extension on Locale from dart:ui.
Installation #
Add locale_names as a dependency in your pubspec.yaml file.
dependencies:
locale_names:
copied to clipboard
Import locale_names in files that it will be used:
import 'package:locale_names/locale_names.dart';
copied to clipboard
Usage #
Get language display name in default locale, which is english.
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.defaultDisplayLanguage);
copied to clipboard
Get language and script display name in default locale, which is english.
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.defaultDisplayLanguageScript);
copied to clipboard
Get country display name in default locale, which is english.
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.defaultDisplayCountry);
copied to clipboard
Get language display name in native locale.
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.nativeDisplayLanguage);
copied to clipboard
Get language and script display name in native locale.
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.nativeDisplayLanguageScript);
copied to clipboard
Get country display name in native locale.
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.nativeDisplayCountry);
copied to clipboard
Get language display name in a specific locale.
Locale fr = Locale.fromSubtags(languageCode: "fr");
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.displayLanguageIn(fr));
copied to clipboard
Get language and script display name in a specific locale.
Locale fr = Locale.fromSubtags(languageCode: "fr");
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.displayLanguageScriptIn(fr));
copied to clipboard
Get country display name in a specific locale.
Locale fr = Locale.fromSubtags(languageCode: "fr");
Locale locale = Locale.fromSubtags(
languageCode: 'zh', scriptCode: "Hans", countryCode: 'CN');
print(locale.displayCountryIn(fr));
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.