Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/common/extensions/docs/static/i18n.html

Issue 225009: Implementing chrome.i18n.getMessage call, that loads message from the extensi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <div id="pageData-title" class="pageData">i18n</div> 1 <div id="pageData-title" class="pageData">i18n</div>
2 2
3 <!-- BEGIN AUTHORED CONTENT --> 3 <!-- BEGIN AUTHORED CONTENT -->
4 <p id="classSummary"> 4 <p id="classSummary">
5 Use the <code>chrome.i18n</code> module to manipulate the i18n related browser 5 Use the <code>chrome.i18n</code> module to manipulate the i18n related browser
6 settings, such as the accept languages. 6 settings, such as the accept languages, or to get localized messages for current
7 locale.
7 </p> 8 </p>
8 9
9 <h3 id="overview-examples">Examples</h3> 10 <h3 id="overview-examples">Examples</h3>
10 11
11 <p> 12 <p>
12 The following code gets accept-languages from the browser and display them as a 13 The following code gets accept-languages from the browser and display them as a
13 string by separating each accept-language with ','. 14 string by separating each accept-language with ','.
14 </p> 15 </p>
15 16
16 <pre> 17 <pre>
17 function getAcceptLanguages() { 18 function getAcceptLanguages() {
18 chrome.i18n.getAcceptLanguages(function(languageList) { 19 chrome.i18n.getAcceptLanguages(function(languageList) {
19 var languages = languageList.join(","); 20 var languages = languageList.join(",");
20 document.getElementById("languageSpan").innerHTML = languages; 21 document.getElementById("languageSpan").innerHTML = languages;
21 }) 22 })
22 } 23 }
23 </pre> 24 </pre>
25
26 <p>
27 The following code gets localized message from the browser and displays it as a
28 string. It replaces two placeholders within the message with values arg1 and
29 arg2.
30 </p>
31
32 <pre>
33 function getMessage() {
34 var message = chrome.i18n.getMessage("click_here", ["arg1", "arg2"]);
35 document.getElementById("languageSpan").innerHTML = message;
36 }
37 </pre>
24 <!-- END AUTHORED CONTENT --> 38 <!-- END AUTHORED CONTENT -->
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698