improvements in resources

This commit is contained in:
2024-01-11 23:01:10 +06:00
parent cc623b1097
commit 805ab32b24
3 changed files with 19 additions and 1 deletions

View File

@@ -39,7 +39,10 @@ class StringResource(
fun build() = StringResource(default, map.toMap())
}
fun translation(languageCode: IetfLang): String {
fun translation(languageCode: IetfLang?): String {
if (languageCode == null) {
return default
}
map[languageCode] ?.let { return it.value }
return languageCode.parentLang ?.let {