File: language_settings_private.idl

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (183 lines) | stat: -rw-r--r-- 6,631 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Use the <code>chrome.languageSettingsPrivate</code> API to get or change
// language and input method settings.
namespace languageSettingsPrivate {
  enum MoveType {
    TOP,
    UP,
    DOWN,
    UNKNOWN
  };

  dictionary Language {
    // The unique code identifying the language.
    DOMString code;

    // The name of the language, in the current UI language.
    DOMString displayName;

    // The name of the language as it is in its own language.
    DOMString nativeDisplayName;

    // Whether the UI can be displayed in this language. Defaults to false.
    boolean? supportsUI;

    // Whether this language can be used for spell checking. Defaults to false.
    boolean? supportsSpellcheck;

    // Whether this language has translations for the current target language.
    // Defaults to false.
    boolean? supportsTranslate;

    // Whether this language is prohibited as a UI locale (not in the list of
    // the 'AllowedLanguages' policy). Defaults to false.
    boolean? isProhibitedLanguage;
  };

  dictionary SpellcheckDictionaryStatus {
    // The language code of the dictionary that the status describes.
    DOMString languageCode;

    // Whether the dictionary is ready (has been loaded from disk or
    // successfully downloaded).
    boolean isReady;

    // Whether the dictionary is being downloaded. Defaults to false.
    boolean? isDownloading;

    // Whether the dictionary download failed. Defaults to false.
    boolean? downloadFailed;
  };

  dictionary InputMethod {
    // The ID of the input method descriptor.
    DOMString id;

    // The human-readable name of the input method.
    DOMString displayName;

    // The language codes this input method supports.
    DOMString[] languageCodes;

    // The search terms for the input method.
    DOMString[] tags;

    // True if the input method is enabled.
    boolean? enabled;

    // True if the input method extension has an options page.
    boolean? hasOptionsPage;

    // True if the input method is not allowed by policy.
    boolean? isProhibitedByPolicy;
  };

  dictionary InputMethodLists {
    // The list of component extension input methods.
    InputMethod[] componentExtensionImes;

    // The list of third-party extension input methods.
    InputMethod[] thirdPartyExtensionImes;
  };

  callback GetLanguageListCallback = void (Language[] languages);
  callback GetAlwaysTranslateLanguagesCallback =
      void (DOMString[] languageCodes);
  callback GetNeverTranslateLanguagesCallback =
      void (DOMString[] languageCodes);
  callback GetInputMethodListsCallback = void (InputMethodLists lists);
  callback GetSpellcheckWordsCallback = void (DOMString[] words);
  callback GetTranslateTargetLanguageCallback = void (DOMString languageCode);
  callback GetSpellcheckDictionaryStatusesCallback =
      void (SpellcheckDictionaryStatus[] status);

  interface Functions {
    // Gets languages available for translate, spell checking, input and locale.
    static void getLanguageList(
        GetLanguageListCallback callback);

    // Enables a language, adding it to the Accept-Language list (used to decide
    // which languages to translate, generate the Accept-Language header, etc.).
    static void enableLanguage(DOMString languageCode);

    // Disables a language, removing it from the Accept-Language list.
    static void disableLanguage(DOMString languageCode);

    // Enables or disables translation for a given language.
    static void setEnableTranslationForLanguage(
        DOMString languageCode, boolean enable);

    // Moves a language inside the language list.
    static void moveLanguage(DOMString languageCode, MoveType moveType);

    // Gets languages that should always be automatically translated.
    static void getAlwaysTranslateLanguages(
        GetAlwaysTranslateLanguagesCallback callback);

    // Sets whether a given language should always be automatically translated.
    static void setLanguageAlwaysTranslateState(
        DOMString languageCode, boolean alwaysTranslate);

    // Gets languages that should never be offered to translate.
    static void getNeverTranslateLanguages(
        GetNeverTranslateLanguagesCallback callback);

    // Gets the current status of the chosen spell check dictionaries.
    static void getSpellcheckDictionaryStatuses(
        GetSpellcheckDictionaryStatusesCallback callback);

    // Gets the custom spell check words, in sorted order.
    static void getSpellcheckWords(
        GetSpellcheckWordsCallback callback);

    // Adds a word to the custom dictionary.
    static void addSpellcheckWord(DOMString word);

    // Removes a word from the custom dictionary.
    static void removeSpellcheckWord(DOMString word);

    // Gets the translate target language (in most cases, the display locale).
    static void getTranslateTargetLanguage(
        GetTranslateTargetLanguageCallback callback);

    // Sets the translate target language given a language code.
    static void setTranslateTargetLanguage(DOMString languageCode);

    // Gets all supported input methods, including third-party IMEs.
    // Chrome OS only.
    static void getInputMethodLists(
        GetInputMethodListsCallback callback);

    // Adds the input method to the current user's list of enabled input
    // methods, enabling the input method for the current user. Chrome OS only.
    static void addInputMethod(DOMString inputMethodId);

    // Removes the input method from the current user's list of enabled input
    // methods, disabling the input method for the current user. Chrome OS only.
    static void removeInputMethod(DOMString inputMethodId);

    // Tries to download the dictionary after a failed download.
    static void retryDownloadDictionary(DOMString languageCode);
  };

  interface Events {
    // Called when the pref for the dictionaries used for spell checking changes
    // or the status of one of the spell check dictionaries changes.
    static void onSpellcheckDictionariesChanged(
        SpellcheckDictionaryStatus[] statuses);

    // Called when words are added to and/or removed from the custom spell check
    // dictionary.
    static void onCustomDictionaryChanged(
        DOMString[] wordsAdded, DOMString[] wordsRemoved);

    // Called when an input method is added.
    static void onInputMethodAdded(DOMString inputMethodId);

    // Called when an input method is removed.
    static void onInputMethodRemoved(DOMString inputMethodId);
  };
};