1

我在使用默认的 android 拼写检查器时遇到问题:它不想切换到其他语言。相反,它使用默认系统语言进行拼写检查。

拼写检查器使用默认语言,但是当我将区域设置更改为其他语言时,它不会给我更正的单词,但是当我更改系统的语言时,拼写检查工作正常。

这是我的代码:

   TextServicesManager tsm = (TextServicesManager) context.getSystemService(
            Context.TEXT_SERVICES_MANAGER_SERVICE);

    Locale locale = new Locale("fr"); //whatever language
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.setLocale(locale);
    config.locale = locale;
    Resources res = ctx.getResources();
    res.updateConfiguration(config, res.getDisplayMetrics());

    spellChecherSession = tsm.newSpellCheckerSession(null, locale, this, true);

我阅读了文档,但我不明白我做错了什么。

我已经尝试从这里的多个答案中修改语言环境和配置,但它对我不起作用。

请帮助解决这个问题。

谢谢。

4

0 回答 0