i18n.getMessage()

Gets the localized string for the specified message.

Syntax

browser.i18n.getMessage(
  messageName,  // string
  substitutions // optional any
)

Parameters

messageName
string. The name of the message, as specified in the messages.json file. If the message can't be found in messages.json:
  • Firefox returns ""??" and logs an error
  • Chrome returns "" and does not log an error.
substitutionsOptional
string or array of string. A single substitution string, or an array of substitution strings.
In Chrome, if you supply more than 9 substitution strings, getMessage() will return undefined.

Return value

string. Message localized for current locale.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic support48.0

Examples

Example add-ons

Acknowledgements

This API is based on Chromium's chrome.i18n API. This documentation is derived from i18n.json in the Chromium code.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,