commonNameFor<B extends L> method
Returns a localized common name for this object.
Parameters:
mainLocale: Required primary locale for translation lookupfallbackLocale: Optional secondary locale to use if main locale translation is missing.useLanguageFallback: Whether to try language-only codes when specific locale not found.orElse: Default value to return if translation is not found, defaults to empty string.
Example:
// Returns German common name for the language or `orElse` if not found.
final name = language.commonNameFor(const BasicLocale(LangDeu()));
Implementation
String commonNameFor<B extends L>(
B mainLocale, {
B? fallbackLocale,
bool useLanguageFallback = true,
String orElse = "",
}) =>
l10n.commonNamesMap(
{this},
options: LocaleMappingOptions<B>(
mainLocale: mainLocale,
fallbackLocale: fallbackLocale,
useLanguageFallback: useLanguageFallback,
),
)[this] ??
orElse;