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