////////////////////////////////////////////////////// // BEWARE: DO NOT EDIT MANUALLY! Changes will be lost! ////////////////////////////////////////////////////// /** * Namespace: browser.i18n */ export namespace I18n { /** * An ISO language code such as en or fr. For a complete list of languages supported by this * method, see * kLanguageInfoTable. For an unknown language, und will be returned, which means that [percentage] * of the text is unknown to CLD */ type LanguageCode = string; /** * LanguageDetectionResult object that holds detected langugae reliability and array of DetectedLanguage */ interface DetectLanguageCallbackResultType { /** * CLD detected language reliability */ isReliable: boolean; /** * array of detectedLanguage */ languages: DetectLanguageCallbackResultTypeLanguagesItemType[]; } /** * DetectedLanguage object that holds detected ISO language code and its percentage in the input string */ interface DetectLanguageCallbackResultTypeLanguagesItemType { language: LanguageCode; /** * The percentage of the detected language */ percentage: number; } interface Static { /** * 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). */ getAcceptLanguages(): Promise; /** * Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). * If the format of the getMessage() call is wrong — for example, messageName * is not a string or the substitutions array has more than 9 elements — this method returns * undefined. * * @param messageName The name of the message, as specified in the $(topic:i18n-messages)[messages.json] file. * @param substitutions Optional. Substitution strings, if the message requires any. * @returns Message localized for current locale. */ getMessage(messageName: string, substitutions?: string[] | string): string; /** * Gets the preferred locales of the operating system. This is different from the locales set in the browser; to get those, * use $(ref:i18n.getAcceptLanguages). */ getPreferredSystemLanguages(): Promise; /** * Gets the browser UI language of the browser. This is different from $(ref:i18n.getAcceptLanguages) * which returns the preferred user languages. * * @returns The browser UI language code such as en-US or fr-FR. */ getUILanguage(): string; /** * Detects the language of the provided text using CLD. * * @param text User input string to be translated. */ detectLanguage(text: string): Promise; } }