android - BiometricPrompt 提示未本地化

标签 android translation android-biometric-prompt

问题

我们正在更改应用程序内的区域设置,除了指纹对话框中的提示外,一切正常。无论我们设置什么语言,我们总是有英文提示:

  • 触摸指纹传感器
  • 不认识
  • 等...

enter image description here

环境

  • 使用的组件:androidx.biometric.BiometricPrompt
  • 使用的版本:1.0.0.0-alpha04
  • 设备/Android 版本转载于:模拟器 API 28

语言环境是如何设置的:

    private fun setNewLocaleAndRestart(language: String) {
        LocaleManager(this).setNewLocale(language)

        //restarting app
        val i = Intent(this, SplashScreenActivity::class.java)
        startActivity(i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK))
        finish()
        System.exit(0)
    }

class LocaleManager(val context: Context) {

    val sharedPreferenceManager = createSharedPreferenceManager(context)

    fun setLocale(): Context = updateResources()

    fun setNewLocale(language: String): Context {
        return updateResources(language)
    }


    private fun updateResources(l: String? = null): Context {

        val language = l ?: sharedPreferenceManager.language

        if (language.isBlank()) return context

        val locale = Locale(language)

        Locale.setDefault(locale)

        val res = context.resources
        val config = Configuration(res.configuration)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            config.setLocale(locale)
            return context.createConfigurationContext(config)
        } else @Suppress("DEPRECATION") {
            config.locale = locale
            res.updateConfiguration(config, res.displayMetrics)
            return context
        }

    }
}

最佳答案

everything works except the hints in the fingerprint dialog

所有系统对话框都将使用用户为设备设置的语言。这包括用于生物识别的系统对话框。

关于android - BiometricPrompt 提示未本地化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56046832/

相关文章:

android - 如何在android中添加双击按钮

javascript - 如何生成静态 Django JavaScript 翻译目录

安卓模拟器人脸识别

java - 如何使用 BiometricManager 或 BiometricPrompt 检查生物识别硬件是否可用?

javascript - ios5 iPad 的功能无法正常工作

android - 生物识别提示字幕文本在 Android 上被截断

java - 语法错误,插入 ";"来完成 BlockStatements GreenDroid

android - RecyclerView 在 smoothScrollToPosition(0) 之后滚动结束

Android重复http连接

3d - Three.js - 翻译与移动?