diff --git a/src/pages/Background/index.js b/src/pages/Background/index.js index 8815deb..51833c6 100644 --- a/src/pages/Background/index.js +++ b/src/pages/Background/index.js @@ -1,6 +1,5 @@ import countryLocales from '../../utils/countryLocales' - const attachTab = (tabId, ipData) => { chrome.storage.sync.get( [ @@ -11,6 +10,8 @@ const attachTab = (tabId, ipData) => { 'latitudeMatchIP', 'lon', 'longitudeMatchIP', + 'locale', + 'localeMatchIP', ], (result) => { chrome.debugger.attach({ tabId: tabId }, '1.3', function () { @@ -38,7 +39,11 @@ const attachTab = (tabId, ipData) => { chrome.debugger.sendCommand( { tabId: tabId }, 'Emulation.setLocaleOverride', - { locale: countryLocales[result.ipData.countryCode].locale } + { + locale: result.localeMatchIP + ? countryLocales[result.ipData.countryCode].locale + : result.locale, + } ) const latitude = result.latMatchIP @@ -48,8 +53,6 @@ const attachTab = (tabId, ipData) => { ? result.ipData.lon : parseFloat(result.lon) - console.log(latitude, longitude) - chrome.debugger.sendCommand( { tabId: tabId }, 'Emulation.setGeolocationOverride',