paramName
( optional Type array of paramType )
Undocumented.
Description of this parameter from the json schema.
i18n

Use the chrome.i18n module to manipulate the i18n related browser settings, such as the accept languages, or to get localized messages for current locale.

Examples

The following code gets accept-languages from the browser and display them as a string by separating each accept-language with ','.

function getAcceptLanguages() {
  chrome.i18n.getAcceptLanguages(function(languageList) {
    var languages = languageList.join(",");
    document.getElementById("languageSpan").innerHTML = languages;
  })
}

The following code gets localized message from the browser and displays it as a string. It replaces two placeholders within the message with values arg1 and arg2.

function getMessage() {
  var message = chrome.i18n.getMessage("click_here", ["arg1", "arg2"]);
  document.getElementById("languageSpan").innerHTML = message;
}

API reference: chrome.i18n

Methods

getAcceptLanguages

void chrome.i18n.getAcceptLanguages(, function callback)

Get accept languages of browser

Parameters

callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(array of string languages) {...});
languages
( Type array of Type array of string paramType )
Array of the accept languages of the browser, such as en-US,en,zh-CN

getMessage

string chrome.i18n.getMessage(, string message_name, string or array of string <!--framePath //<!--frame0-->-->)

Get a message from the extension language catalog, for a current locale.

Parameters

message_name
( Type array of string )
Message name from the extension catalog.
paramName
( optional Type array of string or array of string )
1 - 9 substitution parameters, if the message requires any.

Returns

paramName
( Type array of string )
Message localized for current locale.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});