Last active
February 11, 2024 10:29
-
-
Save EduardoAC/1261f807ee1889c9c3625155fda08ade to your computer and use it in GitHub Desktop.
Helper to manage language updates by broadcasting the language change, along with the new translation, to the content scripts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function updateLanguage(language: LanguagesSupported) { | |
chrome.storage.local.set({ language }); | |
broadcastMessageAllTabs({ | |
type: "languageUpdated", | |
data: { | |
language: language, | |
translations: i18n.getDataByLanguage(language), | |
}, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment