MCPcopy Create free account
hub / github.com/Yorick-Ryu/deep-share / loadLocaleMessages

Function loadLocaleMessages

onboarding/onboarding.js:36–50  ·  view source on GitHub ↗
(locale)

Source from the content-addressed store, hash-verified

34
35// Function to load messages from a specific locale file
36async function loadLocaleMessages(locale) {
37 try {
38 const url = chrome.runtime.getURL(`_locales/${locale}/messages.json`);
39 const response = await fetch(url);
40 if (response.ok) {
41 customLocaleMessages = await response.json();
42 } else {
43 console.error(`Failed to load locale ${locale}:`, response.status);
44 customLocaleMessages = null;
45 }
46 } catch (error) {
47 console.error(`Error loading locale ${locale}:`, error);
48 customLocaleMessages = null;
49 }
50}
51
52// Function to get a message (from custom locale or chrome.i18n)
53function getMessage(key, substitutions) {

Callers 1

loadLanguagePreferenceFunction · 0.70

Calls 2

jsonMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected