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 ], | |
16 "functions": [ | 10 "functions": [ |
17 { | 11 { |
18 "name": "getAcceptLanguages", | 12 "name": "getAcceptLanguages", |
19 "type": "function", | 13 "type": "function", |
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).", | 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).", |
21 "parameters": [ | 15 "parameters": [ |
22 { | 16 { |
23 "type": "function", | 17 "type": "function", |
24 "name": "callback", | 18 "name": "callback", |
25 "parameters": [ | 19 "parameters": [ |
26 {"name": "languages", "type": "array", "items": {"$ref": "Language
Code"}, "description": "Array of LanguageCode"} | 20 {"name": "languages", "type": "array", "items": {"type": "string"}
, "description": "Array of the accept languages of the browser, such as en-US,en
,zh-CN"} |
27 ] | 21 ] |
28 } | 22 } |
29 ] | 23 ] |
30 }, | 24 }, |
31 { | 25 { |
32 "name": "getMessage", | 26 "name": "getMessage", |
33 "nocompile": true, | 27 "nocompile": true, |
34 "type": "function", | 28 "type": "function", |
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>.", | 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>.", |
36 "parameters": [ | 30 "parameters": [ |
(...skipping 17 matching lines...) Expand all Loading... |
54 { | 48 { |
55 "name": "getUILanguage", | 49 "name": "getUILanguage", |
56 "type": "function", | 50 "type": "function", |
57 "nocompile": true, | 51 "nocompile": true, |
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.", | 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.", |
59 "parameters": [], | 53 "parameters": [], |
60 "returns": { | 54 "returns": { |
61 "type": "string", | 55 "type": "string", |
62 "description": "The browser UI language code such as en-US or fr-FR." | 56 "description": "The browser UI language code such as en-US or fr-FR." |
63 } | 57 } |
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 ] | |
113 } | 58 } |
114 ], | 59 ], |
115 "events": [] | 60 "events": [] |
116 } | 61 } |
117 ] | 62 ] |
OLD | NEW |