Home | History | Annotate | Download | only in api
      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.
      4 
      5 [
      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     "functions": [
     11       {
     12         "name": "getAcceptLanguages",
     13         "type": "function",
     14         "description": "Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use <code>window.navigator.language</code>.",
     15         "parameters": [
     16           {
     17             "type": "function",
     18             "name": "callback",
     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"}
     21             ]
     22           }
     23         ]
     24       },
     25       {
     26         "name": "getMessage",
     27         "nocompile": true,
     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>messageName</em> is not a string or the <em>substitutions</em> array has more than 9 elements &mdash; this method returns <code>undefined</code>.",
     30         "parameters": [
     31           {
     32             "type": "string",
     33             "name": "messageName",
     34             "description": "The name of the message, as specified in the <a href='i18n-messages.html'><code>messages.json</code></a> file."
     35           },
     36           {
     37             "type": "any",
     38             "name": "substitutions",
     39             "optional": true,
     40             "description": "Up to 9 substitution strings, if the message requires any."
     41           }
     42         ],
     43         "returns": {
     44           "type": "string",
     45           "description": "Message localized for current locale."
     46         }
     47       }
     48     ],
     49     "events": []
     50   }
     51 ]
     52