Sure thing. My rewrite should be encapsulated enough that you can just make a script that says
chrome.i18n = {
// paste in all of my chrome.i18n definition here,
// with 'navigator.language' replaced with
// 'localStorage.locale_pref || "en" ' throughout.
};
and you should be good to go. Be aware that if you want to use chrome.i18n.getMessage from within a content script (as opposed to the background/options pages/other pages), the content script will need to call
chrome.extension.sendRequest("send-me-l10n-data", function(data) {
chrome.i18n._setL10nData(data);
// code from here on can use chrome.i18n.getMessage()
});
// code from here on cannot use chrome.i18n.getMessage()
and the background page would then need to run
chrome.extension.onRequest(function(request, sender, sendResponse) {
if (request == 'send-me-l10n-data')
sendResponse(chrome.i18n._getL10nData();
});
Drop me a line if you do end up using my code -- I'd be happy to know it's getting reused :)
Michael