OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [ | 5 [ |
6 { | 6 { |
7 "namespace": "i18n", | 7 "namespace": "i18n", |
8 "description": "Use the <code>chrome.i18n</code> infrastructure to implement
internationalization across your whole app or extension.", | 8 "description": "Use the <code>chrome.i18n</code> infrastructure to implement
internationalization across your whole app or extension.", |
9 "types": [], | 9 "types": [ |
| 10 { |
| 11 "id": "LanguageCode", |
| 12 "type": "string", |
| 13 "description": "An ISO language code such as <code>en</code> or <code>fr
</code>. For a complete list of languages supported by this method, see <a href=
'http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/inter
nal/languages.cc'>kLanguageInfoTable</a>." |
| 14 } |
| 15 ], |
10 "functions": [ | 16 "functions": [ |
11 { | 17 { |
12 "name": "getAcceptLanguages", | 18 "name": "getAcceptLanguages", |
13 "type": "function", | 19 "type": "function", |
14 "description": "Gets the accept-languages of the browser. This is differ
ent from the locale used by the browser; to get the locale, use $(ref:i18n.getUI
Language).", | 20 "description": "Gets the accept-languages of the browser. This is differ
ent from the locale used by the browser; to get the locale, use $(ref:i18n.getUI
Language).", |
15 "parameters": [ | 21 "parameters": [ |
16 { | 22 { |
17 "type": "function", | 23 "type": "function", |
18 "name": "callback", | 24 "name": "callback", |
19 "parameters": [ | 25 "parameters": [ |
20 {"name": "languages", "type": "array", "items": {"type": "string"}
, "description": "Array of the accept languages of the browser, such as en-US,en
,zh-CN"} | 26 {"name": "languages", "type": "array", "items": {"$ref": "Language
Code"}, "description": "Array of LanguageCode"} |
21 ] | 27 ] |
22 } | 28 } |
23 ] | 29 ] |
24 }, | 30 }, |
25 { | 31 { |
26 "name": "getMessage", | 32 "name": "getMessage", |
27 "nocompile": true, | 33 "nocompile": true, |
28 "type": "function", | 34 "type": "function", |
29 "description": "Gets the localized string for the specified message. If
the message is missing, this method returns an empty string (''). If the format
of the <code>getMessage()</code> call is wrong — for example, <em>messageN
ame</em> is not a string or the <em>substitutions</em> array has more than 9 ele
ments — this method returns <code>undefined</code>.", | 35 "description": "Gets the localized string for the specified message. If
the message is missing, this method returns an empty string (''). If the format
of the <code>getMessage()</code> call is wrong — for example, <em>messageN
ame</em> is not a string or the <em>substitutions</em> array has more than 9 ele
ments — this method returns <code>undefined</code>.", |
30 "parameters": [ | 36 "parameters": [ |
(...skipping 17 matching lines...) Expand all Loading... |
48 { | 54 { |
49 "name": "getUILanguage", | 55 "name": "getUILanguage", |
50 "type": "function", | 56 "type": "function", |
51 "nocompile": true, | 57 "nocompile": true, |
52 "description": "Gets the browser UI language of the browser. This is dif
ferent from $(ref:i18n.getAcceptLanguages) which returns the preferred user lang
uages.", | 58 "description": "Gets the browser UI language of the browser. This is dif
ferent from $(ref:i18n.getAcceptLanguages) which returns the preferred user lang
uages.", |
53 "parameters": [], | 59 "parameters": [], |
54 "returns": { | 60 "returns": { |
55 "type": "string", | 61 "type": "string", |
56 "description": "The browser UI language code such as en-US or fr-FR." | 62 "description": "The browser UI language code such as en-US or fr-FR." |
57 } | 63 } |
| 64 }, |
| 65 { |
| 66 "name": "detectLanguage", |
| 67 "type": "function", |
| 68 "description": "Detects the language of the provided text using CLD.", |
| 69 "parameters": [ |
| 70 { |
| 71 "type": "string", |
| 72 "name": "text", |
| 73 "minimum": 0, |
| 74 "description": "User input string to be translated." |
| 75 }, |
| 76 { |
| 77 "type": "function", |
| 78 "name": "callback", |
| 79 "parameters": [ |
| 80 { |
| 81 "type": "object", |
| 82 "name": "result", |
| 83 "description": "LanguageDetectionResult object that holds detect
ed langugae reliability and array of DetectedLanguage", |
| 84 "properties": { |
| 85 "isReliable": { "type": "boolean", "description": "CLD detecte
d language reliability" }, |
| 86 "languages": |
| 87 { |
| 88 "type": "array", |
| 89 "description": "array of detectedLanguage of size 0-3", |
| 90 "items": |
| 91 { |
| 92 "type": "object", |
| 93 "description": "DetectedLanguage object that holds det
ected ISO language code and its percentage in the input string", |
| 94 "properties": |
| 95 { |
| 96 "language": |
| 97 { |
| 98 "$ref": "LanguageCode" |
| 99 }, |
| 100 "percentage": |
| 101 { |
| 102 "type": "integer", |
| 103 "description": "The percentage of the detected
language" |
| 104 } |
| 105 } |
| 106 } |
| 107 } |
| 108 } |
| 109 } |
| 110 ] |
| 111 } |
| 112 ] |
58 } | 113 } |
59 ], | 114 ], |
60 "events": [] | 115 "events": [] |
61 } | 116 } |
62 ] | 117 ] |
OLD | NEW |