localization - Get the language of user in android -


http://web.archiveorange.com/archive/v/fwvde0wn3xcvimtadw6x

it seems navigator.language property "en" in webview on androids. then, best way language of user? in native java code , pour webview javascript? or other better way?

the solution found problem set user agent through webview's settings:

websettings settings = wv.getsettings(); settings.setjavascriptenabled(true); settings.setuseragentstring(locale.getdefault().getlanguage()); 

in webcontent retrieve through:

var userlang = navigator.useragent; 

this should used webview displaying local content.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -