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

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

Issue 10642015: Basic setup for generating app docs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
« no previous file with comments | « chrome/common/extensions/docs/i18n.html ('k') | chrome/common/extensions/docs/idle.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 across api docs and should be edited only with knowledge of the
4 templating mechanism.
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
7 authored overview content.
8 4) The <body>.innerHTML is also generated by an offline step so that this
9 page may easily be indexed by search engines.
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head>
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css">
13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print">
14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla te_compiled.js">
15 </script>
16 <script type="text/javascript" src="../../../../third_party/json_minify/mini fy-sans-regexp.js">
17 </script>
18 <script type="text/javascript" src="js/api_page_generator.js"></script>
19 <script type="text/javascript" src="js/bootstrap.js"></script>
20 <script type="text/javascript" src="js/sidebar.js"></script>
21 <title>Formats: Locale-Specific Messages - Google Chrome Extensions - Google C ode</title></head>
22 <body> <div id="devModeWarning" class="displayModeWarning">
23 You are viewing extension docs in chrome via the 'file:' scheme: are you exp ecting to see local changes when you refresh? You'll need run chrome with --allo w-file-access-from-files.
24 </div>
25 <div id="branchWarning" class="displayModeWarning">
26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation.
27 It may not work with the stable release of Chrome.</span>
28 <select id="branchChooser">
29 <option>Choose a different version...
30 </option><option value="">Stable
31 </option><option value="beta">Beta
32 </option><option value="dev">Dev
33 </option><option value="trunk">Trunk
34 </option></select>
35 </div>
36 <div id="unofficialWarning" class="displayModeWarning">
37 <span>WARNING: This is unofficial documentation. It may not work with the
38 current release of Chrome.</span>
39 <button id="goToOfficialDocs">Go to the official docs</button>
40 </div>
41 <div id="gc-container" class="labs">
42 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION -->
43 <!-- In particular, sub-templates that recurse, must be used by allowing
44 jstemplate to make a copy of the template in this section which
45 are not operated on by way of the jsskip="true" -->
46 <!-- /SUBTEMPLATES -->
47 <a id="top"></a>
48 <div id="skipto">
49 <a href="#gc-pagecontent">Skip to page content</a>
50 <a href="#gc-toc">Skip to main navigation</a>
51 </div>
52 <!-- API HEADER -->
53 <table id="header" width="100%" cellspacing="0" border="0">
54 <tbody><tr>
55 <td valign="middle"><a href="http://code.google.com/"><img src="images/c ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border: 0; margin:0;"></a></td>
56 <td valign="middle" width="100%" style="padding-left:0.6em;">
57 <form action="http://www.google.com/cse" id="cse" style="margin-top:0. 5em">
58 <div id="gsc-search-box">
59 <input type="hidden" name="cx" value="002967670403910741006:61_cvz fqtno">
60 <input type="hidden" name="ie" value="UTF-8">
61 <input type="text" name="q" value="" size="55">
62 <input class="gsc-search-button" type="submit" name="sa" value="Se arch">
63 <br>
64 <span class="greytext">e.g. "page action" or "tabs"</span>
65 </div>
66 </form>
67 <script type="text/javascript" src="https://www.google.com/jsapi"></sc ript>
68 <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
69 <script type="text/javascript" src="https://www.google.com/coop/cse/t1 3n?form=cse&amp;t13n_langs=en"></script>
70 <script type="text/javascript" src="https://www.google.com/coop/cse/br and?form=cse&amp;lang=en"></script>
71 </td>
72 </tr>
73 </tbody></table>
74 <div id="codesiteContent" class="">
75 <a id="gc-topnav-anchor"></a>
76 <div id="gc-topnav">
77 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab s</a>)</h1>
78 <ul id="home" class="gc-topnav-tabs">
79 <li id="home_link">
80 <a href="index.html" title="Google Chrome Extensions home page">Home </a>
81 </li>
82 <li id="docs_link">
83 <a href="docs.html" title="Official Google Chrome Extensions documen tation">Docs</a>
84 </li>
85 <li id="faq_link">
86 <a href="faq.html" title="Answers to frequently asked questions abou t Google Chrome Extensions">FAQ</a>
87 </li>
88 <li id="samples_link">
89 <a href="samples.html" title="Sample extensions (with source code)"> Samples</a>
90 </li>
91 <li id="group_link">
92 <a href="http://groups.google.com/a/chromium.org/group/chromium-exte nsions" title="Google Chrome Extensions developer forum">Group</a>
93 </li>
94 <li id="so_link">
95 <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a>
96 </li>
97 </ul>
98 </div> <!-- end gc-topnav -->
99 <div class="g-section g-tpl-170">
100 <!-- SIDENAV -->
101 <div class="g-unit g-first" id="gc-toc">
102 <ul>
103 <li><a href="getstarted.html">Getting Started</a></li>
104 <li><a href="overview.html">Overview</a></li>
105 <li><a href="whats_new.html">What's New?</a></li>
106 <li><h2><a href="devguide.html">Developer's Guide</a></h2>
107 <ul>
108 <li>Browser UI
109 <ul>
110 <li><a href="browserAction.html">Browser Actions</a></li>
111 <li><a href="contextMenus.html">Context Menus</a></li>
112 <li><a href="notifications.html">Desktop Notifications</a></li >
113 <li><a href="omnibox.html">Omnibox</a></li>
114 <li><a href="options.html">Options Pages</a></li>
115 <li><a href="override.html">Override Pages</a></li>
116 <li><a href="pageAction.html">Page Actions</a></li>
117 </ul>
118 </li>
119 <li>Browser Interaction
120 <ul>
121 <li><a href="bookmarks.html">Bookmarks</a></li>
122 <li><a href="cookies.html">Cookies</a></li>
123 <li><a href="devtools.html">Developer Tools</a></li>
124 <li><a href="events.html">Events</a></li>
125 <li><a href="history.html">History</a></li>
126 <li><a href="management.html">Management</a></li>
127 <li><a href="tabs.html">Tabs</a></li>
128 <li><a href="windows.html">Windows</a></li>
129 </ul>
130 </li>
131 <li>Implementation
132 <ul>
133 <li><a href="a11y.html">Accessibility</a></li>
134 <li><a href="background_pages.html">Background Pages</a></li>
135 <li><a href="content_scripts.html">Content Scripts</a></li>
136 <li><a href="xhr.html">Cross-Origin XHR</a></li>
137 <li><a href="i18n.html">Internationalization</a></li>
138 <li><a href="messaging.html">Message Passing</a></li>
139 <li><a href="permissions.html">Optional Permissions</a></li>
140 <li><a href="npapi.html">NPAPI Plugins</a></li>
141 </ul>
142 </li>
143 <li>Finishing
144 <ul>
145 <li><a href="hosting.html">Hosting</a></li>
146 <li><a href="external_extensions.html">Other Deployment Option s</a></li>
147 </ul>
148 </li>
149 </ul>
150 </li>
151 <li><h2><a href="apps.html">Packaged Apps</a></h2></li>
152 <li><h2><a href="tutorials.html">Tutorials</a></h2>
153 <ul>
154 <li><a href="tut_debugging.html">Debugging</a></li>
155 <li><a href="tut_analytics.html">Google Analytics</a></li>
156 <li><a href="tut_oauth.html">OAuth</a></li>
157 </ul>
158 </li>
159 <li><h2>Reference</h2>
160 <ul>
161 <li>Formats
162 <ul>
163 <li><a href="manifest.html">Manifest Files</a></li>
164 <li><a href="match_patterns.html">Match Patterns</a></li>
165 </ul>
166 </li>
167 <li><a href="permission_warnings.html">Permission Warnings</a></li >
168 <li><a href="api_index.html">chrome.* APIs</a></li>
169 <li><a href="api_other.html">Other APIs</a></li>
170 </ul>
171 </li>
172 <li><h2><a href="samples.html">Samples</a></h2></li>
173 <div class="line"> </div>
174 <li><h2>More</h2>
175 <ul>
176 <li><a href="http://code.google.com/chrome/webstore/docs/index.htm l">Chrome Web Store</a></li>
177 <li><a href="http://code.google.com/chrome/apps/docs/developers_gu ide.html">Hosted Apps</a></li>
178 <li><a href="themes.html">Themes</a></li>
179 </ul>
180 </li>
181 </ul>
182 </div>
183 <script>
184 initToggles();
185 </script>
186 <div class="g-unit" id="gc-pagecontent">
187 <div id="pageTitle">
188 <h1 class="page_title">Formats: Locale-Specific Messages</h1>
189 </div>
190 <!-- TABLE OF CONTENTS -->
191 <div id="toc">
192 <h2>Contents</h2>
193 <ol>
194 <li>
195 <a href="#overview"> Field summary </a>
196 <ol>
197 </ol>
198 </li><li>
199 <a href="#example"> Example </a>
200 <ol>
201 </ol>
202 </li><li>
203 <a href="#H2-2">Field details</a>
204 <ol>
205 <li>
206 <a href="#name">name</a>
207 </li><li>
208 <a href="#message">message</a>
209 </li><li>
210 <a href="#description">description</a>
211 </li><li>
212 <a href="#placeholders">placeholders</a>
213 </li>
214 </ol>
215 </li>
216 </ol>
217 </div>
218 <!-- /TABLE OF CONTENTS -->
219 <!-- Standard content lead-in for experimental API pages -->
220 <!-- STATIC CONTENT PLACEHOLDER -->
221 <div id="static"><div id="pageData-name" class="pageData">Formats: Local e-Specific Messages</div>
222 <div id="pageData-showTOC" class="pageData">true</div>
223 <p>
224 Each internationalized extension has at least one
225 file named <code>messages.json</code>
226 that provides locale-specific strings for the extension.
227 This page describes the format of <code>messages.json</code> files.
228 For information on how to internationalize and localize your extension,
229 see the <a href="i18n.html">Internationalization</a> page.
230 </p>
231 <h2 id="overview"> Field summary </h2>
232 <p>
233 The following code shows the supported fields for
234 <code>messages.json</code>.
235 Only the "<em>name</em>" and "message" fields are required.
236 </p>
237 <pre>{
238 "<a href="#name"><em>name</em></a>": {
239 "<a href="#message">message</a>": "<em>Message text, with optional placehold ers.</em>",
240 "<a href="#description">description</a>": "<em>Translator-aimed description of the message.</em>",
241 "<a href="#placeholders">placeholders</a>": {
242 "<em>placeholder_name</em>": {
243 "content": "<em>A string to be placed within the message.</em>",
244 "example": "<em>Translator-aimed example of the placeholder string.</em> "
245 },
246 ...
247 }
248 },
249 ...
250 }
251 </pre>
252 <h2 id="example"> Example </h2>
253 <p>
254 Here's a <code>messages.json</code> file
255 that defines three messages
256 named "prompt_for_name", "hello", and "bye":
257 </p>
258 <pre>{
259 "prompt_for_name": {
260 "message": "What's your name?",
261 "description": "Ask for the user's name"
262 },
263 "hello": {
264 "message": "Hello, $USER$",
265 "description": "Greet the user",
266 "placeholders": {
267 "user": {
268 "content": "$1",
269 "example": "Cira"
270 }
271 }
272 },
273 "bye": {
274 "message": "Goodbye, $USER$. Come back to $OUR_SITE$ soon!",
275 "description": "Say goodbye to the user",
276 "placeholders": {
277 "our_site": {
278 "content": "Example.com",
279 },
280 "user": {
281 "content": "$1",
282 "example": "Cira"
283 }
284 }
285 }
286 }
287 </pre>
288 <a name="H2-2"></a><h2>Field details</h2>
289 <p>
290 This section describes each field
291 that can appear in a <code>messages.json</code> file.
292 For details on how the messages file is used —
293 for example, what happens when a locale doesn't define
294 all the messages —
295 see <a href="i18n.html">Internationalization</a>.
296 </p>
297 <h3 id="name">name</h3>
298 <p>
299 Actually, there's no field called "name".
300 This field's name is the name of the message —
301 the same <em>name</em> that you see in
302 <code>__MSG_<em>name</em>__</code>
303 or <code>getMessage("<em>name</em>")</code>.
304 </p>
305 <p>
306 The name is a case-insensitive key
307 that lets you retrieve the localized message text.
308 The name can include the following characters:
309 </p>
310 <ul>
311 <li> A-Z </li>
312 <li> a-z </li>
313 <li> 0-9 </li>
314 <li> _ (underscore) </li>
315 <li> @ </li>
316 </ul>
317 <p class="note">
318 <b>Note:</b>
319 Don't define names that begin with "@@".
320 Those names are reserved for
321 <a href="i18n.html#overview-predefined">predefined messages</a>.
322 </p>
323 <p>
324 Here are three examples of names,
325 taken from the <a href="#example">Example</a> section:
326 </p>
327 <pre>"prompt_for_name": {
328 ...
329 },
330 "hello": {
331 ...
332 },
333 "bye": {
334 ...
335 }
336 </pre>
337 <p>
338 For more examples of using names, see the
339 <a href="i18n.html">Internationalization</a> page.
340 </p>
341 <h3 id="message">message</h3>
342 <p>
343 The translated message,
344 in the form of a string that can contain
345 <a href="#placeholders">placeholders</a>.
346 Use <code>$<em>placeholder_name</em>$</code>
347 (case insensitive)
348 to refer to a particular placeholder.
349 For example, you can refer to a placeholder named "our_site" as
350 <code>$our_site$</code>, <code>$OUR_SITE$</code>, or <code>$oUR_sITe$</code>.
351 </p>
352 <p>
353 Here are three examples of messages,
354 taken from the <a href="#example">Example</a> section:
355 </p>
356 <pre>"message": "What's your name?"
357 ...
358 "message": "Hello, $USER$"
359 ...
360 "message": "Goodbye, $USER$. Come back to $OUR_SITE$ soon!"
361 </pre>
362 <p>
363 To put a dollar sign (<code>$</code>) into the string,
364 use <code>$$</code>.
365 For example, use the following code to specify the message
366 <b>Amount (in $)</b>:
367 </p><pre>"message": "Amount (in $$)"
368 </pre>
369 <p>
370 Although placeholders such as <code>$USER$</code> are
371 the preferred way of referring to <em>substitution strings</em>
372 (strings specified using the <em>substitutions</em> parameter of
373 <a href="i18n.html#method-getMessage"><code>getMessage()</code></a>)
374 you can also refer to substitution strings directly
375 within the message.
376 For example, the following message
377 refers to the first three substitution strings passed into
378 <code>getMessage()</code>:
379 </p>
380 <pre>"message": "Params: $1, $2, $3"
381 </pre>
382 <p>
383 Despite that example,
384 we recommend that you stick to using placeholders
385 instead of <code>$<em>n</em></code> strings
386 within your messages.
387 Think of placeholders as good variable names.
388 A week after you write your code,
389 you'll probably forget what <code>$1</code> refers to,
390 but you'll know what your placeholders refer to.
391 For more information on placeholders and substitution strings, see
392 the <a href="#placeholders">placeholders</a> section.
393 </p>
394 <h3 id="description">description</h3>
395 <p>
396 <em>Optional.</em>
397 A description of the message,
398 intended to give context
399 or details to help the translator
400 make the best possible translation.
401 </p>
402 <p>
403 Here are three examples of descriptions,
404 taken from the <a href="#example">Example</a> section:
405 </p>
406 <pre>"description": "Ask for the user's name"
407 ...
408 "description": "Greet the user"
409 ...
410 "description": "Say goodbye to the user"
411 </pre>
412 <h3 id="placeholders">placeholders</h3>
413 <p>
414 <em>Optional.</em>
415 Defines one or more substrings
416 to be used within the message.
417 Here are two reasons you might want to use a placeholder:
418 </p>
419 <ul>
420 <li>
421 To define the text
422 for a part of your message
423 that shouldn't be translated.
424 Examples: HTML code, trademarked names, formatting specifiers.
425 </li>
426 <li>
427 To refer to a substitution string passed into
428 <code>getMessage()</code>.
429 Example: <code>$1</code>.
430 </li>
431 </ul>
432 <p>
433 Each placeholder has a name,
434 a "content" item,
435 and an optional "example" item.
436 A placeholder's name is case-insensitive
437 and can contain the same characters
438 as a <a href="#name">message name</a>.
439 </p>
440 <p>
441 The "content" item's value is a string
442 that can refer to substitution strings, which are
443 specified using the
444 <a href="i18n.html#method-getMessage"><code>getMessage()</code></a> method's
445 <em>substitutions</em> parameter.
446 The value of a "content" item is typically something like
447 "Example.com" or "$1".
448 If you refer to
449 a substitution string that doesn't exist,
450 you get an empty string.
451 The following table shows how
452 <code>$<em>n</em></code> strings correspond to
453 strings specified by the <em>substitutions</em> parameter.
454 </p>
455 <table>
456 <tbody><tr>
457 <th> <em>substitutions</em> parameter </th>
458 <th> Value of $1</th>
459 <th> Value of $2</th>
460 <th> Value of $3</th>
461 </tr>
462 <tr>
463 <td> <code>userName</code> </td>
464 <td> value of <code>userName</code> </td>
465 <td> <code>""</code> </td>
466 <td> <code>""</code> </td>
467 </tr>
468 <tr>
469 <td> <code>["Cira", "Kathy"]</code> </td>
470 <td> <code>"Cira"</code> </td>
471 <td> <code>"Kathy"</code> </td>
472 <td> <code>""</code> </td>
473 </tr>
474 </tbody></table>
475 <p>
476 The "example" item
477 (optional, but highly recommended)
478 helps translators by showing how the content appears to the end user.
479 For example, a placeholder
480 for a dollar amount
481 should have an example like <code>"$23.45"</code>.
482 </p>
483 <p>
484 The following snippet,
485 taken from the <a href="#example">Example</a> section,
486 shows a "placeholders" item that contains two placeholders
487 named "our_site" and "user".
488 The "our_site" placeholder has no "example" item
489 because its value is obvious from the "content" field.
490 </p>
491 <pre>"placeholders": {
492 "our_site": {
493 "content": "Example.com",
494 },
495 "user": {
496 "content": "$1",
497 "example": "Cira"
498 }
499 }
500 </pre>
501 </div>
502 <!-- API PAGE -->
503 <!-- /apiPage -->
504 </div> <!-- /gc-pagecontent -->
505 </div> <!-- /g-section -->
506 </div> <!-- /codesiteContent -->
507 <div id="gc-footer" --="">
508 <div class="text">
509 <p>
510 Except as otherwise <a href="http://code.google.com/policies.html#restrictions ">noted</a>,
511 the content of this page is licensed under the <a rel="license" href="http://c reativecommons.org/licenses/by/3.0/">Creative Commons
512 Attribution 3.0 License</a>, and code samples are licensed under the
513 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic ense</a>.
514 </p>
515 <p>
516 ©2011 Google
517 </p>
518 <!-- begin analytics -->
519 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript"> </script>
520 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc ript>
521 <script type="text/javascript">
522 // chrome doc tracking
523 try {
524 var engdocs = _gat._getTracker("YT-10763712-2");
525 engdocs._trackPageview();
526 } catch(err) {}
527 // code.google.com site-wide tracking
528 try {
529 _uacct="UA-18071-1";
530 _uanchor=1;
531 _uff=0;
532 urchinTracker();
533 }
534 catch(e) {/* urchinTracker not available. */}
535 </script>
536 <!-- end analytics -->
537 </div>
538 </div> <!-- /gc-footer -->
539 </div> <!-- /gc-container -->
540 </body></html>
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/i18n.html ('k') | chrome/common/extensions/docs/idle.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698