(locale)
| 34 | |
| 35 | // Function to load messages from a specific locale file |
| 36 | async 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) |
| 53 | function getMessage(key, substitutions) { |
no test coverage detected