get back translations with android and java resources packages

This commit is contained in:
InsanusMokrassar 2023-12-12 21:41:09 +06:00
parent 0d01561476
commit 3bf6896296
2 changed files with 6 additions and 0 deletions

View File

@ -15,3 +15,7 @@ fun StringResource.translation(configuration: Configuration): String = translati
)
fun StringResource.translation(resources: Resources): String = translation(resources.configuration)
fun StringResource.translation(context: Context): String = translation(context.resources)
fun Configuration.translation(resource: StringResource): String = resource.translation(this)
fun Resources.translation(resource: StringResource): String = configuration.translation(resource)
fun Context.translation(resource: StringResource): String = resources.translation(resource)

View File

@ -6,3 +6,5 @@ import java.util.Locale
fun StringResource.translation(locale: Locale): String {
return translation(locale.toIetfLanguageCode())
}
fun Locale.translation(resource: StringResource): String = resource.translation(this)