Index: chrome/common/extensions/docs/i18n.html |
=================================================================== |
--- chrome/common/extensions/docs/i18n.html (revision 27238) |
+++ chrome/common/extensions/docs/i18n.html (working copy) |
@@ -164,8 +164,10 @@ |
<li> |
<a href="#methods">Methods</a> |
<ol> |
- <li jsinstance="*0"> |
+ <li jsinstance="0"> |
<a href="#method-getAcceptLanguages">getAcceptLanguages</a> |
+ </li><li jsinstance="*1"> |
+ <a href="#method-getMessage">getMessage</a> |
</li> |
</ol> |
</li> |
@@ -198,7 +200,8 @@ |
<!-- BEGIN AUTHORED CONTENT --> |
<p id="classSummary"> |
Use the <code>chrome.i18n</code> module to manipulate the i18n related browser |
-settings, such as the accept languages. |
+settings, such as the accept languages, or to get localized messages for current |
+locale. |
</p> |
<h3 id="overview-examples">Examples</h3> |
@@ -215,6 +218,18 @@ |
}) |
} |
</pre> |
+ |
+<p> |
+The following code gets localized message from the browser and displays it as a |
+string. It replaces two placeholders within the message with values arg1 and |
+arg2. |
+</p> |
+ |
+<pre>function getMessage() { |
+ var message = chrome.i18n.getMessage("click_here", ["arg1", "arg2"]); |
+ document.getElementById("languageSpan").innerHTML = message; |
+} |
+</pre> |
<!-- END AUTHORED CONTENT --> |
</div> |
@@ -247,7 +262,7 @@ |
<h3>Methods</h3> |
<!-- iterates over all functions --> |
- <div class="apiItem" jsinstance="*0"> |
+ <div class="apiItem" jsinstance="0"> |
<a name="method-getAcceptLanguages"></a> <!-- method-anchor --> |
<h4>getAcceptLanguages</h4> |
@@ -388,6 +403,177 @@ |
</div> <!-- /description --> |
+ </div><div class="apiItem" jsinstance="*1"> |
+ <a name="method-getMessage"></a> <!-- method-anchor --> |
+ <h4>getMessage</h4> |
+ |
+ <div class="summary"><span>string</span> |
+ <!-- Note: intentionally longer 80 columns --> |
+ <span>chrome.i18n.getMessage</span>(<span jsinstance="0" class="null"><span style="display: none; ">, </span><span>string</span> |
+ <var><span>message_name</span></var></span><span jsinstance="*1" class="optional"><span>, </span><span>string or array of string</span> |
+ <var><span><!--framePath //<!--frame0-->--></span></var></span>)</div> |
+ |
+ <div class="description"> |
+ <p class="todo" style="display: none; ">Undocumented.</p> |
+ <p>Get a message from the extension language catalog, for a current locale.</p> |
+ |
+ <!-- PARAMETERS --> |
+ <h4>Parameters</h4> |
+ <dl> |
+ <div jsinstance="0"> |
+ <div> |
+ <dt> |
+ <var>message_name</var> |
+ <em> |
+ |
+ <!-- TYPE --> |
+ <div style="display:inline"> |
+ ( |
+ <span class="optional" style="display: none; ">optional</span> |
+ <span id="typeTemplate"> |
+ <span style="display: none; "> |
+ <a> Type</a> |
+ </span> |
+ <span> |
+ <span style="display: none; "> |
+ array of <span><span></span></span> |
+ </span> |
+ <span>string</span> |
+ </span> |
+ </span> |
+ ) |
+ </div> |
+ |
+ </em> |
+ </dt> |
+ <dd class="todo" style="display: none; "> |
+ Undocumented. |
+ </dd> |
+ <dd>Message name from the extension catalog.</dd> |
+ |
+ <!-- OBJECT PROPERTIES --> |
+ <dd style="display: none; "> |
+ <dl> |
+ <div> |
+ <div> |
+ </div> |
+ </div> |
+ </dl> |
+ </dd> |
+ </div> |
+ </div><div jsinstance="*1"> |
+ <div> |
+ <dt> |
+ <var style="display: none; ">paramName</var> |
+ <em> |
+ |
+ <!-- TYPE --> |
+ <div style="display:inline"> |
+ ( |
+ <span class="optional">optional</span> |
+ <span id="typeTemplate"> |
+ <span style="display: none; "> |
+ <a> Type</a> |
+ </span> |
+ <span> |
+ <span style="display: none; "> |
+ array of <span><span></span></span> |
+ </span> |
+ <span>string or array of string</span> |
+ </span> |
+ </span> |
+ ) |
+ </div> |
+ |
+ </em> |
+ </dt> |
+ <dd class="todo" style="display: none; "> |
+ Undocumented. |
+ </dd> |
+ <dd>1 - 9 substitution parameters, if the message requires any.</dd> |
+ |
+ <!-- OBJECT PROPERTIES --> |
+ <dd style="display: none; "> |
+ <dl> |
+ <div> |
+ <div> |
+ </div> |
+ </div> |
+ </dl> |
+ </dd> |
+ </div> |
+ </div> |
+ </dl> |
+ |
+ <!-- RETURNS --> |
+ <h4>Returns</h4> |
+ <dl> |
+ <div> |
+ <div> |
+ <dt> |
+ <var style="display: none; ">paramName</var> |
+ <em> |
+ |
+ <!-- TYPE --> |
+ <div style="display:inline"> |
+ ( |
+ <span class="optional" style="display: none; ">optional</span> |
+ <span id="typeTemplate"> |
+ <span style="display: none; "> |
+ <a> Type</a> |
+ </span> |
+ <span> |
+ <span style="display: none; "> |
+ array of <span><span></span></span> |
+ </span> |
+ <span>string</span> |
+ </span> |
+ </span> |
+ ) |
+ </div> |
+ |
+ </em> |
+ </dt> |
+ <dd class="todo" style="display: none; "> |
+ Undocumented. |
+ </dd> |
+ <dd>Message localized for current locale.</dd> |
+ |
+ <!-- OBJECT PROPERTIES --> |
+ <dd style="display: none; "> |
+ <dl> |
+ <div> |
+ <div> |
+ </div> |
+ </div> |
+ </dl> |
+ </dd> |
+ </div> |
+ </div> |
+ </dl> |
+ |
+ <!-- CALLBACK --> |
+ <div style="display: none; "> |
+ <div> |
+ <h4>Callback function</h4> |
+ <p> |
+ If you specify the <em>callback</em> parameter, |
+ it should specify a function that looks like this: |
+ </p> |
+ |
+ <!-- Note: intentionally longer 80 columns --> |
+ <pre>function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>);</pre> |
+ <dl> |
+ <div> |
+ <div> |
+ </div> |
+ </div> |
+ </dl> |
+ </div> |
+ </div> |
+ |
+ </div> <!-- /description --> |
+ |
</div> <!-- /apiItem --> |
</div> <!-- /apiGroup --> |