OLD | NEW |
1 <h1>Formats: Locale-Specific Messages</h1> | 1 <h1>Formats: Locale-Specific Messages</h1> |
2 | 2 |
3 | 3 |
4 <p> | 4 <p> |
5 Each internationalized extension or app has at least one | 5 Each internationalized extension or app has at least one |
6 file named <code>messages.json</code> | 6 file named <code>messages.json</code> |
7 that provides locale-specific strings. | 7 that provides locale-specific strings. |
8 This page describes the format of <code>messages.json</code> files. | 8 This page describes the format of <code>messages.json</code> files. |
9 For information on how to internationalize and localize, | 9 For information on how to internationalize and localize, |
10 see the <a href="i18n.html">Internationalization</a> page. | 10 see the <a href="i18n">Internationalization</a> page. |
11 </p> | 11 </p> |
12 | 12 |
13 <h2 id="overview"> Field summary </h2> | 13 <h2 id="overview"> Field summary </h2> |
14 | 14 |
15 <p> | 15 <p> |
16 The following code shows the supported fields for | 16 The following code shows the supported fields for |
17 <code>messages.json</code>. | 17 <code>messages.json</code>. |
18 Only the "<em>name</em>" and "message" fields are required. | 18 Only the "<em>name</em>" and "message" fields are required. |
19 </p> | 19 </p> |
20 | 20 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 | 78 |
79 <h2 id="field_details">Field details</h2> | 79 <h2 id="field_details">Field details</h2> |
80 | 80 |
81 <p> | 81 <p> |
82 This section describes each field | 82 This section describes each field |
83 that can appear in a <code>messages.json</code> file. | 83 that can appear in a <code>messages.json</code> file. |
84 For details on how the messages file is used — | 84 For details on how the messages file is used — |
85 for example, what happens when a locale doesn't define | 85 for example, what happens when a locale doesn't define |
86 all the messages — | 86 all the messages — |
87 see <a href="i18n.html">Internationalization</a>. | 87 see <a href="i18n">Internationalization</a>. |
88 </p> | 88 </p> |
89 | 89 |
90 | 90 |
91 <h3 id="name">name</h3> | 91 <h3 id="name">name</h3> |
92 | 92 |
93 <p> | 93 <p> |
94 Actually, there's no field called "name". | 94 Actually, there's no field called "name". |
95 This field's name is the name of the message — | 95 This field's name is the name of the message — |
96 the same <em>name</em> that you see in | 96 the same <em>name</em> that you see in |
97 <code>__MSG_<em>name</em>__</code> | 97 <code>__MSG_<em>name</em>__</code> |
(...skipping 11 matching lines...) Expand all Loading... |
109 <li> a-z </li> | 109 <li> a-z </li> |
110 <li> 0-9 </li> | 110 <li> 0-9 </li> |
111 <li> _ (underscore) </li> | 111 <li> _ (underscore) </li> |
112 <li> @ </li> | 112 <li> @ </li> |
113 </ul> | 113 </ul> |
114 | 114 |
115 <p class="note"> | 115 <p class="note"> |
116 <b>Note:</b> | 116 <b>Note:</b> |
117 Don't define names that begin with "@@". | 117 Don't define names that begin with "@@". |
118 Those names are reserved for | 118 Those names are reserved for |
119 <a href="i18n.html#overview-predefined">predefined messages</a>. | 119 <a href="i18n#overview-predefined">predefined messages</a>. |
120 </p> | 120 </p> |
121 | 121 |
122 <p> | 122 <p> |
123 Here are three examples of names, | 123 Here are three examples of names, |
124 taken from the <a href="#example">Example</a> section: | 124 taken from the <a href="#example">Example</a> section: |
125 </p> | 125 </p> |
126 | 126 |
127 <pre> | 127 <pre> |
128 "prompt_for_name": { | 128 "prompt_for_name": { |
129 ... | 129 ... |
130 }, | 130 }, |
131 "hello": { | 131 "hello": { |
132 ... | 132 ... |
133 }, | 133 }, |
134 "bye": { | 134 "bye": { |
135 ... | 135 ... |
136 } | 136 } |
137 </pre> | 137 </pre> |
138 | 138 |
139 <p> | 139 <p> |
140 For more examples of using names, see the | 140 For more examples of using names, see the |
141 <a href="i18n.html">Internationalization</a> page. | 141 <a href="i18n">Internationalization</a> page. |
142 </p> | 142 </p> |
143 | 143 |
144 | 144 |
145 <h3 id="message">message</h3> | 145 <h3 id="message">message</h3> |
146 | 146 |
147 <p> | 147 <p> |
148 The translated message, | 148 The translated message, |
149 in the form of a string that can contain | 149 in the form of a string that can contain |
150 <a href="#placeholders">placeholders</a>. | 150 <a href="#placeholders">placeholders</a>. |
151 Use <code>$<em>placeholder_name</em>$</code> | 151 Use <code>$<em>placeholder_name</em>$</code> |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 "placeholders": { | 321 "placeholders": { |
322 "our_site": { | 322 "our_site": { |
323 "content": "Example.com", | 323 "content": "Example.com", |
324 }, | 324 }, |
325 "user": { | 325 "user": { |
326 "content": "$1", | 326 "content": "$1", |
327 "example": "Cira" | 327 "example": "Cira" |
328 } | 328 } |
329 } | 329 } |
330 </pre> | 330 </pre> |
OLD | NEW |