Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: chrome/common/extensions/api/i18n.json

Issue 1208993011: New thin layer of API extension chrome.i18n.detectLanguage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed after the review Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "functions": [ 10 "functions": [
11 { 11 {
12 "name": "getAcceptLanguages", 12 "name": "getAcceptLanguages",
13 "type": "function", 13 "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).", 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).",
15 "parameters": [ 15 "parameters": [
16 { 16 {
17 "type": "function", 17 "type": "function",
18 "name": "callback", 18 "name": "callback",
19 "parameters": [ 19 "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"} 20 {"name": "languages", "type": "array", "items": {"type": "string"} , "description": "Array of the accept languages of the browser, such as en-US,en ,zh-CN"}
not at google - send to devlin 2015/07/08 19:27:30 You may want to define a separate type for languag
mcindy 2015/07/08 21:26:12 Our 'languages' in detectLanguage is a different t
not at google - send to devlin 2015/07/08 21:47:59 I mean purely the string. It would still be an arr
mcindy 2015/07/09 18:38:27 Done.
21 ] 21 ]
22 } 22 }
23 ] 23 ]
24 }, 24 },
25 { 25 {
26 "name": "getMessage", 26 "name": "getMessage",
27 "nocompile": true, 27 "nocompile": true,
28 "type": "function", 28 "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 &mdash; for example, <em>messageN ame</em> is not a string or the <em>substitutions</em> array has more than 9 ele ments &mdash; 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 &mdash; for example, <em>messageN ame</em> is not a string or the <em>substitutions</em> array has more than 9 ele ments &mdash; this method returns <code>undefined</code>.",
30 "parameters": [ 30 "parameters": [
(...skipping 17 matching lines...) Expand all
48 { 48 {
49 "name": "getUILanguage", 49 "name": "getUILanguage",
50 "type": "function", 50 "type": "function",
51 "nocompile": true, 51 "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.", 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.",
53 "parameters": [], 53 "parameters": [],
54 "returns": { 54 "returns": {
55 "type": "string", 55 "type": "string",
56 "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."
57 } 57 }
58 },
59 {
60 "name": "detectLanguage",
61 "type": "function",
62 "description": "Detects the language of the provided text using CLD.",
63 "parameters": [
64 {
65 "type": "string",
66 "name": "text",
67 "minimum": 0,
68 "optional": true,
69 "description": "Defaults to the null string."
not at google - send to devlin 2015/07/08 19:27:30 Why would we support null strings?
mcindy 2015/07/08 21:26:12 The API and the CLD are implemented to handle null
not at google - send to devlin 2015/07/08 21:47:59 What API? We're making our API right now. It doesn
mcindy 2015/07/08 23:28:02 Currently, when the user passes in null value, the
not at google - send to devlin 2015/07/08 23:29:07 Just don't make it optional. Then when the extensi
mcindy 2015/07/09 18:38:27 Done.
70 },
71 {
72 "type": "function",
73 "name": "callback",
74 "parameters": [
75 {
76 "type": "object",
77 "name": "result",
78 "description": "LanguageDetectionResult object that holds detect ed langugae reliability and array of DetectedLanguage",
79 "properties": {
80 "is_reliable": { "type": "boolean", "description": "CLD detect ed language reliability" },
not at google - send to devlin 2015/07/08 19:27:30 APIs typically use camelcase.
mcindy 2015/07/08 21:26:12 Done.
81 "languages":
82 {
83 "type": "array",
84 "description": "array of detectedLanguage",
85 "items":
86 {
87 "type": "object",
88 "description": "DetectedLanguage object that holds det ected ISO language code and its percentage in the input string",
89 "properties":
90 {
91 "language": { "type": "string", "description": "An ISO language code such as <code>en</code> or <code>fr</code>. For a complete li st of languages supported by this method, see <a href='http://src.chromium.org/v iewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'>kLanguag eInfoTable</a>. The 2nd to 4th columns will be checked and the first non-NULL va lue will be returned except for Simplified Chinese for which zh-CN will be retur ned. For an unknown language, <code>und</code> will be returned." },
not at google - send to devlin 2015/07/08 19:27:30 Why return "und" rather than null or something? Wh
mcindy 2015/07/08 21:26:12 und means that the CLD cannot determine the langua
not at google - send to devlin 2015/07/08 21:47:59 IMO a nicer API would be to either have a null lan
mcindy 2015/07/08 23:12:29 Did you mean "null" in string or null type?
not at google - send to devlin 2015/07/08 23:13:31 I mean to make the language an optional field.
mcindy 2015/07/09 18:38:27 Done.
92 "percentage": { "type": "integer", "description": "The percentage of the detected language" }
93 }
94 }
95 }
96 }
97 }
98 ]
99 }
100 ]
58 } 101 }
59 ], 102 ],
60 "events": [] 103 "events": []
61 } 104 }
62 ] 105 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698