OLD | NEW |
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
2 1) The <head> information in this page is significant, should be uniform | 2 1) The <head> information in this page is significant, should be uniform |
3 across api docs and should be edited only with knowledge of the | 3 across api docs and should be edited only with knowledge of the |
4 templating mechanism. | 4 templating mechanism. |
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
6 browser, it will be re-generated from the template, json schema and | 6 browser, it will be re-generated from the template, json schema and |
7 authored overview content. | 7 authored overview content. |
8 4) The <body>.innerHTML is also generated by an offline step so that this | 8 4) The <body>.innerHTML is also generated by an offline step so that this |
9 page may easily be indexed by search engines. | 9 page may easily be indexed by search engines. |
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 <a href="#properties">Properties</a> | 157 <a href="#properties">Properties</a> |
158 <ol> | 158 <ol> |
159 <li> | 159 <li> |
160 <a href="#property-anchor">propertyName</a> | 160 <a href="#property-anchor">propertyName</a> |
161 </li> | 161 </li> |
162 </ol> | 162 </ol> |
163 </li> | 163 </li> |
164 <li> | 164 <li> |
165 <a href="#methods">Methods</a> | 165 <a href="#methods">Methods</a> |
166 <ol> | 166 <ol> |
167 <li jsinstance="*0"> | 167 <li jsinstance="0"> |
168 <a href="#method-getAcceptLanguages">getAcceptLanguages<
/a> | 168 <a href="#method-getAcceptLanguages">getAcceptLanguages<
/a> |
| 169 </li><li jsinstance="*1"> |
| 170 <a href="#method-getMessage">getMessage</a> |
169 </li> | 171 </li> |
170 </ol> | 172 </ol> |
171 </li> | 173 </li> |
172 <li style="display: none; "> | 174 <li style="display: none; "> |
173 <a href="#events">Events</a> | 175 <a href="#events">Events</a> |
174 <ol> | 176 <ol> |
175 <li> | 177 <li> |
176 <a href="#event-anchor">eventName</a> | 178 <a href="#event-anchor">eventName</a> |
177 </li> | 179 </li> |
178 </ol> | 180 </ol> |
(...skipping 12 matching lines...) Expand all Loading... |
191 </ol> | 193 </ol> |
192 </div> | 194 </div> |
193 <!-- /TABLE OF CONTENTS --> | 195 <!-- /TABLE OF CONTENTS --> |
194 | 196 |
195 <!-- STATIC CONTENT PLACEHOLDER --> | 197 <!-- STATIC CONTENT PLACEHOLDER --> |
196 <div id="static"><div id="pageData-title" class="pageData">i18n</div> | 198 <div id="static"><div id="pageData-title" class="pageData">i18n</div> |
197 | 199 |
198 <!-- BEGIN AUTHORED CONTENT --> | 200 <!-- BEGIN AUTHORED CONTENT --> |
199 <p id="classSummary"> | 201 <p id="classSummary"> |
200 Use the <code>chrome.i18n</code> module to manipulate the i18n related browser | 202 Use the <code>chrome.i18n</code> module to manipulate the i18n related browser |
201 settings, such as the accept languages. | 203 settings, such as the accept languages, or to get localized messages for current |
| 204 locale. |
202 </p> | 205 </p> |
203 | 206 |
204 <h3 id="overview-examples">Examples</h3> | 207 <h3 id="overview-examples">Examples</h3> |
205 | 208 |
206 <p> | 209 <p> |
207 The following code gets accept-languages from the browser and display them as a | 210 The following code gets accept-languages from the browser and display them as a |
208 string by separating each accept-language with ','. | 211 string by separating each accept-language with ','. |
209 </p> | 212 </p> |
210 | 213 |
211 <pre>function getAcceptLanguages() { | 214 <pre>function getAcceptLanguages() { |
212 chrome.i18n.getAcceptLanguages(function(languageList) { | 215 chrome.i18n.getAcceptLanguages(function(languageList) { |
213 var languages = languageList.join(","); | 216 var languages = languageList.join(","); |
214 document.getElementById("languageSpan").innerHTML = languages; | 217 document.getElementById("languageSpan").innerHTML = languages; |
215 }) | 218 }) |
216 } | 219 } |
217 </pre> | 220 </pre> |
| 221 |
| 222 <p> |
| 223 The following code gets localized message from the browser and displays it as a |
| 224 string. It replaces two placeholders within the message with values arg1 and |
| 225 arg2. |
| 226 </p> |
| 227 |
| 228 <pre>function getMessage() { |
| 229 var message = chrome.i18n.getMessage("click_here", ["arg1", "arg2"]); |
| 230 document.getElementById("languageSpan").innerHTML = message; |
| 231 } |
| 232 </pre> |
218 <!-- END AUTHORED CONTENT --> | 233 <!-- END AUTHORED CONTENT --> |
219 </div> | 234 </div> |
220 | 235 |
221 <!-- API PAGE --> | 236 <!-- API PAGE --> |
222 <div class="apiPage"> | 237 <div class="apiPage"> |
223 <a name="apiReference"></a> | 238 <a name="apiReference"></a> |
224 <h2>API reference: chrome.i18n</h2> | 239 <h2>API reference: chrome.i18n</h2> |
225 | 240 |
226 <!-- PROPERTIES --> | 241 <!-- PROPERTIES --> |
227 <div class="apiGroup" style="display: none; "> | 242 <div class="apiGroup" style="display: none; "> |
(...skipping 12 matching lines...) Expand all Loading... |
240 </div> | 255 </div> |
241 | 256 |
242 </div> <!-- /apiGroup --> | 257 </div> <!-- /apiGroup --> |
243 | 258 |
244 <!-- METHODS --> | 259 <!-- METHODS --> |
245 <div class="apiGroup" id="methods"> | 260 <div class="apiGroup" id="methods"> |
246 <a name="methods"></a> | 261 <a name="methods"></a> |
247 <h3>Methods</h3> | 262 <h3>Methods</h3> |
248 | 263 |
249 <!-- iterates over all functions --> | 264 <!-- iterates over all functions --> |
250 <div class="apiItem" jsinstance="*0"> | 265 <div class="apiItem" jsinstance="0"> |
251 <a name="method-getAcceptLanguages"></a> <!-- method-anchor --> | 266 <a name="method-getAcceptLanguages"></a> <!-- method-anchor --> |
252 <h4>getAcceptLanguages</h4> | 267 <h4>getAcceptLanguages</h4> |
253 | 268 |
254 <div class="summary"><span style="display: none; ">void</span> | 269 <div class="summary"><span style="display: none; ">void</span> |
255 <!-- Note: intentionally longer 80 columns --> | 270 <!-- Note: intentionally longer 80 columns --> |
256 <span>chrome.i18n.getAcceptLanguages</span>(<span jsinstance="
*0" class="null"><span style="display: none; ">, </span><span>function</span> | 271 <span>chrome.i18n.getAcceptLanguages</span>(<span jsinstance="
*0" class="null"><span style="display: none; ">, </span><span>function</span> |
257 <var><span>callback</span></var></span>)</div> | 272 <var><span>callback</span></var></span>)</div> |
258 | 273 |
259 <div class="description"> | 274 <div class="description"> |
260 <p class="todo" style="display: none; ">Undocumented.</p> | 275 <p class="todo" style="display: none; ">Undocumented.</p> |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 </dl> | 396 </dl> |
382 </dd> | 397 </dd> |
383 </div> | 398 </div> |
384 </div> | 399 </div> |
385 </dl> | 400 </dl> |
386 </div> | 401 </div> |
387 </div> | 402 </div> |
388 | 403 |
389 </div> <!-- /description --> | 404 </div> <!-- /description --> |
390 | 405 |
| 406 </div><div class="apiItem" jsinstance="*1"> |
| 407 <a name="method-getMessage"></a> <!-- method-anchor --> |
| 408 <h4>getMessage</h4> |
| 409 |
| 410 <div class="summary"><span>string</span> |
| 411 <!-- Note: intentionally longer 80 columns --> |
| 412 <span>chrome.i18n.getMessage</span>(<span jsinstance="0" class
="null"><span style="display: none; ">, </span><span>string</span> |
| 413 <var><span>message_name</span></var></span><span jsinstanc
e="*1" class="optional"><span>, </span><span>string or array of string</span> |
| 414 <var><span><!--framePath //<!--frame0-->--></s
pan></var></span>)</div> |
| 415 |
| 416 <div class="description"> |
| 417 <p class="todo" style="display: none; ">Undocumented.</p> |
| 418 <p>Get a message from the extension language catalog, for a curr
ent locale.</p> |
| 419 |
| 420 <!-- PARAMETERS --> |
| 421 <h4>Parameters</h4> |
| 422 <dl> |
| 423 <div jsinstance="0"> |
| 424 <div> |
| 425 <dt> |
| 426 <var>message_name</var> |
| 427 <em> |
| 428 |
| 429 <!-- TYPE --> |
| 430 <div style="display:inline"> |
| 431 ( |
| 432 <span class="optional" style="display: none; ">optional</spa
n> |
| 433 <span id="typeTemplate"> |
| 434 <span style="display: none; "> |
| 435 <a> Type</a> |
| 436 </span> |
| 437 <span> |
| 438 <span style="display: none; "> |
| 439 array of <span><span></span></span> |
| 440 </span> |
| 441 <span>string</span> |
| 442 </span> |
| 443 </span> |
| 444 ) |
| 445 </div> |
| 446 |
| 447 </em> |
| 448 </dt> |
| 449 <dd class="todo" style="display: none; "> |
| 450 Undocumented. |
| 451 </dd> |
| 452 <dd>Message name from the extension catalog.</dd> |
| 453 |
| 454 <!-- OBJECT PROPERTIES --> |
| 455 <dd style="display: none; "> |
| 456 <dl> |
| 457 <div> |
| 458 <div> |
| 459 </div> |
| 460 </div> |
| 461 </dl> |
| 462 </dd> |
| 463 </div> |
| 464 </div><div jsinstance="*1"> |
| 465 <div> |
| 466 <dt> |
| 467 <var style="display: none; ">paramName</var> |
| 468 <em> |
| 469 |
| 470 <!-- TYPE --> |
| 471 <div style="display:inline"> |
| 472 ( |
| 473 <span class="optional">optional</span> |
| 474 <span id="typeTemplate"> |
| 475 <span style="display: none; "> |
| 476 <a> Type</a> |
| 477 </span> |
| 478 <span> |
| 479 <span style="display: none; "> |
| 480 array of <span><span></span></span> |
| 481 </span> |
| 482 <span>string or array of string</span> |
| 483 </span> |
| 484 </span> |
| 485 ) |
| 486 </div> |
| 487 |
| 488 </em> |
| 489 </dt> |
| 490 <dd class="todo" style="display: none; "> |
| 491 Undocumented. |
| 492 </dd> |
| 493 <dd>1 - 9 substitution parameters, if the message requires any.</dd> |
| 494 |
| 495 <!-- OBJECT PROPERTIES --> |
| 496 <dd style="display: none; "> |
| 497 <dl> |
| 498 <div> |
| 499 <div> |
| 500 </div> |
| 501 </div> |
| 502 </dl> |
| 503 </dd> |
| 504 </div> |
| 505 </div> |
| 506 </dl> |
| 507 |
| 508 <!-- RETURNS --> |
| 509 <h4>Returns</h4> |
| 510 <dl> |
| 511 <div> |
| 512 <div> |
| 513 <dt> |
| 514 <var style="display: none; ">paramName</var> |
| 515 <em> |
| 516 |
| 517 <!-- TYPE --> |
| 518 <div style="display:inline"> |
| 519 ( |
| 520 <span class="optional" style="display: none; ">optional</spa
n> |
| 521 <span id="typeTemplate"> |
| 522 <span style="display: none; "> |
| 523 <a> Type</a> |
| 524 </span> |
| 525 <span> |
| 526 <span style="display: none; "> |
| 527 array of <span><span></span></span> |
| 528 </span> |
| 529 <span>string</span> |
| 530 </span> |
| 531 </span> |
| 532 ) |
| 533 </div> |
| 534 |
| 535 </em> |
| 536 </dt> |
| 537 <dd class="todo" style="display: none; "> |
| 538 Undocumented. |
| 539 </dd> |
| 540 <dd>Message localized for current locale.</dd> |
| 541 |
| 542 <!-- OBJECT PROPERTIES --> |
| 543 <dd style="display: none; "> |
| 544 <dl> |
| 545 <div> |
| 546 <div> |
| 547 </div> |
| 548 </div> |
| 549 </dl> |
| 550 </dd> |
| 551 </div> |
| 552 </div> |
| 553 </dl> |
| 554 |
| 555 <!-- CALLBACK --> |
| 556 <div style="display: none; "> |
| 557 <div> |
| 558 <h4>Callback function</h4> |
| 559 <p> |
| 560 If you specify the <em>callback</em> parameter, |
| 561 it should specify a function that looks like this: |
| 562 </p> |
| 563 |
| 564 <!-- Note: intentionally longer 80 columns --> |
| 565 <pre>function(<span>Type param1, Type param2</span>) <span cla
ss="subdued">{...}</span>);</pre> |
| 566 <dl> |
| 567 <div> |
| 568 <div> |
| 569 </div> |
| 570 </div> |
| 571 </dl> |
| 572 </div> |
| 573 </div> |
| 574 |
| 575 </div> <!-- /description --> |
| 576 |
391 </div> <!-- /apiItem --> | 577 </div> <!-- /apiItem --> |
392 | 578 |
393 </div> <!-- /apiGroup --> | 579 </div> <!-- /apiGroup --> |
394 | 580 |
395 <!-- EVENTS --> | 581 <!-- EVENTS --> |
396 <div class="apiGroup" style="display: none; "> | 582 <div class="apiGroup" style="display: none; "> |
397 <a name="events"></a> | 583 <a name="events"></a> |
398 <h3 id="events">Events</h3> | 584 <h3 id="events">Events</h3> |
399 | 585 |
400 <!-- iterates over all events --> | 586 <!-- iterates over all events --> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 urchinTracker(); | 664 urchinTracker(); |
479 } | 665 } |
480 catch(e) {/* urchinTracker not available. */} | 666 catch(e) {/* urchinTracker not available. */} |
481 </script> | 667 </script> |
482 <!-- end analytics --> | 668 <!-- end analytics --> |
483 | 669 |
484 </div> <!-- /pageFooter --> | 670 </div> <!-- /pageFooter --> |
485 </div> <!-- /container --> | 671 </div> <!-- /container --> |
486 </body></html> | 672 </body></html> |
487 | 673 |
OLD | NEW |