Reputation: 479
How a browser will get the client machine locale value. I am curious about internal process of how an browser picks up the Operating System locale value of the client machine. (i.e for the Browser/any app that is running on the client OS, which variable value does these apps/browser will fetch and send as the request header info?)
Upvotes: 1
Views: 64
Reputation: 1527
Fascinating question.
Firefox has shown how it gets this according to different Operating Systems here : https://dxr.mozilla.org/mozilla-esr45/source/intl/locale/nsLocaleService.cpp?q=nslocaleservice&redirect_type=direct#69
From that I have created a list for you
Also, Androids Chromium browser which was built in c++ makes a call to Java.LocaleUtils which uses Java's Locale.getDefault()
std::string GetDefaultLocaleString() {
JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jstring> locale =
Java_LocaleUtils_getDefaultLocaleString(env);
return ConvertJavaStringToUTF8(locale);
}
https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#getDefault()
Upvotes: 1