blob: 58c74889a6e664262206a136b6f9fc2da6dda74c (
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
42
43
44
45
46
47
48
49
|
<div id="pageData-name" 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>
<h2 id="overview-examples">Examples</h2>
<p>
The following code gets accept-languages from the browser and displays 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>
-->
<p>
You can find simple examples of internationalization in the
<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/i18n/">examples/api/i18n</a>
directory.
For other examples and for help in viewing the source code, see
<a href="samples.html">Samples</a>.
</p>
<!-- END AUTHORED CONTENT -->
|