Skip to content

Commit

Permalink
Merge pull request #390 from KasperskyLab/issue-389/change_locale_to-…
Browse files Browse the repository at this point in the history
…sr-Latn-RS

hotfix to change locale in app to sr-Latn-RS
  • Loading branch information
AzamatCherchesov authored Oct 6, 2022
2 parents c7805fe + 02fa217 commit b5d3e29
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.kaspersky.kaspresso.device.languages

import android.app.Activity
import android.content.Context
import android.os.Build
import androidx.core.os.ConfigurationCompat
import androidx.test.runner.lifecycle.ActivityLifecycleCallback
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry
Expand Down Expand Up @@ -69,6 +70,14 @@ class LanguageImpl(
Locale.setDefault(locale)
val configuration = resources.configuration
configuration.setLocale(locale)
// For issue DocLocScreenshotTestCase does not change locale to sr-Latn-RS: https://github.com/KasperskyLab/Kaspresso/issues/389
// added hotfix. For next releases we will find more correct solution.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (locale.country.equals("Latn", true) &&
locale.language.equals("sr", true)) {
configuration.setLocale(Locale.Builder().setLanguage("sr").setScript("Latn").build())
}
}
resources.updateConfiguration(configuration, resources.displayMetrics)
}
}

0 comments on commit b5d3e29

Please sign in to comment.