Hello guys first excuse me for poor language. I am going to build web page with multiple languages is there any way to get texts belong to device language?. Thank you.
Asked
Active
Viewed 85 times
1 Answers
0
Use this code to get the current language selected in the Android device
Locale.getDefault().getLanguage() ---> en
Locale.getDefault().getISO3Language() ---> eng
Locale.getDefault().getCountry() ---> US
Locale.getDefault().getISO3Country() ---> USA
Locale.getDefault().toString() ---> en_US
Locale.getDefault().getDisplayLanguage() ---> English
Locale.getDefault().getDisplayCountry() ---> United States
Locale.getDefault().getDisplayName() ---> English (United States)
To load the language dependent URL you can set the proper url to you webview like this.
String mUrl = "http://example.com/" + Locale.getDefault().getLanguage() + ".html"
WebView vw = (WebView) v.findViewById(R.id.loup_webview);
vw.setWebViewClient(new WebViewClient());
vw.loadUrl(mUrl);

Rostislav Pashuto
- 196
- 1
- 10