When using chrome's chrome.i18n API, the chrome.i18n.getMessage method retrieves only one message at a time.
const buttonText = chrome.i18n.getMessage('buttonText');
What I want is to update the popup UI when the popup opens with the localized contents of message.json file. Doing so requires me to know the message names used. Is there a method/technique similar to getMessage for retrieving all the contents of the message.json file at once?
Right now, I can only keep all the message names somewhere and retrieve each localized message individually like:
const messages = ["buttonText", "buttonTitle"];
messages.forEach((message) => {
const messageText = chrome.i18n.getMessage(message);
// Update UI
});