-
Notifications
You must be signed in to change notification settings - Fork 0
SupportedLocales API
Adam Ormsby edited this page Jul 3, 2024
·
1 revision
// @returns List of language tags configured in your project
public fun getTags(): List<String>
/*
listOf(
"ar-XB",
"en",
"en-XA"
)
*/
// @returns Map of language tags and their written endoynms
public fun getEndonyms(): Map<String, String>
/*
mapOf(
"ar-XB" to "العربية (لكنات تجريبية ثنائية الاتجاه)",
"en" to "English",
"en-XA" to "English (Pseudo-Accents)"
)
*/
// @param languageTag a Unicode-formatted language tag in [String] form such as "en-US"
// @returns Map of language tags and their written exoynms according to the resolved languageTag
public fun getExonyms(): Map<String, String>
/*
param "en-US"
mapOf(
"ar-XB" to "Arabic (Pseudo-Bidi)",
"en" to "English",
"en-XA" to "English (Pseudo-Accents)"
)
*/
// @param a Java [Locale] object.
// @returns Map of language tags and their written exoynms according to the resolved languageTag
public fun getExonyms(): Map<String, String>
// overloaded to support preferred input
// injection use case
class YourNeatClass(
private val supportedLocales: SupportedLocales
) {
fun yourNeatFunc() {
val localeList = supportedLocales.getTags()
// do something with your new list
}
}