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

Unified 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: Style errors fixed 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 side-by-side diff with in-line comments
Download patch
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..63d8c03174128364848d75f7e1fb61be16b84c57 100644
--- a/chrome/common/extensions/api/i18n.json
+++ b/chrome/common/extensions/api/i18n.json
@@ -6,7 +6,13 @@
{
"namespace": "i18n",
"description": "Use the <code>chrome.i18n</code> infrastructure to implement internationalization across your whole app or extension.",
- "types": [],
+ "types": [
+ {
+ "id": "LanguageCode",
+ "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>."
+ }
+ ],
"functions": [
{
"name": "getAcceptLanguages",
@@ -17,7 +23,7 @@
"type": "function",
"name": "callback",
"parameters": [
- {"name": "languages", "type": "array", "items": {"type": "string"}, "description": "Array of the accept languages of the browser, such as en-US,en,zh-CN"}
+ {"name": "languages", "type": "array", "items": {"$ref": "LanguageCode"}, "description": "Array of LanguageCode"}
]
}
]
@@ -55,8 +61,57 @@
"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,
+ "description": "User input string to be translated."
+ },
+ {
+ "type": "function",
+ "name": "callback",
+ "parameters": [
+ {
+ "type": "object",
+ "name": "result",
+ "description": "LanguageDetectionResult object that holds detected langugae reliability and array of DetectedLanguage",
+ "properties": {
+ "isReliable": { "type": "boolean", "description": "CLD detected language reliability" },
+ "languages":
+ {
+ "type": "array",
+ "description": "array of detectedLanguage of size 0-3",
+ "items":
+ {
+ "type": "object",
+ "description": "DetectedLanguage object that holds detected ISO language code and its percentage in the input string",
+ "properties":
+ {
+ "language":
+ {
+ "$ref": "LanguageCode"
+ },
+ "percentage":
+ {
+ "type": "integer",
+ "description": "The percentage of the detected language"
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ ]
}
],
"events": []
}
-]
+]
« no previous file with comments | « chrome/browser/extensions/api/i18n/i18n_api.cc ('k') | extensions/browser/extension_function_histogram_value.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698