简体   繁体   中英

Change the language in the application completely

面对这样一个问题,即应用程序的语言无法完全更改,如果我更改了语言,那么乍一看一切都很好,但是如果我打开alertdialog,该语言将与系统中的语言相同,但不是那是手动选择的。

Tried to get title string from strings.xml.

alert.setTitle(getResources().getString(R.string.abc));  

Now create two different folders for different language and put same name of xml in both folder with different language.

For English language android will pick res/values/strings.xml folder:

<string name="abc">abc</string>

For polish language android will pick res/values-pl/strings.xml folder:

<string name="abc">ABC</string>

You have to be sure that the Context of your application is completely updated. Dialogs use the application context, so that is the reason they are not displayed in the new language. This is the reason why most of the apps ask your for reopen the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM