The preferences API allows you to manipulate the browser preferences, such as the accept languages, URLs to restore on startup etc. For the full list of preferences, please refer to chrome/common/pref_names.cc. (Note: since the first version will only implement the access of accept languages, this document will focus on accept languages below.)
It allows extensions to read and write the browser preferences. Given accept languages as an example, page translation extension and dictionary extension will need to get the accept languages from the browser and use them as the targeted languages for page or word translation.
Given accept languages as an example, read accept languages could be part of the web platform, it could be exposed by window.navigator.acceptLanguages while UI language is exposed through widow.navigator.language. But we would also like to be able to modify accept languages preferences as well by extension, for example, it'd be nice if we could "learn" the accept-languages through translate, such as if you decline to translate a French page, that would be a good signal that you want it added to the accept-languages.
Read accept languages should be OK.
The first version will only implement the access of accept languages.
- Where should the accept-languages API live: chrome.preferences.acceptLanguages? or chrome.i18n.acceptLanguages?
- Any issues with modifying the browser's accept languages through extension API?