Skip to content

Instantly share code, notes, and snippets.

@EduardoAC
Last active February 11, 2024 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EduardoAC/1261f807ee1889c9c3625155fda08ade to your computer and use it in GitHub Desktop.
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.
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