Reputation: 11
I'm working on a Chromium project, which requires change the default language from english to Chinese from the source code,and now open a Chinese page will appear garbled situation.
I modify the method GetApplicationLocale() in src/content/public/browser/content_browser_client.cc: return "en-US"
to return "zh-CN"
, but it doesn't work.
I want to change the language by modifing the source code rather than the setting button "Language and input settings".
Upvotes: 0
Views: 547
Reputation: 1225
It is not possible to change the language of browser from source code. You can detect which language it is currently using and then ask user to change it. Here is how you can do it using javaScript:
var language = navigator.language || navigator.userLanguage;
Upvotes: 0