Why does Locale.getDefault().getLanguage() in Android return the display name instead of the language code?

前端 未结 4 1050
青春惊慌失措
青春惊慌失措 2021-02-14 02:56

According to the Java reference, Locale.getLanguage() is supposed to return the 2-letters lowercase ISO code of the language (e.g. en), while get

4条回答
  •  失恋的感觉
    2021-02-14 03:03

    Use

    getResources().getConfiguration().locale.getLanguage()

    and it will work just fine even though I would consider your observed behaviour a bug worth reporting..

提交回复
热议问题