Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / extensions / api / i18n.json
blobd9fc39229d505f0eef4345fb55f3f5301ae628a5
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
3 // found in the LICENSE file.
6   {
7     "namespace": "i18n",
8     "description": "Use the <code>chrome.i18n</code> infrastructure to implement internationalization across your whole app or extension.",
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/internal/languages.cc'>kLanguageInfoTable</a>. For an unknown language, <code>und</code> will be returned, which means that [percentage] of the text is unknown to CLD"
14       }
15     ],
16     "functions": [
17       {
18         "name": "getAcceptLanguages",
19         "type": "function",
20         "description": "Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use $(ref:i18n.getUILanguage).",
21         "parameters": [
22           {
23             "type": "function",
24             "name": "callback",
25             "parameters": [
26               {"name": "languages", "type": "array", "items": {"$ref": "LanguageCode"}, "description": "Array of LanguageCode"}
27             ]
28           }
29         ]
30       },
31       {
32         "name": "getMessage",
33         "nocompile": true,
34         "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 &mdash; for example, <em>messageName</em> is not a string or the <em>substitutions</em> array has more than 9 elements &mdash; this method returns <code>undefined</code>.",
36         "parameters": [
37           {
38             "type": "string",
39             "name": "messageName",
40             "description": "The name of the message, as specified in the <a href='i18n-messages'><code>messages.json</code></a> file."
41           },
42           {
43             "type": "any",
44             "name": "substitutions",
45             "optional": true,
46             "description": "Up to 9 substitution strings, if the message requires any."
47           }
48         ],
49         "returns": {
50           "type": "string",
51           "description": "Message localized for current locale."
52         }
53       },
54       {
55         "name": "getUILanguage",
56         "type": "function",
57         "nocompile": true,
58         "description": "Gets the browser UI language of the browser. This is different from $(ref:i18n.getAcceptLanguages) which returns the preferred user languages.",
59         "parameters": [],
60         "returns": {
61           "type": "string",
62           "description": "The browser UI language code such as en-US or fr-FR."
63         }
64       },
65       {
66         "name": "detectLanguage",
67         "type": "function",
68         "nocompile": true,
69         "description": "Detects the language of the provided text using CLD.",
70         "parameters": [
71           {
72             "type": "string",
73             "name": "text",
74             "minimum": 0,
75             "description": "User input string to be translated."
76           },
77           {
78             "type": "function",
79             "name": "callback",
80             "parameters": [
81               {
82                 "type": "object",
83                 "name": "result",
84                 "description": "LanguageDetectionResult object that holds detected langugae reliability and array of DetectedLanguage",
85                 "properties": {
86                   "isReliable": { "type": "boolean", "description": "CLD detected language reliability" },
87                   "languages":
88                     {
89                       "type": "array",
90                       "description": "array of detectedLanguage",
91                       "items":
92                         {
93                           "type": "object",
94                           "description": "DetectedLanguage object that holds detected ISO language code and its percentage in the input string",
95                           "properties":
96                             {
97                               "language":
98                                 {
99                                   "$ref": "LanguageCode"
100                                 },
101                               "percentage":
102                                 {
103                                   "type": "integer",
104                                   "description": "The percentage of the detected language"
105                                 }
106                             }
107                         }
108                     }
109                 }
110               }
111             ]
112           }
113         ]
114       }
115     ],
116     "events": []
117   }