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

Function getMessage

onboarding/onboarding.js:53–68  ·  view source on GitHub ↗
(key, substitutions)

Source from the content-addressed store, hash-verified

51
52// Function to get a message (from custom locale or chrome.i18n)
53function getMessage(key, substitutions) {
54 // If we have custom locale messages and the key exists, use it
55 if (customLocaleMessages && customLocaleMessages[key]) {
56 let message = customLocaleMessages[key].message;
57 // Handle substitutions if provided
58 if (substitutions) {
59 const subs = Array.isArray(substitutions) ? substitutions : [substitutions];
60 subs.forEach((sub, index) => {
61 message = message.replace(`$${index + 1}`, sub);
62 });
63 }
64 return message;
65 }
66 // Otherwise, use chrome.i18n.getMessage
67 return chrome.i18n.getMessage(key, substitutions);
68}
69
70// Load all i18n text
71function loadI18nText() {

Callers 1

loadI18nTextFunction · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected