blob: 4ec9007d35d853f0edc29115a8c88f1ba8a61f1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<div id="pageData-title" class="pageData">i18n</div>
<!-- BEGIN AUTHORED CONTENT -->
<p id="classSummary">
Use the <code>chrome.i18n</code> module to manipulate the i18n related browser
settings, such as the accept languages.
<!-- [PENDING: add when getMessage works: "or to get localized messages for the current locale."] -->
</p>
<h3 id="overview-examples">Examples</h3>
<p>
The following code gets accept-languages from the browser and display them as a
string by separating each accept-language with ','.
</p>
<pre>
function getAcceptLanguages() {
chrome.i18n.getAcceptLanguages(function(languageList) {
var languages = languageList.join(",");
document.getElementById("languageSpan").innerHTML = languages;
})
}
</pre>
<!-- [PENDING: add the following when getMessage is working]
<p>
The following code gets a localized message from the browser and displays it as a
string. It replaces two placeholders within the message with values arg1 and
arg2.
</p>
<pre>
function getMessage() {
var message = chrome.i18n.getMessage("click_here", ["arg1", "arg2"]);
document.getElementById("languageSpan").innerHTML = message;
}
</pre>
-->
<!-- END AUTHORED CONTENT -->
|