Index: chrome/common/extensions/api/i18n.json |
diff --git a/chrome/common/extensions/api/i18n.json b/chrome/common/extensions/api/i18n.json |
index d29c0e69cf8f6fc22fe67ff30a1f4e0be939f666..26ffe2d3ed8b599fe33c8d2f3fb2b402e936eca4 100644 |
--- a/chrome/common/extensions/api/i18n.json |
+++ b/chrome/common/extensions/api/i18n.json |
@@ -55,6 +55,49 @@ |
"type": "string", |
"description": "The browser UI language code such as en-US or fr-FR." |
} |
+ }, |
+ { |
+ "name": "detectLanguage", |
+ "type": "function", |
+ "description": "Detects the language of the provided text using CLD.", |
+ "parameters": [ |
+ { |
+ "type": "string", |
+ "name": "text", |
+ "minimum": 0, |
+ "optional": true, |
+ "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.
|
+ }, |
+ { |
+ "type": "function", |
+ "name": "callback", |
+ "parameters": [ |
+ { |
+ "type": "object", |
+ "name": "result", |
+ "description": "LanguageDetectionResult object that holds detected langugae reliability and array of DetectedLanguage", |
+ "properties": { |
+ "is_reliable": { "type": "boolean", "description": "CLD detected 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.
|
+ "languages": |
+ { |
+ "type": "array", |
+ "description": "array of detectedLanguage", |
+ "items": |
+ { |
+ "type": "object", |
+ "description": "DetectedLanguage object that holds detected ISO language code and its percentage in the input string", |
+ "properties": |
+ { |
+ "language": { "type": "string", "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/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. 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.
|
+ "percentage": { "type": "integer", "description": "The percentage of the detected language" } |
+ } |
+ } |
+ } |
+ } |
+ } |
+ ] |
+ } |
+ ] |
} |
], |
"events": [] |