mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-10-25 22:27:09 +00:00
improvements in language codes
This commit is contained in:
1 parent
18d63eb980
commit
85455ab21c
3 files changed
+20
No files matched your search
@@ -5,3 +5,11 @@ plugins {
|
||||
}
|
||||
|
||||
apply from: "$mppProjectWithSerializationPresetPath"
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
jvmMain {
|
||||
dependsOn androidMain
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package dev.inmo.micro_utils.language_codes
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
fun IetfLanguageCode.toJavaLocale(): Locale = Locale.forLanguageTag(code)
|
||||
fun IetfLanguageCode?.toJavaLocaleOrDefault(): Locale = this ?.toJavaLocale() ?: Locale.getDefault()
|
||||
|
||||
fun Locale.toIetfLanguageCode(): IetfLanguageCode = IetfLanguageCode(toLanguageTag())
|
||||
Reference in new issue
Block a user