| Index: chrome/common/extensions/docs/templates/intros/i18n.html
|
| diff --git a/chrome/common/extensions/docs/templates/intros/i18n.html b/chrome/common/extensions/docs/templates/intros/i18n.html
|
| index c720fa246d0a11d9629884aaa3481cd0af047b8c..7fe537227cbe649b0ec37b8a17a602c9345923ae 100644
|
| --- a/chrome/common/extensions/docs/templates/intros/i18n.html
|
| +++ b/chrome/common/extensions/docs/templates/intros/i18n.html
|
| @@ -559,3 +559,26 @@ function getAcceptLanguages() {
|
| For details on calling <code>getAcceptLanguages()</code>, see the
|
| $(ref:i18n.getAcceptLanguages API reference).
|
| </p>
|
| +
|
| +<h3 id="example-detect-language">Example: detectLanguage</h3>
|
| +<p>
|
| + The following code detects up to 3 languages from the given string and displays the result as strings separated by new lines.
|
| +</p>
|
| +
|
| +<pre>
|
| +function detectLanguage(inputText) {
|
| + chrome.i18n.detectLanguage(inputText, function(result) {
|
| + var outputLang = "Detected Language: ";
|
| + var outputPercent = "Language Percentage: ";
|
| + for(i = 0; i < result.languages.length; i++) {
|
| + outputLang += result.languages[i].language + " ";
|
| + outputPercent +=result.languages[i].percentage + " ";
|
| + }
|
| + document.getElementById("languageSpan").innerHTML = outputLang + "\n" + outputPercent + "\nReliable: " + result.isReliable;
|
| + });
|
| +}
|
| +</pre>
|
| +
|
| +<p>
|
| + For more details on calling <code>detectLanguage(inputText)</code>, see the $(ref:i18n.detectLanguage API reference).
|
| +</p>
|
|
|