1 // Copyright 2015 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.
5 // Use the <code>chrome.languageSettingsPrivate</code> API to get or change
6 // language and input method settings.
7 namespace languageSettingsPrivate
{
9 // The unique code identifying the language.
12 // The name of the language, in the current UI language.
13 DOMString displayName
;
15 // The name of the language as it is in its own language.
16 DOMString nativeDisplayName
;
18 // Whether the display name has RTL. Defaults to false.
19 boolean? displayNameRTL
;
21 // Whether the UI can be displayed in this language. Defaults to false.
24 // Whether this language can be used for spell checking. Defaults to false.
25 boolean? supportsSpellcheck
;
27 // Whether this language has translations for the current target language.
29 boolean? supportsTranslate
;
32 dictionary SpellcheckDictionaryStatus
{
33 // The language code of the dictionary that the status describes.
34 DOMString languageCode
;
36 // Whether the dictionary is ready (has been loaded from disk or
37 // successfully downloaded).
40 // Whether the dictionary is being downloaded. Defaults to false.
41 boolean? isDownloading
;
43 // Whether the dictionary download failed. Defaults to false.
44 boolean? downloadFailed
;
47 dictionary InputMethod
{
48 // The ID of the input method descriptor.
51 // The human-readable name of the input method.
52 DOMString displayName
;
54 // The language codes this input method supports.
55 DOMString
[] languageCodes
;
57 // True if the input method is enabled.
61 dictionary InputMethodLists
{
62 // The list of built-in input methods.
63 InputMethod
[] inputMethods
;
65 // The list of component extension input methods.
66 InputMethod
[] componentExtensionIMEs
;
68 // The list of third-party extension input methods.
69 InputMethod
[] thirdPartyExtensionIMEs
;
72 callback GetLanguageListCallback
= void (Language
[] languages
);
73 callback GetInputMethodListsCallback
= void (InputMethodLists lists
);
74 callback GetSpellcheckWordsCallback
= void (DOMString
[] words
);
75 callback GetTranslateTargetLanguageCallback
= void (DOMString languageCode
);
76 callback GetSpellcheckDictionaryStatusesCallback
=
77 void (SpellcheckDictionaryStatus
[] status
);
80 // Gets languages available for translate, spell checking, input and locale.
81 static
void getLanguageList
(GetLanguageListCallback
callback);
83 // Sets the accepted languages, used to decide which languages to translate,
84 // generate the Accept-Language header, etc.
85 static
void setLanguageList
(DOMString
[] languageCodes
);
87 // Gets the current status of the chosen spell check dictionaries.
88 static
void getSpellcheckDictionaryStatuses
(
89 GetSpellcheckDictionaryStatusesCallback
callback);
91 // Gets the custom spell check words.
92 static
void getSpellcheckWords
(GetSpellcheckWordsCallback
callback);
94 // Gets the translate target language (in most cases, the display locale).
95 static
void getTranslateTargetLanguage
(
96 GetTranslateTargetLanguageCallback
callback);
98 // Gets all supported input methods, including IMEs. Chrome OS only.
99 static
void getInputMethodLists
(GetInputMethodListsCallback
callback);
101 // Adds the input method to the current user's list of enabled input
102 // methods, enabling the input method for the current user. Chrome OS only.
103 static
void addInputMethod
(DOMString inputMethodId
);
105 // Removes the input method from the current user's list of enabled input
106 // methods, disabling the input method for the current user. Chrome OS only.
107 static
void removeInputMethod
(DOMString inputMethodId
);
111 // Called when the pref for the dictionaries used for spell checking changes
112 // or the status of one of the spell check dictionaries changes.
113 static
void onSpellcheckDictionariesChanged
(
114 SpellcheckDictionaryStatus
[] statuses
);
116 // Called when words are added to and/or removed from the custom spell check
118 static
void onCustomDictionaryChanged
(
119 DOMString
[] wordsAdded
, DOMString
[] wordsRemoved
);
121 // Called when an input method is added.
122 static
void onInputMethodAdded
(DOMString inputMethodId
);
124 // Called when an input method is removed.
125 static
void onInputMethodRemoved
(DOMString inputMethodId
);