diff --git a/api/i18n_1.d.ts b/api/i18n_1.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5eba0833fe385c6a034f76853c259f98812397ad --- /dev/null +++ b/api/i18n_1.d.ts @@ -0,0 +1,1001 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit LocalizationKit + */ + +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @since 6 + */ +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ +declare namespace intl { + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.LocaleOptions + * @arkts 1.1&1.2 + */ + export interface LocaleOptions { + /** + * Indicates the calendar. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the calendar. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the calendar. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the calendar. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Calendar parameter. The value can be: "buddhist", "chinese", "coptic", "dangi", "ethioaa", "ethiopic", + * "gregory", "hebrew", "indian", "islamic", "islamic-umalqura", "islamic-tbla", "islamic-civil", + * "islamic-rgsa", "iso8601", "japanese", "persian", "roc", or "islamicc". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.LocaleOptions.calendar + * @arkts 1.1&1.2 + */ + calendar?: string; + + /** + * Indicates the collation. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the collation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the collation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the collation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Collation parameter. The value can be: "big5han", "compat", "dict", "direct", "ducet", "emoji", "eor", "gb2312", + * "phonebk", "phonetic", "pinyin", "reformed, "search", "searchjl", "standard", "stroke", "trad", "unihan", "zhuyin" + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.LocaleOptions.collation + * @arkts 1.1&1.2 + */ + collation?: string; + + /** + * Indicates the hourCycle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Hour cycle. The value can be: "h11", "h12", "h23", or "h24". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.LocaleOptions.hourCycle + * @arkts 1.1&1.2 + */ + hourCycle?: string; + + /** + * Indicates the numberingSystem. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", "brah", "cakm", + * "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", "java", "kali", + * "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", "mathmono", + * "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", "newa", "nkoo", + * "olck", "orya*", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", "takr", "talu", + * "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.LocaleOptions.numberingSystem + * @arkts 1.1&1.2 + */ + numberingSystem?: string; + + /** + * Indicates the numeric. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numeric. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numeric. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numeric. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Wether to use special sorting rules for digits. The value "true" means to use special sorting rules for digits, + * and the value "false" means the opposite. The default value is "false". + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.LocaleOptions.numeric + * @arkts 1.1&1.2 + */ + numeric?: boolean; + + /** + * Indicates the caseFirst. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the caseFirst. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the caseFirst. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the caseFirst. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Whether upper case or lower case is sorted first. The value can be "upper", "lower", or "false". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.LocaleOptions.caseFirst + * @arkts 1.1&1.2 + */ + caseFirst?: string; + } + + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Locale + * @arkts 1.1&1.2 + */ + export class Locale { + /** + * A constructor used to create a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Creates a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead i18n.System.getSystemLocaleObject + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * A constructor used to create a Locale object. + * + * @param { string } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region. + * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * A constructor used to create a Locale object. + * + * @param { string } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region. + * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a Locale object. + * + * @param { string } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region. + * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Creates a Locale object. + * + * @param { string } locale - Locale information, which consists of the language, script, and country/region. + * @param { LocaleOptions } [options] - Options for creating the Locale object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Locale.constructor + * @arkts 1.1&1.2 + */ + constructor(locale: string, options?: LocaleOptions); + + /** + * Indicates the language of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the language of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the language of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Language associated with the locale, for example, "zh". The value complies with the ISO 639 standard. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.language + */ + language: string; + + /** + * Indicates the script of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the script of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the script of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Script type of the language, for example, "Hans". The value complies with the Unicode ISO 15924 standard. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.script + */ + script: string; + + /** + * Indicates the region of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the region of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the region of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Country/region associated with the locale, for example, "CN". The value complies with the ISO 3166 standard. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.region + */ + region: string; + + /** + * Indicates the basic locale information, which is returned as a substring of + * a complete locale string. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the basic locale information, which is returned as a substring of + * a complete locale string. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the basic locale information, which is returned as a substring of + * a complete locale string. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Locale information, which consists of the language, script, and country/region, for example, "zh-Hans-CN". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.baseName + */ + baseName: string; + + /** + * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Whether case is taken into account for the locale's collation rules. The value can be: "upper", "lower", or + * "false". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.caseFirst + */ + caseFirst: string; + + /** + * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Calendar for the locale. The value can be: "buddhist", "chinese", "coptic", "dangi", "ethioaa", "ethiopic", + * "gregory", "hebrew", "indian", "islamic", "islamic-umalqura", "islamic-tbla", "islamic-civil", "islamic-rgsa", + * "iso8601", "japanese", "persian", "roc", or "islamicc". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.calendar + */ + calendar: string; + + /** + * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Collation rules for the locale. The value can be: "big5han", "compat", "dict", "direct", "ducet", "eor", + * "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "searchjl", "stroke", "trad", "unihan", or "zhuyin". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.collation + */ + collation: string; + + /** + * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Time system for the locale. The value can be: "h11", "h12", "h23", or "h24". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.hourCycle + */ + hourCycle: string; + + /** + * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Numbering system for the locale. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", + * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", + * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", + * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", + * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", + * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.numberingSystem + */ + numberingSystem: string; + + /** + * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Wether to use special sorting rules for digits. The value "true" means to use special sorting rules for digits, + * and the value "false" means the opposite. The default value is "false". + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + * @deprecated since 20 + * @useinstead Intl.Locale.numeric + */ + numeric: boolean; + + /** + * Get the language of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get language(): string; + + /** + * Set the language of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set language(value: string); + + /** + * Get the script of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get script(): string; + + /** + * Set the script of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set script(value: string); + + /** + * Get the region of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get region(): string; + + /** + * Set the region of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set region(value: string); + + /** + * Get the baseName of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get baseName(): string; + + /** + * Set the baseName of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set baseName(value: string); + + /** + * Get the caseFirst of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get caseFirst(): string; + + /** + * Set the caseFirst of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set caseFirst(value: string); + + /** + * Get the calendar of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get calendar(): string; \ No newline at end of file diff --git a/api/i18n_2.d.ts b/api/i18n_2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c4b17b9ff8603543d8dc867df475f402c9be7f2 --- /dev/null +++ b/api/i18n_2.d.ts @@ -0,0 +1,1016 @@ +/** + * Set the calendar of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set calendar(value: string); + + /** + * Get the collation of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get collation(): string; + + /** + * Set the collation of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set collation(value: string); + + /** + * Get the hourCycle of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get hourCycle(): string; + + /** + * Set the hourCycle of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set hourCycle(value: string); + + /** + * Get the numberingSystem of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get numberingSystem(): string; + + /** + * Set the numberingSystem of the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set numberingSystem(value: string); + + /** + * Get the numeric of the locale. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + get numeric(): boolean; + + /** + * Set the numeric of the locale. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 20 + * @deprecated since 20 + * @arkts 1.2 + */ + set numeric(value: boolean); + + /** + * Convert the locale information to string. + * + * @returns { string } locale information in string form. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Convert the locale information to string. + * + * @returns { string } locale information in string form. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Convert the locale information to string. + * + * @returns { string } locale information in string form. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Obtains the string that represents a Locale object. + * + * @returns { string } String that represents the Locale object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Locale.toString + * @arkts 1.1&1.2 + */ + toString(): string; + + /** + * Maximize the locale's base information. + * + * @returns { Locale } maximized locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Maximize the locale's base information. + * + * @returns { Locale } maximized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Maximize the locale's base information. + * + * @returns { Locale } maximized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Maximizes locale information by supplementing the missing script and country/region information. + * + * @returns { Locale } Locale object with the script and country/region information. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Locale.maximize + * @arkts 1.1&1.2 + */ + maximize(): Locale; + + /** + * Minimize the locale's base information. + * + * @returns { Locale } minimized locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Minimize the locale's base information. + * + * @returns { Locale } minimized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimize the locale's base information. + * + * @returns { Locale } minimized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Minimizes locale information by removing the script and country/region information. + * + * @returns { Locale } Locale object without the script and country/region information. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Locale.minimize + * @arkts 1.1&1.2 + */ + minimize(): Locale; + } + + /** + * Provides the options of date time format. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the options of date time format. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of date time format. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Defines the options for a DateTimeOptions object. Since API version 9, the DateTimeOptions attribute is changed + * from mandatory to optional. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions + * @arkts 1.1&1.2 + */ + export interface DateTimeOptions { + /** + * Indicates the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Valid locale ID, for example, "zh-Hans-CN". The default value is the current system locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.locale + * @arkts 1.1&1.2 + */ + locale?: string; + + /** + * Indicates the dateStyle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the dateStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the dateStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the dateStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Date display format. The value can be: "long", "short", "medium", "full", or "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.dateStyle + * @arkts 1.1&1.2 + */ + dateStyle?: string; + + /** + * Indicates the timeStyle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the timeStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the timeStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the timeStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Time display format. The value can be: "long", "short", "medium", "full", or "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.timeStyle + * @arkts 1.1&1.2 + */ + timeStyle?: string; + + /** + * Indicates the hourCycle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Hour cycle. The value can be: "h11", "h12", "h23", or "h24". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.hourCycle + * @arkts 1.1&1.2 + */ + hourCycle?: string; + + /** + * Indicates the timeZone. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the timeZone. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the timeZone. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the timeZone. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Time zone in use. The value is a valid IANA time zone ID. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.timeZone + * @arkts 1.1&1.2 + */ + timeZone?: string; + + /** + * Indicates the numberingSystem. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", + * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", + * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", + * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", + * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", + * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.numberingSystem + * @arkts 1.1&1.2 + */ + numberingSystem?: string; + + /** + * Indicates the hour12. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hour12. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hour12. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hour12. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Whether to use the 12-hour clock. The value true means to use the 12-hour clock, and the value false means the + * opposite. If both hour12 and hourCycle are set, hourCycle does not take effect. If hour12 and hourCycle are not + * set and the 24-hour clock is turned on, the default value of hour12 is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.hour12 + * @arkts 1.1&1.2 + */ + hour12?: boolean; + + /** + * Indicates the weekday. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the weekday. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the weekday. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the weekday. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Week display format. The value can be: "long", "short", "narrow", or "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.weekday + * @arkts 1.1&1.2 + */ + weekday?: string; + + /** + * Indicates the era. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the era. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the era. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the era. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Epoch display format. The value can be: "long", "short", "narrow", or "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.era + * @arkts 1.1&1.2 + */ + era?: string; + + /** + * Indicates the year. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the year. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the year. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the year. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Year display format. The value can be: "numeric" or "2-digit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.year + * @arkts 1.1&1.2 + */ + year?: string; + + /** + * Indicates the month. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the month. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the month. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the month. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Month display format. The value can be: "numeric", "2-digit", "long", "short", "narrow", or "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.month + * @arkts 1.1&1.2 + */ + month?: string; + + /** + * Indicates the day. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the day. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the day. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the day. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Day display format. The value can be: "numeric" or "2-digit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.day + * @arkts 1.1&1.2 + */ + day?: string; + + /** + * Indicates the hour. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hour. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hour. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hour. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Hour display format. The value can be: "numeric" or "2-digit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.hour + * @arkts 1.1&1.2 + */ + hour?: string; + + /** + * Indicates the minute. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minute. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minute. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the minute. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Minute display format. The value can be: "numeric" or "2-digit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.minute + * @arkts 1.1&1.2 + */ + minute?: string; + + /** + * Indicates the second. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the second. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the second. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the second. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Second display format. The value can be: "numeric" or "2-digit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.second + * @arkts 1.1&1.2 + */ + second?: string; + + /** + * Indicates the timeZoneName. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the timeZoneName. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the timeZoneName. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the timeZoneName. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Localized representation of a time zone name. The value can be: "long", "short", or "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.timeZoneName + * @arkts 1.1&1.2 + */ + timeZoneName?: string; \ No newline at end of file diff --git a/api/i18n_3.d.ts b/api/i18n_3.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fb01b659956a06f47adbf90925304c1fa92bee8d --- /dev/null +++ b/api/i18n_3.d.ts @@ -0,0 +1,2014 @@ +/** + * Indicates the dayPeriod. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the dayPeriod. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the dayPeriod. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the dayPeriod. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Time period display format. The value can be: "long", "short", "narrow", or "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.dayPeriod + * @arkts 1.1&1.2 + */ + dayPeriod?: string; + + /** + * Indicates the localeMatcher. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Locale matching algorithm. The value can be: + * "lookup": exact match. + * "best fit": best match. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.localeMatcher + * @arkts 1.1&1.2 + */ + localeMatcher?: string; + + /** + * Indicates the formatMatcher. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the formatMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the formatMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the formatMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Format matching algorithm. The value can be: + * "basic": exact match. + * "best fit": best match. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeOptions.formatMatcher + * @arkts 1.1&1.2 + */ + formatMatcher?: string; + } + + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeFormat + * @arkts 1.1&1.2 + */ + export class DateTimeFormat { + /** + * A constructor used to create a DateTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Creates a DateTimeOptions object for the specified locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeFormat.constructor + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * A constructor used to create a DateTimeFormat object. + * + * @param { string | Array } locale - Indicates character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param { DateTimeOptions } [options] - Indicates the options used to format the date. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @param { string | Array } locale - Indicates character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param { DateTimeOptions } [options] - Indicates the options used to format the date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @param { string | Array } locale - Indicates character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param { DateTimeOptions } [options] - Indicates the options used to format the date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Creates a DateTimeOptions object for the specified locale. + * + * @param { string | Array } locale - Locale ID or locale ID array. If the input is a locale ID array, the + * first valid locale ID is used. + * @param { DateTimeOptions } [options] - Options for creating the DateTimeOptions object.
If no options are + * set, the default values of year, month, and day are numeric. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeFormat.constructor + * @arkts 1.1&1.2 + */ + constructor(locale: string | Array, options?: DateTimeOptions); + + /** + * Obtains the formatted date strings. + * + * @param { Date } date - Indicates the Date object to be formatted. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the formatted date strings. + * + * @param { Date } date - Indicates the Date object to be formatted. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the formatted date strings. + * + * @param { Date } date - Indicates the Date object to be formatted. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Formats the date and time. + * + * @param { Date } date - Date and time. Note: The month starts from 0. For example, 0 indicates January. + * @returns { string } A string containing the formatted date and time. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeFormat.format + * @arkts 1.1&1.2 + */ + format(date: Date): string; + + /** + * Obtains the formatted date strings of a date range. + * + * @param { Date } startDate - Indicates the start date of the date range. + * @param { Date } endDate - Indicates the end date of the date range. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the formatted date strings of a date range. + * + * @param { Date } startDate - Indicates the start date of the date range. + * @param { Date } endDate - Indicates the end date of the date range. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the formatted date strings of a date range. + * + * @param { Date } startDate - Indicates the start date of the date range. + * @param { Date } endDate - Indicates the end date of the date range. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Formats date and time ranges. + * + * @param { Date } startDate - Start date and time. Note: The month starts from 0. For example, 0 indicates + * January. + * @param { Date } endDate - End date and time. Note: The month starts from 0. For example, 0 indicates January. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeFormat.formatRange + * @arkts 1.1&1.2 + */ + formatRange(startDate: Date, endDate: Date): string; + + /** + * Obtains the options of the DateTimeFormat object. + * + * @returns { DateTimeOptions } the options of the DateTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the options of the DateTimeFormat object. + * + * @returns { DateTimeOptions } the options of the DateTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the options of the DateTimeFormat object. + * + * @returns { DateTimeOptions } the options of the DateTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Obtains the options for creating a DateTimeOptions object. + * + * @returns { DateTimeOptions } Options for the DateTimeOptions object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.DateTimeFormat.resolvedOptions + * @arkts 1.1&1.2 + */ + resolvedOptions(): DateTimeOptions; + } + + /** + * Provides the options of number format. + * + * @interface NumberOptions + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the options of number format. + * + * @interface NumberOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Options for creating the NumberFormat object. Since API version 9, the NumberOptions attribute is changed from + * mandatory to optional. + * + * @interface NumberOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions + * @arkts 1.1&1.2 + */ + export interface NumberOptions { + /** + * Indicates the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Valid locale ID, for example, "zh-Hans-CN". The default value is the current system locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.locale + * @arkts 1.1&1.2 + */ + locale?: string; + + /** + * Indicates the currency. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the currency. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the currency. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Currency unit. The value must comply with the [ISO-4217 standard](https://www.iso.org/iso-4217-currency-codes.html), + * for example, "EUR", "CNY", and "USD". From API version 12, a three-digit number is supported, for example, "978", + * "156", or "840". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.currency + * @arkts 1.1&1.2 + */ + currency?: string; + + /** + * Indicates the currencySign. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the currencySign. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the currencySign. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * urrency unit symbol. The value can be "standard" or "accounting". The default value is "standard". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.currencySign + * @arkts 1.1&1.2 + */ + currencySign?: string; + + /** + * Indicates the currencyDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the currencyDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the currencyDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Currency display mode. The value can be "symbol", "narrowSymbol", "code", or "name". + * The default value is "symbol". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.currencyDisplay + * @arkts 1.1&1.2 + */ + currencyDisplay?: string; + + /** + * Indicates the unit. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the unit. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the unit. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Unit name, for example, "meter", "inch", or "hectare". The combination units supported since API version 18 are + * as follows: "beat-per-minute", "body-weight-per-second", "breath-per-minute", "foot-per-hour", + * "jump-rope-per-minute", "meter-per-hour", "milliliter-per-minute-per-kilogram", "rotation-per-minute", + * "step-per-minute", and "stroke-per-minute". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.unit + * @arkts 1.1&1.2 + */ + unit?: string; + + /** + * Indicates the unitDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the unitDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the unitDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Display format of units. The value can be "long", "short", or "narrow". The default value is "short". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.unitDisplay + * @arkts 1.1&1.2 + */ + unitDisplay?: string; + + /** + * Indicates the unitUsage. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Indicates the unitUsage. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the unitUsage. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Application scenario of units. The value can be any of the following: "default", "area-land-agricult", + * "area-land-commercl", "area-land-residntl", "length-person", "length-person-small", "length-rainfall", + * "length-road", "length-road-small", "length-snowfall", "length-vehicle", "length-visiblty", + * "length-visiblty-small", "length-person-informal", "length-person-small-informal", "length-road-informal", + * "speed-road-travel", "speed-wind", "temperature-person", "temperature-weather", "volume-vehicle-fuel", + * "elapsed-time-second", "size-file-byte", or "size-shortfile-byte". The default value is "default". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ + unitUsage?: string; + + /** + * Indicates the signDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the signDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the signDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Number sign display format. The value can be: + * "auto": automatically determines whether to display the plus or minus sign. + * "never": do not display the plus or minus sign. + * "always": always displays the plus or minus sign. + * "exceptZero": displays the plus or minus sign for all values except 0. + * Default value: "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.signDisplay + * @arkts 1.1&1.2 + */ + signDisplay?: string; + + /** + * Indicates the compactDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the compactDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the compactDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Compact display format. The value can be "long" or "short". The default value is "short". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.compactDisplay + * @arkts 1.1&1.2 + */ + compactDisplay?: string; + + /** + * Indicates the notation. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the notation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the notation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Number notation. The value can be: "standard", "scientific", "engineering", or "compact". + * The default value is "standard". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.notation + * @arkts 1.1&1.2 + */ + notation?: string; + + /** + * Indicates the localeMatcher. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.localeMatcher + * @arkts 1.1&1.2 + */ + localeMatcher?: string; + + /** + * Indicates the style. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the style. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the style. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Number display format. The value can be "decimal", "currency", "percent", or "unit". + * The default value is "decimal". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.style + * @arkts 1.1&1.2 + */ + style?: string; + + /** + * Indicates the numberingSystem. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", + * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", + * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", + * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", + * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", + * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.numberingSystem + * @arkts 1.1&1.2 + */ + numberingSystem?: string; + + /** + * Indicates the useGrouping. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the useGrouping. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the useGrouping. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether to enable grouping for display. The value "true" means to enable grouping for display, and the value + * "false" means the opposite. The default value is "true". + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.useGrouping + * @arkts 1.1&1.2 + */ + useGrouping?: boolean; + + /** + * Indicates the minimumIntegerDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minimumIntegerDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minimumIntegerDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimum number of digits allowed in the integer part of a number. The value ranges from 1 to 21. + * The default value is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.minimumIntegerDigits + * @arkts 1.1&1.2 + */ + minimumIntegerDigits?: number; + + /** + * Indicates the minimumFractionDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minimumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minimumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimum number of digits in the fraction part of a number. The value ranges from 0 to 20. + * The default value is 0. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.minimumFractionDigits + * @arkts 1.1&1.2 + */ + minimumFractionDigits?: number; + + /** + * Indicates the maximumFractionDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the maximumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the maximumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Maximum number of digits in the fraction part of a number. The value ranges from 1 to 21. + * The default value is 3. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.maximumFractionDigits + * @arkts 1.1&1.2 + */ + maximumFractionDigits?: number; + + /** + * Indicates the minimumSignificantDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minimumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minimumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimum number of the least significant digits. The value ranges from 1 to 21. The default value is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.minimumSignificantDigits + * @arkts 1.1&1.2 + */ + minimumSignificantDigits?: number; + + /** + * Indicates the maximumSignificantDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the maximumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the maximumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Maximum number of the least significant digits. The value ranges from 1 to 21. The default value is 21. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.maximumSignificantDigits + * @arkts 1.1&1.2 + */ + maximumSignificantDigits?: number; + + /** + * Rounding priority used when both the maximum number of fraction digits and the maximum number of valid digits + * are set. The value can be: "auto", "morePrecision", or "lessPrecision". The value "morePrecision" indicates that + * the maximum number of fraction digits is used. The value "lessPrecision" indicates that the maximum number of + * valid digits is used. The default value is "auto". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.roundingPriority + * @arkts 1.1&1.2 + */ + roundingPriority?: string; + + /** + * Rounding increment. The value can be: 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, or 5000. + * The default value is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.roundingIncrement + * @arkts 1.1&1.2 + */ + roundingIncrement?: number; + + /** + * Rounding mode. The value can be: + * "ceil": rounding up. + * "floor": rounding down. + * "expand": rounding away from 0. + * "trunc": rounding toward 0. + * "halfCeil": half-rounding up; that is, rounding up when the decimal number is greater than or equal to half of + * the increment, and rounding down otherwise. + * "halfFloor": half-rounding down; that is, rounding up when the decimal number is greater than half of the + * increment, and rounding down otherwise. + * "halfExpand": half-rounding away from 0; that is, rounding away from 0 when the decimal number is greater than + * or equal to half of the increment, and rounding toward 0 otherwise. + * "halfTrunc": half-rounding toward 0; that is, rounding away from 0 when the decimal number is greater than half + * of the increment, and rounding toward 0 otherwise. + * "halfEven": half-rounding to the nearest even number; that is, rounding away from 0 when the decimal number is + * greater than half of the increment, rounding toward 0 when the decimal number is less than half of + * the increment, and rounding to the nearest even number when the decimal number is exactly half of + * the increment. + * The default value is "halfExpand". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberOptions.roundingMode + * @arkts 1.1&1.2 + */ + roundingMode?: string; + } + + /** + * Provides the API for formatting number strings. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the API for formatting number strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for formatting number strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberFormat + * @arkts 1.1&1.2 + */ + export class NumberFormat { + /** + * A constructor used to create a NumberFormat object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a NumberFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a NumberFormat object for the specified locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberFormat.constructor + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * A constructor used to create a NumberFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @param { NumberOptions } [options] - Indicates the options used to format the number. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * A constructor used to create a NumberFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @param { NumberOptions } [options] - Indicates the options used to format the number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a NumberFormat object for the specified locale. + * + * @param { string | Array } locale - Locale ID or locale ID array. If the input is a locale ID array, + * the first valid locale ID is used. + * @param { NumberOptions } [options] - Options for creating the NumberFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberFormat.constructor + * @arkts 1.1&1.2 + */ + constructor(locale: string | Array, options?: NumberOptions); + + /** + * Obtains the formatted number string. + * + * @param { number } number Indicates the number to be formatted. + * @returns { string } a number string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the formatted number string. + * + * @param { number } number Indicates the number to be formatted. + * @returns { string } a number string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Formats a number. + * + * @param { number } number - Number to be formatted. + * @returns { string } Formatted number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberFormat.format + * @arkts 1.1&1.2 + */ + format(number: number): string; + + /** + * Formats a number range. + * + * @param { number } startRange - Start number. + * @param { number } endRange - End number. + * @returns { string } Formatted number range. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberFormat.formatRange + * @arkts 1.1&1.2 + */ + formatRange(startRange: number, endRange: number): string; + + /** + * Obtains the options of the NumberFormat object. + * + * @returns { NumberOptions } the options of the NumberFormat object. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the options of the NumberFormat object. + * + * @returns { NumberOptions } the options of the NumberFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the options for creating a NumberFormat object. + * + * @returns { NumberOptions } Options for creating the NumberFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.NumberFormat.resolvedOptions + * @arkts 1.1&1.2 + */ + resolvedOptions(): NumberOptions; + } + + /** + * Provides the options of Collator + * + * @interface CollatorOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the options of Collator + * + * @interface CollatorOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Defines the options for creating a Collator object. + * + * @interface CollatorOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions + * @arkts 1.1&1.2 + */ + export interface CollatorOptions { + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions.localeMatcher + * @arkts 1.1&1.2 + */ + localeMatcher?: string; + + /** + * Whether the comparison is for sorting or for searching for matching strings. + * Possible values are "sort" and "search"; the default is "sort". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether the comparison is for sorting or for searching for matching strings. + * Possible values are "sort" and "search"; the default is "sort". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether the comparison is for sorting or for searching for matching strings. + * Possible values are "sort" and "search"; the default is "sort". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether the comparison is for sorting or for searching. The value can be "sort" or "search". + * The default value is "sort". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions.usage + * @arkts 1.1&1.2 + */ + usage?: string; + + /** + * Which differences in the strings should lead to non-zero result values. + * Possible values are "base", "accent", "case", "variant". + * "base" are used when only strings that differ in base letters compare as unequal. + * "accent" are used when only strings that differ in base letters or accents and + * other diacritic marks compare as unequal. + * "case" are used when only strings that differ in base letters or case compare as unequal. + * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, + * or case compare as unequal. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Which differences in the strings should lead to non-zero result values. + * Possible values are "base", "accent", "case", "variant". + * "base" are used when only strings that differ in base letters compare as unequal. + * "accent" are used when only strings that differ in base letters or accents and + * other diacritic marks compare as unequal. + * "case" are used when only strings that differ in base letters or case compare as unequal. + * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, + * or case compare as unequal. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Which differences in the strings should lead to non-zero result values. + * Possible values are "base", "accent", "case", "variant". + * "base" are used when only strings that differ in base letters compare as unequal. + * "accent" are used when only strings that differ in base letters or accents and + * other diacritic marks compare as unequal. + * "case" are used when only strings that differ in base letters or case compare as unequal. + * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, + * or case compare as unequal. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Differences in the strings that lead to non-zero return values. The value can be "base", "accent", "case", or + * "letiant". The default value is "variant". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions.sensitivity + * @arkts 1.1&1.2 + */ + sensitivity?: string; + + /** + * Whether punctuation should be ignored. default value is false. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether punctuation should be ignored. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether punctuation should be ignored. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether to ignore punctuation. The value "true" means to ignore punctuation, and the value "false" means the + * opposite. The default value is "false". + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions.ignorePunctuation + * @arkts 1.1&1.2 + */ + ignorePunctuation?: boolean; + /** + * Variant collations for certain locales. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Variant collations for certain locales. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Variant collations for certain locales. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Collation rule. The value can be any of the following: "big5han", "compat", "dict", "direct", "ducet", "eor", + * "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "searchjl", "stroke", "trad", "unihan", or "zhuyin". + * The default value is "default". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions.collation + * @arkts 1.1&1.2 + */ + collation?: string; + + /** + * Whether numeric collation should be used. Default value is false. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether numeric collation should be used. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether numeric collation should be used. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether to use numeric collation. The value "true" means to use numeric collation, and the value "false" means + * the opposite. The default value is "false". + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions.numeric + * @arkts 1.1&1.2 + */ + numeric?: boolean; + + /** + * Whether upper case or lower case should sort first. + * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether upper case or lower case should sort first. + * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether upper case or lower case should sort first. + * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether upper case or lower case is sorted first. The value can be "upper", "lower", or "false". + * The default value is "false". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.CollatorOptions.caseFirst + * @arkts 1.1&1.2 + */ + caseFirst?: string; + } + + /** + * Enable language-sensitive string comparison. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Enable language-sensitive string comparison. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Enable language-sensitive string comparison. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Collator + * @arkts 1.1&1.2 + */ + export class Collator { + /** + * A constructor used to create Collator object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create Collator object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a Collator object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Collator.constructor + * @arkts 1.1&1.2 + */ + constructor(); + /** + * A constructor used to create Collator Object; + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the Collator object. + * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create Collator Object; + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the Collator object. + * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a Collator object. + * + * @param { string | Array } locale - Locale ID or locale ID array. If the input is a locale ID array, + * the first valid locale ID is used. + * @param { CollatorOptions } [options] - Options for creating a Collator object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Collator.constructor + * @arkts 1.1&1.2 + */ + constructor(locale: string | Array, options?: CollatorOptions); + + /** + * compares two strings according to the sort order of this Collator object + * + * @param { string } first - The first string to compare. + * @param { string } second - The second string to compare. + * @returns { number } a number indicating how first compare to second: + * a negative value if string1 comes before string2; + * a positive value if string1 comes after string2; + * 0 if they are considered equal. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * compares two strings according to the sort order of this Collator object + * + * @param { string } first - The first string to compare. + * @param { string } second - The second string to compare. + * @returns { number } a number indicating how first compare to second: + * a negative value if string1 comes before string2; + * a positive value if string1 comes after string2; + * 0 if they are considered equal. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Compares two strings based on the specified collation rules. + * + * @param { string } first - First string to compare. + * @param { string } second - Second string to compare. + * @returns { number } Comparison result. If the value is a negative number, the first string comes before the + * second string. If the value is 0, the first and second strings are in the same sequence. + * If the value is a positive number, the first string is comes after the second string. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Collator.compare + * @arkts 1.1&1.2 + */ + compare(first: string, second: string): number; + + /** + * Returns a new object with properties that reflect the locale and collation options computed + * during initialization of the object. + * + * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns a new object with properties that reflect the locale and collation options computed + * during initialization of the object. + * + * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the options for creating a Collator object. + * + * @returns { CollatorOptions } Options for creating a Collator object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.Collator.resolvedOptions + * @arkts 1.1&1.2 + */ + resolvedOptions(): CollatorOptions; + } + + /** + * Provides the options of PluralRules + * + * @interface PluralRulesOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the options of PluralRules + * + * @interface PluralRulesOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of PluralRules + * + * @interface PluralRulesOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions + * @arkts 1.1&1.2 + */ + export interface PluralRulesOptions { + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions.localeMatcher + * @arkts 1.1&1.2 + */ + localeMatcher?: string; + + /** + * The type to use. Possible values are: "cardinal", "ordinal" + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The type to use. Possible values are: "cardinal", "ordinal" + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The type to use. Possible values are: "cardinal", "ordinal" + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Collation type. The value can be "cardinal" or "ordinal". The default value is "cardinal". The value "cardinal" + * indicates a cardinal number and the value "ordinal" indicates an ordinal number. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions.type + * @arkts 1.1&1.2 + */ + type?: string; + + /** + * The minimum number of integer digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The minimum number of integer digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The minimum number of integer digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimum number of digits allowed in the integer part of a number. The value ranges from 1 to 21. + * The default value is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions.minimumIntegerDigits + * @arkts 1.1&1.2 + */ + minimumIntegerDigits?: number; + + /** + * The minimum number of fraction digits to use. + * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The minimum number of fraction digits to use. + * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The minimum number of fraction digits to use. + * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimum number of digits in the fraction part of a number. The value ranges from 0 to 20. + * The default value is 0. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions.minimumFractionDigits + * @arkts 1.1&1.2 + */ + minimumFractionDigits?: number; \ No newline at end of file diff --git a/api/i18n_4.d.ts b/api/i18n_4.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..29f8e15fbd7352c2013e6453876417ebcd8d2e8c --- /dev/null +++ b/api/i18n_4.d.ts @@ -0,0 +1,738 @@ +/** + * The maximum number of fraction digits to use. + * Possible values are from 0 to 20; + * the default for plain number formatting is the larger of minimumFractionDigits and 3; + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The maximum number of fraction digits to use. + * Possible values are from 0 to 20; + * the default for plain number formatting is the larger of minimumFractionDigits and 3; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The maximum number of fraction digits to use. + * Possible values are from 0 to 20; + * the default for plain number formatting is the larger of minimumFractionDigits and 3; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Maximum number of digits in the fraction part of a number. The value ranges from 1 to 21. + * The default value is 3. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions.maximumFractionDigits + * @arkts 1.1&1.2 + */ + maximumFractionDigits?: number; + + /** + * The minimum number of significant digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The minimum number of significant digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The minimum number of significant digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimum number of the least significant digits. The value ranges from 1 to 21. The default value is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions.minimumSignificantDigits + * @arkts 1.1&1.2 + */ + minimumSignificantDigits?: number; + + /** + * The maximum number of significant digits to use. + * Possible values are from 1 to 21; the default is 21. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The maximum number of significant digits to use. + * Possible values are from 1 to 21; the default is 21. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The maximum number of significant digits to use. + * Possible values are from 1 to 21; the default is 21. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Maximum number of the least significant digits. The value ranges from 1 to 21. The default value is 21. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRulesOptions.maximumSignificantDigits + * @arkts 1.1&1.2 + */ + maximumSignificantDigits?: number; + } + + /** + * Enables plural-sensitive formatting and plural-related language rules. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Enables plural-sensitive formatting and plural-related language rules. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Enables plural-sensitive formatting and plural-related language rules. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRules + * @arkts 1.1&1.2 + */ + export class PluralRules { + /** + * A constructor used to create PluralRules object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create PluralRules object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a PluralRules object to obtain the singular-plural type of numbers. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRules.constructor + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * A constructor used to create PluralRules object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the PluralRules object. + * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create PluralRules object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the PluralRules object. + * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a PluralRules object to obtain the singular-plural type of numbers. + * + * @param { string | Array } locale - Locale ID or locale ID array. If the input is a locale ID array, + * the first valid locale ID is used. + * @param { PluralRulesOptions } [options] - Options for creating a PluralRules object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRules.constructor + * @arkts 1.1&1.2 + */ + constructor(locale: string | Array, options?: PluralRulesOptions); + + /** + * Returns a string indicating which plural rule to use for locale-aware formatting. + * + * @param { number } n - The number to get a plural rule for. + * @returns { string } A string representing the pluralization category of the number, + * can be one of zero, one, two, few, many or other. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns a string indicating which plural rule to use for locale-aware formatting. + * + * @param { number } n - The number to get a plural rule for. + * @returns { string } A string representing the pluralization category of the number, + * can be one of zero, one, two, few, many or other. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the singular-plural type of the specified number. + * + * @param { number } n - Number for which the singular-plural type is to be obtained. + * @returns { string } Singular-plural type. The value can be any of the following: "zero", "one", "two", "few", + * "many", "others". For details about the meanings of different values, see + * [Language Plural Rules](https://www.unicode.org/cldr/charts/45/supplemental/language_plural_rules.html). + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.PluralRules.select + * @arkts 1.1&1.2 + */ + select(n: number): string; + } + + /** + * Provides the input options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatInputOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the input options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatInputOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the input options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatInputOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatInputOptions + * @arkts 1.1&1.2 + */ + export interface RelativeTimeFormatInputOptions { + /** + * The locale matching algorithm to use. + * Possible values are: lookup, best fit + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The locale matching algorithm to use. + * Possible values are: lookup, best fit + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The locale matching algorithm to use. + * Possible values are: lookup, best fit + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatInputOptions.localeMatcher + * @arkts 1.1&1.2 + */ + localeMatcher?: string; + + /** + * The format of output message. + * Possible values are: always, auto + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Format of the output message. The value can be "always" or "auto". The default value is "always". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatInputOptions.numeric + * @arkts 1.1&1.2 + */ + numeric?: string; + + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Length of an internationalized message. The value can be "long", "short", or "narrow". + * The default value is "long". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatInputOptions.style + * @arkts 1.1&1.2 + */ + style?: string; + } + + /** + * Provides the resolved options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatResolvedOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the resolved options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatResolvedOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the resolved options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatResolvedOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatResolvedOptions + * @arkts 1.1&1.2 + */ + export interface RelativeTimeFormatResolvedOptions { + /** + * The BCP 47 language tag for the locale actually used. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The BCP 47 language tag for the locale actually used. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Locale ID, including the language, script, and region. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatResolvedOptions.locale + * @arkts 1.1&1.2 + */ + locale: string; + + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Length of an internationalized message. The value can be "long", "short", or "narrow". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatResolvedOptions.style + * @arkts 1.1&1.2 + */ + style: string; + + /** + * The format of output message. + * Possible values are: always, auto + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Format of the output message. The value can be "always" or "auto". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatResolvedOptions.numeric + * @arkts 1.1&1.2 + */ + numeric: string; + + /** + * The value requested using the Unicode extension key "nu" or filled in as a default. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The value requested using the Unicode extension key "nu" or filled in as a default. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", + * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", + * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", + * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", + * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", + * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormatResolvedOptions.numberingSystem + * @arkts 1.1&1.2 + */ + numberingSystem: string; + } + + /** + * Given a Time period length value and a unit, RelativeTimeFormat object enables + * language-sensitive relative time formatting. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Given a Time period length value and a unit, RelativeTimeFormat object enables + * language-sensitive relative time formatting. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Given a Time period length value and a unit, RelativeTimeFormat object enables + * language-sensitive relative time formatting. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormat + * @arkts 1.1&1.2 + */ + export class RelativeTimeFormat { + /** + * A constructor used to create RelativeTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create RelativeTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a RelativeTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormat.constructor + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * A constructor used to create RelativeTimeFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the RelativeTimeFormat object. + * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create RelativeTimeFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the RelativeTimeFormat object. + * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Creates a RelativeTimeFormat object. + * + * @param { string | Array } locale - Locale ID or locale ID array. If the input is a locale ID array, + * the first valid locale ID is used. + * @param { RelativeTimeFormatInputOptions } [options] - Options for creating a RelativeTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormat.constructor + * @arkts 1.1&1.2 + */ + constructor(locale: string | Array, options?: RelativeTimeFormatInputOptions); + + /** + * formats a value and unit according to the locale and formatting options of this object. + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - Unit to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { string } formatted language-sensitive relative time. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * formats a value and unit according to the locale and formatting options of this object. + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - Unit to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { string } formatted language-sensitive relative time. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Formats a relative time. + * + * @param { number } value - Value to format. + * @param { string } unit - Unit of the relative time.
The value can be any of the following: "year", "quarter", + * "month", "week", "day", "hour", "minute", or "second". + * @returns { string } Relative time after formatting. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormat.format + * @arkts 1.1&1.2 + */ + format(value: number, unit: string): string; + + /** + * returns an Array of objects representing the relative time format in parts that can be used for + * custom locale-aware formatting + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { Array } an Array of objects representing the relative time format in parts + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * returns an Array of objects representing the relative time format in parts that can be used for + * custom locale-aware formatting + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { Array } an Array of objects representing the relative time format in parts + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Formats the relative time. + * + * @param { number } value - Value to format. + * @param { string } unit - Unit of the relative time.
The value can be any of the following: "year", "quarter", + * "month", "week", "day", "hour", "minute", or "second". + * @returns { Array } to parts. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormat.formatToParts + * @arkts 1.1&1.2 + */ + formatToParts(value: number, unit: string): Array; + + /** + * Returns a new object with properties that reflect the locale and formatting options computed during + * initialization of the object. + * + * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns a new object with properties that reflect the locale and formatting options computed during + * initialization of the object. + * + * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Defines the formatting options for a RelativeTimeFormat object. + * + * @returns { RelativeTimeFormatResolvedOptions } Options for the RelativeTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @deprecated since 20 + * @useinstead Intl.RelativeTimeFormat.resolvedOptions + * @arkts 1.1&1.2 + */ + resolvedOptions(): RelativeTimeFormatResolvedOptions; + } +} +export default intl; \ No newline at end of file diff --git a/api/intl_1.d.ts b/api/intl_1.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8f8235a4ce036fba24e99f10307ec74f49f4043 --- /dev/null +++ b/api/intl_1.d.ts @@ -0,0 +1,2000 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit LocalizationKit + */ + +/*** if arkts 1.1&1.2 */ +import { BusinessError } from './@ohos.base'; +import intl from './@ohos.intl'; +/*** endif */ +/*** if arkts 1.2 */ +import { StyledString, TextStyle } from './arkui/component/styledString'; +/*** endif */ + +/** + * Provides international settings related APIs. + * + * @namespace i18n + * @syscap SystemCapability.Global.I18n + * @since 7 + */ +/** + * Provides international settings related APIs. + * + * @namespace i18n + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ +declare namespace i18n { + /** + * Obtains the localized name of the specified country/region. + * + * @param { string } country - Specified country. + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @param { boolean } [sentenceCase] - Whether to use sentence case to display the text. The value "true" means to + * display the text in title case format, and the value "false" means to display + * the text in the default case format of the locale. The default value is true. + * @returns { string } Localized script for the specified country. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'7','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.System.getDisplayCountry + * @arkts 1.1&1.2 + */ + export function getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; + + /** + * Obtains the localized script for the specified language. + * + * @param { string } language - Specified language. + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @param { boolean } [sentenceCase] - Whether to use sentence case to display the text. The value "true" means to + * display the text in title case format, and the value "false" means to display + * the text in the default case format of the locale. The default value is true. + * @returns { string } Localized script for the specified language. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'7','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.System.getDisplayLanguage + * @arkts 1.1&1.2 + */ + export function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; + + /** + * Obtains the system language. + * + * @returns { string } System language ID. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'7','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.System.getSystemLanguage + * @arkts 1.1&1.2 + */ + export function getSystemLanguage(): string; + + /** + * Obtains the system region. + * + * @returns { string } System region ID. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'7','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.System.getSystemRegion + * @arkts 1.1&1.2 + */ + export function getSystemRegion(): string; + + /** + * Obtains the system locale. + * + * @returns { string } System locale ID. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'7','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.System.getSystemLocale + * @arkts 1.1&1.2 + */ + export function getSystemLocale(): string; + + /** + * Provides system functions. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides system functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides system functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class System { + /** + * Obtains the country or region name localized for display on a given locale. + * + * @param { string } country - The locale whose country or region name will be displayed. + * @param { string } locale - The locale used to display the country or region. + * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. + * @returns { string } the country or region name localized for display on a given locale. + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the country or region name localized for display on a given locale. + * + * @param { string } country - The locale whose country or region name will be displayed. It must be a valid country. + * @param { string } locale - The locale used to display the country or region. It must be a valid locale. + * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. + * @returns { string } the country or region name localized for display on a given locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the country/region display name in the specified language. + * + * @param { string } country - Valid country/region code. + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @param { boolean } [sentenceCase] - Whether to use sentence case to display the text. The value "true" means to + * display the text in title case format, and the value "false" means to + * display the text in the default case format of the locale. The default value + * is true. + * @returns { string } Country/region display name in the specified language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; + + /** + * Obtains the language name localized for display on a given locale. + * + * @param { string } language - The locale whose language name will be displayed. + * @param { string } locale - The locale used to display the language. + * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. + * @returns { string } the language name localized for display on a given locale. + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the language name localized for display on a given locale. + * + * @param { string } language - The locale whose language name will be displayed. + * @param { string } locale - The locale used to display the language. + * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. + * @returns { string } the language name localized for display on a given locale. + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the language display name in the specified language. + * + * @param { string } language - Valid language ID. + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @param { boolean } [sentenceCase] - Whether to use sentence case to display the text. The value "true" means to + * display the text in title case format, and the value "false" means to + * display the text in the default case format of the locale. The default value + * is true. + * @returns { string } Language display name in the specified language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; + + /** + * Obtains all languages supported by the system. + * + * @returns { Array } all languages supported by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the list of system languages. + * + * @returns { Array } List of system languages. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getSystemLanguages(): Array; + + /** + * Obtains all regions supported by the system in the language. + * + * @param { string } language - The language used to get the list of regions. It must be a valid language. + * @returns { Array } all countries or regions supported by the system in the language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the list of countries/regions supported for the specified language. + * + * @param { string } language - Valid language ID. + * @returns { Array } List of countries/regions supported for the specified language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getSystemCountries(language: string): Array; + + /** + * Determine whether the current language or region is recommended. + * + * @param { string } language - The language code. It must be a valid language. + * @param { string } [region] - The region code. It must be a valid region. + * @returns { boolean } whether the current language or region is recommended. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Checks whether a language is a suggested language in the specified region. It can be used for region-based + * language recommendation or language-based region recommendation. + * + * @param { string } language - Valid language ID, for example, "zh". + * @param { string } [region] - Valid region ID, for example, "CN". The default value is the country/region of the + * SIM card. + * @returns { boolean } Whether a language is a suggested language. The value "true" indicates that the language + * is a suggested language of the region, the the value "false" indicates the opposite. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isSuggested(language: string, region?: string): boolean; + + /** + * Obtains the language currently used by the system. + * + * @returns { string } the language currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the language currently used by the system. + * + * @returns { string } the language currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the current system language. + * + * @returns { string } Language ID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getSystemLanguage(): string; + + /** + * Sets the system language. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } language - Valid language ID. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'9','1.2':'20'} + * @arkts 1.1&1.2 + */ + static setSystemLanguage(language: string): void; + + /** + * Obtains the region currently used by the system. + * + * @returns { string } the region currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the region currently used by the system. + * + * @returns { string } the region currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the current system country/region. + * + * @returns { string } Country/region ID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getSystemRegion(): string; + + /** + * Sets the system region. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } region - Valid region ID. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'9','1.2':'20'} + * @arkts 1.1&1.2 + */ + static setSystemRegion(region: string): void; + + /** + * Obtains the locale currently used by the system. + * + * @returns { string } the locale currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the locale currently used by the system. + * + * @returns { string } the locale currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the current system locale. + * + * @returns { string } Locale ID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'11', '1.2':'20'} + * @deprecated since 20 + * @useinstead ohos.System.getSystemLocaleInstance + * @arkts 1.1&1.2 + */ + static getSystemLocale(): string; + + /** + * Obtains the locale object currently used by the system. + * + * @returns { Intl.Locale } the locale object currently used by the system. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + static getSystemLocaleInstance(): Intl.Locale; + + /** + * Sets the system locale. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'9','1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ + static setSystemLocale(locale: string): void; + + /** + * Check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Checks whether the 24-hour clock is used. + * + * @returns { boolean } Whether the 24-hour clock is used. The value "true" indicates that the 24-hour clock is + * used, the the value "false" means the opposite. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static is24HourClock(): boolean; + + /** + * Sets whether to use the 24-hour clock. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { boolean } option - Whether to use the 24-hour clock. The value "true" means to use the 24-hour clock, + * the the value "false" means the opposite. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'9','1.2':'20'} + * @arkts 1.1&1.2 + */ + static set24HourClock(option: boolean): void; + + /** + * Adds a preferred language to the specified position on the preferred language list. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } language - Valid ID of the language to be added as a preferred language. + * @param { number } [index] - Position to which the preferred language is added. The default value is the length + * of the preferred language list. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'9','1.2':'20'} + * @arkts 1.1&1.2 + */ + static addPreferredLanguage(language: string, index?: number): void; + + /** + * Removes a preferred language from the specified position on the preferred language list. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { number } index - Position of the preferred language to delete. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'9','1.2':'20'} + * @arkts 1.1&1.2 + */ + static removePreferredLanguage(index: number): void; + + /** + * Access the system preferred language list. + * + * @returns { Array } a string Array represent the preferred language list. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the list of preferred languages. + * + * @returns { Array } List of preferred languages. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getPreferredLanguageList(): Array; + + /** + * Get the first preferred language of system. + * + * @returns { string } a string represent the first preferred language of system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the first language in the preferred language list. + * + * @returns { string } First language in the preferred language list. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getFirstPreferredLanguage(): string; + + /** + * Set the preferred language of App. + * + * @param { string } language - the language to be set. It must be a valid language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Sets the preferred language of the application. Resources are loaded in the preferred language when the + * application is launched. If the preferred language is set to default, the application's language will be the + * same as the system language, and the setting will take effect upon cold starting of the application. + * + * @param { string } language - Valid language ID or default. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + /** + * Sets the preferred language of the application. Resources are loaded in the preferred language when the + * application is launched. If the preferred language is set to default, the application's language will be the + * same as the system language, and the setting will take effect upon cold starting of the application. + * + * @param { string } language - Valid language ID or default. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + static setAppPreferredLanguage(language: string): void; + + /** + * Get the preferred language of App. + * + * @returns { string } a string represent the preferred language of App. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the preferred language of an application. + * + * @returns { string } Preferred language of the application. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + /** + * Obtains the preferred language of an application. + * + * @returns { string } Preferred language of the application. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + static getAppPreferredLanguage(): string; + + /** + * Specifies whether to enable use of local digits. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { boolean } flag - Whether to turn on the local digit switch. The value "true" means to turn on the local + * digit switch, and the value "false" indicates the opposite. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'9','1.2':'20'} + * @arkts 1.1&1.2 + */ + static setUsingLocalDigit(flag: boolean): void; + + /** + * Get whether to use local digit. + * + * @returns { boolean } a boolean represents whether to use local digit. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Checks whether use of local digits is enabled. + * + * @returns { boolean } Whether use of local digits is enabled. The value "true" indicates that use of local digits + * is enabled, and the value "false" indicates the opposite. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getUsingLocalDigit(): boolean; + + /** + * Obtains the simplified representation of a language. For example, the simplified representation of "en-Latn-US" + * is "en", and that of "en-Latn-GB" is "en-GB". + * + * @param { string } [language] - Valid language ID. The default value is the system language. + * @returns { string } If language is not passed, the application checks for dialects supported by the system based + * on the system language and locale. If such a dialect is found, the simplified representation + * of the dialect is returned. Otherwise, the simplified representation of the system language + * is returned. If language is passed, the simplified representation of the specified language + * is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'15','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getSimplifiedLanguage(language?: string): string; + + /** + * Sets the temperature unit of the system. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { TemperatureType } type - Temperature unit. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + static setTemperatureType(type: TemperatureType): void; + + /** + * Obtains the temperature unit of the system. + * + * @returns { TemperatureType } Temperature unit. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getTemperatureType(): TemperatureType; + + /** + * Obtains the name of a temperature unit. + * + * @param { TemperatureType } type - Temperature unit. + * @returns { string } Name of the temperature unit, which can be "celsius", "fahrenheit", and "kelvin". + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getTemperatureName(type: TemperatureType): string; + + /** + * Sets the first day of a week. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { WeekDay } type - Start day of a week. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + static setFirstDayOfWeek(type: WeekDay): void; + + /** + * Obtains the first day of a week in the system settings. + * + * @returns { WeekDay } Start day of a week. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getFirstDayOfWeek(): WeekDay; + + /** + * Gets collations supported by system locale. + * + * @returns { Map } The map will containing the collation's identifier and name. + * If the map is empty of the collation for given locale does not need to be set. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getSystemCollations(): Map; + + /** + * Gets collation currently used by system locale. + * + * @returns { string } The identifier of the collation model used by system locale will be return. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getUsingCollation(): string; + + /** + * Sets the system collation mode. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } identifier - Identifier of the collation mode. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static setSystemCollation(identifier: string): void; + + /** + * Gets measurements supported by system locale. + * + * @returns { Map } a map will containing identifier and name of measurements supported by system locale. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getSystemMeasurements(): Map; + + /** + * Gets measurement currently used by system locale. + * + * @returns { string } The identifier of measurement system using by system locale + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getUsingMeasurement(): string; + + /** + * Sets the measurement system used by the system locale. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } identifier - Identifier of the measurement system. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static setSystemMeasurement(identifier: string): void; + + /** + * Gets numbering system currently used by system locale. + * + * @returns { string } the numbering systems's identifier. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getUsingNumberingSystem(): string; + + /** + * Sets the numbering system used by the system locale. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } identifier - Identifier of the numbering system. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static setSystemNumberingSystem(identifier: string): void; + + /** + * Gets numbering systems supported by system locale. + * + * @returns { Map } a map will containing the numbering system 's identifier and sample. + * If the map is empty, there is no local digit for given locale. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getSystemNumberingSystems(): Map; + + /** + * Gets commonly used number patterns for system locale. + * + * @returns { Map } a map containing the used number patterns and example of system locale. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getSystemNumberPatterns(): Map; + + /** + * Sets the number pattern used by the system locale. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } pattern - Identifier of the number pattern. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static setSystemNumberPattern(pattern: string): void; + + + /** + * Gets number pattern used by system locale. + * + * @returns { string } The number pattern identifier used by system locale + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getUsingNumberPattern(): string; + + /** + * Gets numerical date patterns and examples supported by system locale. + * + * @returns { Map } a map containing the date patterns and examples + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getSystemNumericalDatePatterns(): Map; + + /** + * Sets the numerical date pattern used by the system locale. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } identifier - Identifier of the numerical date pattern. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static setSystemNumericalDatePattern(identifier : string): void; + + /** + * Gets numerical date pattern currently used by system locale. + * + * @returns { string } The numerical date pattern used by system locale + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getUsingNumericalDatePattern(): string; + + /** + * Gets temperatures used by system locale. + * + * @returns { Map } a map containing the type and name of temperatures + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Global.I18n + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + static getSystemTemperatures(): Map; + } + + /** + * Enumerates the first day of a week. The value ranges from Monday to Sunday. + * + * @enum { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + export enum WeekDay { + /** + * Monday. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + MON = 1, + + /** + * Tuesday. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + TUE = 2, + + /** + * Wednesday. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + WED = 3, + + /** + * Thursday. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + THU = 4, + + /** + * Friday. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + FRI = 5, + + /** + * Saturday. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + SAT = 6, + + /** + * Sunday. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + SUN = 7 + } + + /** + * Enumerates temperature units. + * + * @enum { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + export enum TemperatureType { + /** + * Celesius. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + CELSIUS = 1, + + /** + * Fahrenheit. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + FAHRENHEIT = 2, + + /** + * Kelvin. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + KELVIN = 3 + } + + /** + * Provides util functions. + * + * @interface Util + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.I18NUtil + * @arkts 1.1&1.2 + */ + export interface Util { + /** + * Converts one measurement unit into another and formats the unit based on the specified locale and style. + * + * @param { UnitInfo } fromUnit - Measurement unit to be converted. + * @param { UnitInfo } toUnit - Measurement unit to be converted to. + * @param { number } value - Value of the measurement unit to be converted. + * @param { string } locale - Locale ID used for formatting, for example, "zh-Hans-CN". + * @param { string } [style] - Style used for formatting. The value can be "long", "short", or "narrow". The + * default value is short. + * @returns { string } String obtained after formatting based on the measurement unit specified by toUnit. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.I18NUtil#unitConvert + * @arkts 1.1&1.2 + */ + unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string; + } + + /** + * Provides util functions. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides util functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides util functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class I18NUtil { + /** + * Convert from unit to unit and format according to the locale. + * + * @param { UnitInfo } fromUnit - Information of the unit to be converted. + * @param { UnitInfo } toUnit - Information about the unit to be converted to. + * @param { number } value - Indicates the number to be formatted. + * @param { string } locale - The locale to be used. + * @param { string } [style] - The style of format. + * @returns { string } converted number and unit. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Converts one measurement unit into another and formats the unit based on the specified locale and style. + * + * @param { UnitInfo } fromUnit - Measurement unit to be converted. + * @param { UnitInfo } toUnit - Measurement unit to be converted to. + * @param { number } value - Value of the measurement unit to be converted. + * @param { string } locale - Locale ID, which consists of the language, script, and country/region, for example, + * "zh-Hans-CN". + * @param { string } [style] - Style used for formatting. The value can be long, short, or narrow. The default + * value is short. For details about the meaning or display effect of different values, + * see Number and Unit of Measurement Formatting. + * @returns { string } String converted to the measurement unit after formatting. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string; + + /** + * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. + * 'y' stands for year, 'L' stands for month, d stands for day. + * + * @param { string } locale - Information of the locale + * @returns { string } the string of 'y', 'L', 'd' joined by '-'. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. + * 'y' stands for year, 'L' stands for month, d stands for day. + * + * @param { string } locale - Information of the locale. + * @returns { string } the string of 'y', 'L', 'd' joined by '-'. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the sequence of the year, month, and day in the specified locale. + * + * @param { string } locale - Locale ID, which consists of the language, script, and country/region, for example, + * "zh-Hans-CN". + * @returns { string } Sequence of the year, month, and day in the locale. "y" indicates the year, "L" indicates + * the month, and "d" indicates the day. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getDateOrder(locale: string): string; + + /** + * Get the time period name for the specified hour. + * + * @param { number } hour - the hour value. + * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. + * @returns { string } the string of time period name. The return value may be empty string + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Obtains the localized expression of the specified time in the specified locale. + * + * @param { number } hour - Specified time, for example, 16. + * @param { string } [locale] - System locale, which consists of the language, script, and country/region. for + * example, "zh-Hans-CN". The default value is the current system locale. + * @returns { string } Localized expression of the specified time in the specified locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getTimePeriodName(hour:number, locale?: string): string; + + /** + * Obtains the locale that best matches a region from the specified locale list. + * + * @param { string } locale - Locale ID, for example, "zh-Hans-CN". + * @param { string[] } localeList - List of locale IDs. + * @returns { string } ID of the locale that best matches a region. If no matching locale is found, an empty string + * is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getBestMatchLocale(locale: string, localeList: string[]): string; + + /** + * Converts a language code from two letters to three letters. For example, the two-letter language code of Chinese + * is "zh", and the corresponding three-letter language code is "zho". For details, see + * [ISO 639](https://www.iso.org/iso-639-language-code). + * + * @param { string } locale - Two-letter code of the language to be converted, for example, "zh". + * @returns { string } Language code after conversion. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getThreeLetterLanguage(locale: string): string; + + /** + * Converts a region code from two letters to three letters. For example, the two-letter region code of China is + * "CN", and the corresponding three-letter region code is "CHN". For details, see + * [ISO 3166](https://www.iso.org/iso-3166-country-codes.html). + * + * @param { string } locale - Two-letter country/region code to be converted, for example, "CN". + * @returns { string } Region code after conversion. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getThreeLetterRegion(locale: string): string; + + /** + * Localizes a file path for the specified locale. For example, /data/out/tmp is changed to tmp/out/data/ after + * localization. + * + * @param { string } path - Path to mirror, for example, "/data/out/tmp". + * @param [ string ] delimiter - Path delimiter. The default value is "/"". + * @param [ intl.Locale ] locale - Locale object. The default value is the current system locale. + * @returns { string } File path after localization. If the specified locale object corresponds to an RTL language, + * the processed file path contains a direction control character to ensure that the file path + * is displayed in mirror mode. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ + static getUnicodeWrappedFilePath(path: string, delimiter?: string, locale?: intl.Locale): string; + + /** + * Get the localized file path. + * Return the mirrored file path if the locale is RTL. Otherwise return the input file path. + * The default value of locale is current system locale. + * + * @param { string } path - the file path that needs to be localized. + * @param { string } [delimiter] - the file path's delimiter. + * @param { Intl.Locale } [locale] - the locale object used to localized file path. + * @returns { string } the localized file path. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + static getUnicodeWrappedFilePath(path: string, delimiter?: string, locale?: Intl.Locale): string; + } + + /** + * Provides the options of unit. + * + * @interface UnitInfo + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Defines the measurement unit information. + * + * @interface UnitInfo + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface UnitInfo { + /** + * Unit name. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Name of the measurement unit, for example, "meter", "inch", or "cup". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + unit: string; + + /** + * The measurement system of the unit. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Measurement system. The value can be "SI", "US", or "UK". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + measureSystem: string; + } + + /** + * Provides the options of PhoneNumberFormat. + * + * @interface PhoneNumberFormatOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the options of PhoneNumberFormat. + * + * @interface PhoneNumberFormatOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Options for PhoneNumberFormat object initialization. + * + * @interface PhoneNumberFormatOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface PhoneNumberFormatOptions { + /** + * Indicates the type to format phone number. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Indicates the type to format phone number. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the type to format phone number. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Type of the phone number. The value can be "E164", "INTERNATIONAL", "NATIONAL", "RFC3966", or "TYPING". + * In API version 8, type is mandatory. In API version 9 or later, type is optional. + * In API version 12 or later, "TYPING" is supported, which indicates that the dialed number is formatted in real + * time. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + type?: string; + } + + /** + * Provides the API for formatting phone number strings + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the API for formatting phone number strings + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Provides the API for formatting phone number strings + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class PhoneNumberFormat { + /** + * A constructor used to create a PhoneNumberFormat object. + * + * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. + * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a PhoneNumberFormat object. + * + * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. + * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Creates a PhoneNumberFormat object. + * + * @param { string } country - Country/region to which the phone number to be formatted belongs. + * @param { PhoneNumberFormatOptions } [options] - Options for PhoneNumberFormat object initialization. + * The default value is "NATIONAL". + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + constructor(country: string, options?: PhoneNumberFormatOptions); + + /** + * Judge whether phone number is valid. + * + * @param { string } number - Indicates the input phone number. + * @returns { boolean } a boolean indicates whether the input phone number is valid. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Judge whether phone number is valid. + * + * @param { string } number - Indicates the input phone number. + * @returns { boolean } a boolean indicates whether the input phone number is valid. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Checks whether the phone number is valid for the country/region in the PhoneNumberFormat object. + * + * @param { string } number - Phone number to be checked. + * @returns { boolean } Whether the phone number is valid. The value "true" indicates that the phone number is + * valid, and the value "false" indicates the opposite. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + isValidNumber(number: string): boolean; + + /** + * Obtains the formatted phone number strings of number. + * + * @param { string } number - Indicates the input phone number to be formatted. + * @returns { string } the formatted phone number. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the formatted phone number strings of number. + * + * @param { string } number - Indicates the input phone number to be formatted. + * @returns { string } the formatted phone number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Formats a phone number. + * + * @param { string } number - Phone number to be formatted. + * @returns { string } Formatted phone number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + format(number: string): string; + + /** + * Determine the location by phone number, and return it according to the specified regional language. + * + * @param { string } number - input phone number. + * @param { string } locale - locale ID. + * @returns { string } a string represents phone number's location. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the home location of a phone number. + * + * @param { string } number - Phone number. To obtain the home location of a number in other countries/regions, + * you need to prefix the number with 00 and the country code. + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @returns { string } Home location of the phone number. If the number is invalid, an empty string is returned. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getLocationName(number: string, locale: string): string; + } + + /** + * Get a Calendar instance specified by locale and type. + * + * @param { string } locale - The locale used to get calendar. + * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. + * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, + * japanese, persian. + * @returns { Calendar } Calendar object + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get a Calendar instance specified by locale and type. + * + * @param { string } locale - The locale used to get calendar. + * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. + * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, + * japanese, persian. + * @returns { Calendar } Calendar object + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the Calendar object for the specified locale and calendar type. + * + * @param { string } locale - Locale ID, which consists of the language, script, and country/region, + * for example, zh-Hans-CN. + * @param { string } [type] - Calendar. The value can be: "buddhist", "chinese", "coptic", "ethiopic", + * "hebrew", "gregory", "indian", "islamic_civil", "islamic_tbla", + * "islamic_umalqura", "japanese", or "persian". The default value is the default + * calendar of the locale. For details about the meanings and application scenarios of + * different values, see Calendar Setting. + * @returns { Calendar } Calendar object + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export function getCalendar(locale: string, type?: string): Calendar; + + /** + * Provides the API for accessing Calendar name, time and date related information. + * + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Provides the API for accessing Calendar name, time and date related information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for accessing Calendar name, time and date related information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class Calendar { + /** + * set the date. + * + * @param { Date } date - Date object used to set the time and date. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * set the date. + * + * @param { Date } date - Date object used to set the time and date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Sets the date and time for a Calendar object. + * + * @param { Date } date - Date and time. Note: The month starts from 0. For example, 0 indicates January. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + setTime(date: Date): void; + + /** + * set the time. + * + * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * set the time. + * + * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Sets the date and time for a Calendar object. + * + * @param { number } time - Unix timestamp, which indicates the number of milliseconds that have elapsed since the + * Unix epoch. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + setTime(time: number): void; + + /** + * Set the time + * + * @param { number } year - The year field of the calendar, ranges from 0 to 9999. + * @param { number } month - The month field of the calendar, ranges from 0 to 11. + * @param { number } date - The day field of the calendar, ranges from 1 to 31. + * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. + * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. + * @param { number } second - the second field of the calendar, ranges from 0 to 59. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the time + * + * @param { number } year - The year field of the calendar, ranges from 0 to 9999. + * @param { number } month - The month field of the calendar, ranges from 0 to 11. + * @param { number } date - The day field of the calendar, ranges from 1 to 31. + * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. + * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. + * @param { number } second - the second field of the calendar, ranges from 0 to 59. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Sets the year, month, day, hour, minute, and second for this Calendar object. + * + * @param { number } year - Year to set. + * @param { number } month - Month to set. Note: The month starts from 0. For example, 0 indicates January. + * @param { number } date - Day to set. + * @param { number } hour - Hour to set. The default value is the current system time. + * @param { number } minute - Minute to set. The default value is the current system time. + * @param { number } second - Second to set. The default value is the current system time. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + set(year: number, month: number, date:number, hour?: number, minute?: number, second?: number): void; + + /** + * Set the timezone of this calendar. + * + * @param { string } timezone - The id of a timezone. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the timezone of this calendar. + * + * @param { string } timezone - The id of a timezone. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Sets the time zone of this Calendar object. + * + * @param { string } timezone - Valid time zone ID, for example, Asia/Shanghai. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + setTimeZone(timezone: string): void; + + /** + * Get the timezone id of this calendar instance. + * + * @returns { string } the timezone id of this calendar. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the timezone id of this calendar instance. + * + * @returns { string } the timezone id of this calendar. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the time zone ID of this Calendar object. + * + * @returns { string } Time zone ID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getTimeZone(): string; + + /** + * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @returns { number } start day of a week. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @returns { number } start day of a week. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the first day of a week for this Calendar object. + * + * @returns { number } First day of a week. The value 1 indicates Sunday, and the value 7 indicates Saturday. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getFirstDayOfWeek(): number; + + /** + * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Sets the first day of a week for this Calendar object. + * + * @param { number } value - Start day of a week. The value 1 indicates Sunday, and the value 7 indicates Saturday. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + setFirstDayOfWeek(value: number): void; + + /** + * Get the minimal days of a week, which is needed for the first day of a year. + * + * @returns { number } the minimal days of a week. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the minimal days of a week, which is needed for the first day of a year. + * + * @returns { number } the minimal days of a week. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the minimum number of days in the first week for this Calendar object. + * + * @returns { number } Minimum number of days in the first week of a year. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getMinimalDaysInFirstWeek(): number; + + /** + * Set the minimal days of a week, which is needed for the first week of a year. + * + * @param { number } value - The value to be set. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the minimal days of a week, which is needed for the first week of a year. + * + * @param { number } value - The value to be set. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Sets the minimum number of days in the first week for this Calendar object. + * + * @param { number } value - Minimum number of days in the first week of a year. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + setMinimalDaysInFirstWeek(value: number): void; + + /** + * Get the associated value with the field. + * + * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, + * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. + * @returns { number } the associated value. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the associated value with the field. + * + * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, + * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. + * @returns { number } the associated value. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the values of the calendar attributes in this Calendar object. + * + * @param { string } field - Calendar attributes. The following table lists the supported attribute values. + * @returns { number } Value of the calendar attribute. For example, if the year of the internal date of the + * current Calendar object is 1990, get('year') returns 1990. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + get(field: string): number; + + /** + * Get calendar's name localized for display in the given locale. + * + * @param { string } locale - Locale used to get the localized name for this calendar. It must be a valid locale. + * @returns { string } the localized name of this calendar. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains calendar display name in the specified language. + * + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @returns { string } Calendar display name in the specified language. For example, buddhist is displayed as + * Buddhist Calendar if the locale is en-US. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getDisplayName(locale: string): string; \ No newline at end of file diff --git a/api/intl_2.d.ts b/api/intl_2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..89cbcb84c7f28400acff5db315b3f19405ba78d0 --- /dev/null +++ b/api/intl_2.d.ts @@ -0,0 +1,2027 @@ +/** + * Returns true if the given date is a weekend day. If the date is not given, + * the date object of this calendar is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a weekend day. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns true if the given date is a weekend day. If the date is not given, + * the date object of this calendar is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a weekend day. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether a given date is a weekend in this Calendar object. + * + * @param { Date } [date] - Date and time. Note: The month starts from 0. For example, 0 indicates January. + * The default value is current date of the Calendar object. + * @returns { boolean } The value "true" indicates that the specified date is a weekend, and the value "false" + * indicates the opposite. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + isWeekend(date?: Date): boolean; + + /** + * Adds or subtract the specified amount of time to the given calendar field. + * + * @param { string } field - field values such as year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond + * @param { number } amount - the amount of date or time to be added to the field. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Performs addition or subtraction on the calendar attributes of this Calendar object. + * + * @param { string } field - Calendar attribute. The value can be any of the following: year, month, week_of_year, + * week_of_month, date, day_of_year, day_of_week, day_of_week_in_month, hour, + * hour_of_day, minute, second, millisecond. For details about the values, see get. + * @param { number } amount - Addition or subtraction amount. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + add(field: string, amount: number): void; + + /** + * Get the UTC milliseconds. + * + * @returns { number } the calendar time as UTC milliseconds. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Obtains the timestamp of this Calendar object. + * + * @returns { number } Unix timestamp, which indicates the number of milliseconds that have elapsed since the + * Unix epoch. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getTimeInMillis(): number; + + /** + * Returns days comparison result. + * + * @param { Date } date - Date object to be compared. + * @returns { number } value of of the comparison result. A positive value indicates that the date is later, + * and a negative value indicates that the date is earlier. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Compares the current date of this Calendar object with the specified date for the difference in the number of + * days. + * + * @param { Date } date - Date and time. Note: The month starts from 0. For example, 0 indicates January. + * @returns { number } Difference in the number of days. A positive number indicates that the calendar date is + * earlier, and a negative number indicates the opposite. The value is accurate to + * milliseconds. If the value is less than one day, it is considered as one day. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + compareDays(date: Date): number; + } + + /** + * Judge whether the locale is RTL locale. + * + * @param { string } locale - The locale to be used. + * @returns { boolean } true representing the locale is an RTL locale + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Judge whether the locale is RTL locale. + * + * @param { string } locale - The locale to be used. + * @returns { boolean } true representing the locale is an RTL locale + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is of the right to left (RTL) language. + * + * @param { string } locale - Input character. If the input is a string, only the type of the first character is checked. + * @returns { boolean } true if the input character is of the RTL language, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export function isRTL(locale: string): boolean; + + /** + * Obtains a BreakIterator object for finding the location of break point in text. + * + * @param { string } locale - the returned BreakIterator will adapt the rule, specified by the locale, to break text. + * @returns { BreakIterator } a newly constructed BreakIterator object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains a BreakIterator object. The BreakIterator object maintains an internal break iterator that can be used to + * access various line break points. + * + * @param { string } locale - System locale, which consists of the language, script, and country/region. The + * generated BreakIterator object calculates the positions of line breaks based on + * the rules of the specified locale. + * @returns { BreakIterator } BreakIterator object. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export function getLineInstance(locale: string): BreakIterator; + + /** + * The BreakIterator class is used for finding the location of break point in text. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The BreakIterator class is used for finding the location of break point in text. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class BreakIterator { + /** + * Obtains the current position of the BreakIterator instance. + * + * @returns { number } the current position of the BreakIterator instance. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the position of the break iterator in the text. + * + * @returns { number } Position of the break iterator in the text. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + current(): number; + + /** + * Set the BreakIterator's position to the first break point, the first break point is always the beginning of the + * processed text. + * + * @returns { number } the index of the first break point. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Moves the break iterator to the first line break point, which is always at the beginning of the processed text. + * + * @returns { number } Offset of the first line break point in the processed text. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + first(): number; + + /** + * Set the BreakIterator's position to the last break point. the last break point is always the index beyond the + * last character of the processed text. + * + * @returns { number } the index of the last break point. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Moves the break iterator to the last line break point, which is always the next position after the end of the + * processed text. + * + * @returns { number } Offset of the last line break point in the processed text. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + last(): number; + + /** + * Set the BreakIterator's position to the nth break point from the current break point. + * + * @param { number } [index] - indicates the number of break points to advance. If index is not given, n is treated as 1. + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Moves the break iterator backward by the specified number of line break points. + * + * @param { number } [index] - Number of line break points for moving the break iterator. The value is an integer. + * A positive number means to move the break iterator backward, and a negative number + * means to move the break iterator forward. The default value is 1. + * @returns { number } Position of the break iterator in the text after movement. The value -1 is returned if the + * position of the break iterator is outside of the processed text after movement. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + next(index?: number): number; + + /** + * Set the BreakIterator's position to the break point preceding the current break point. + * + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Moves the break iterator foreward by one line break point. + * + * @returns { number } Position of the break iterator in the text after movement. The value -1 is returned if the + * position of the break iterator is outside of the processed text after movement. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + previous(): number; + + /** + * Set the text to be processed. + * + * @param { string } text - Indicates the text to be processed by the BreakIterator. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Sets the text to be processed by the BreakIterator object. + * + * @param { string } text - Input text. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + setLineBreakText(text: string): void; + + /** + * Set the BreakIterator's position to the first break point following the specified offset. + * + * @param { number } offset + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Moves the line break iterator to the line break point after the specified position. + * + * @param { number } offset - Offset of the line break point. + * @returns { number } Position of the break iterator in the text after movement. The value -1 is returned if the + * position of the break iterator is outside of the processed text after movement. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + following(offset: number): number; + + /** + * Obtains the text being processed. + * + * @returns { string } the text that is processed by the BreakIterator. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the text processed by the BreakIterator object. + * + * @returns { string } Text being processed by the BreakIterator object. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getLineBreakText(): string; + + /** + * Returns true if the position indicated by the offset is a break point, otherwise false. The BreakIterator's + * position will be set to the position indicated by the offset if it returns true, otherwise the BreakIterator + * will be moved to the break point following the offset. + * + * @param { number } offset The offset to be checked. + * @returns { boolean } true if the offset is a break point. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Checks whether the specified position is a line break point. + * + * @param { number } offset - Specified position in the text. + * @returns { boolean } Whether the specified position is a line break point. The value "true" indicates that the + * specified position is a line break point, and the value "false" indicates the opposite. + * If true is returned, the break iterator is moved to the position specified by offset. + * Otherwise, the break iterator is moved to the text line break point after the position + * specified by offset, which is equivalent to calling following. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + isBoundary(offset: number): boolean; + } + + /** + * Get IndexUtil object. + * + * @param { string } [locale] - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @returns { IndexUtil } IndexUtil object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Creates an IndexUtil object. + * + * @param { string } [locale] - System locale, which consists of the language, script, and country/region. + * The default value is the current system locale. + * @returns { IndexUtil } IndexUtil object created based on the specified locale ID. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export function getInstance(locale?:string): IndexUtil; + + /** + * Sequence text can be grouped under the specified area, + * and grouping index with different lengths can be specified. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Sequence text can be grouped under the specified area, + * and grouping index with different lengths can be specified. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class IndexUtil { + /** + * Get a list of labels for use as a UI index + * + * @returns { Array } a list of labels + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the index list of the current locale. + * + * @returns { Array } Index list of the current locale. The first and last elements are "...". + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getIndexList(): Array; + + /** + * Add the index characters from a Locale to the index. + * + * @param { string } locale - The locale whose index characters are to be added. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Adds the index list of a new locale to the index list of the current locale to form a composite list. + * + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + addLocale(locale: string): void; + + /** + * Get corresponding index of the input text. + * + * @param { string } text - input text + * @returns { string } index of the input text + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the index of the text object. + * + * @param { string } text - text object. + * @returns { string } Index of the text object. If no proper index is found, an empty string is returned. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getIndex(text: string): string; + } + + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode + * @arkts 1.1&1.2 + */ + export class Character { + /** + * Checks whether the input character is a digit. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is a digit, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isDigit + * @arkts 1.1&1.2 + */ + isDigit(ch: string): boolean; + + /** + * Checks whether the input character is a space. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is a space, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isSpaceChar + * @arkts 1.1&1.2 + */ + isSpaceChar(ch: string): boolean; + + /** + * Checks whether the input character is a whitespace. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is a white space, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isWhitespace + * @arkts 1.1&1.2 + */ + isWhitespace(ch: string): boolean; + + /** + * Checks whether the input character is of the right to left (RTL) language. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is of the RTL language, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isRTL + * @arkts 1.1&1.2 + */ + isRTL(ch: string): boolean; + + /** + * Checks whether the input character is an ideographic character. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character an ideographic character, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isIdeograph + * @arkts 1.1&1.2 + */ + isIdeograph(ch: string): boolean; + + /** + * Checks whether the input character is a letter. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character a letter, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isLetter + * @arkts 1.1&1.2 + */ + isLetter(ch: string): boolean; + + /** + * Checks whether the input character is a lowercase letter. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character a lowercase letter, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isLowerCase + * @arkts 1.1&1.2 + */ + isLowerCase(ch: string): boolean; + + /** + * Checks whether the input character is an uppercase letter. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character an uppercase letter, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.isUpperCase + * @arkts 1.1&1.2 + */ + isUpperCase(ch: string): boolean; + + /** + * Obtains the type of the input character. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { string } Type of the input character. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead Unicode.getType + * @arkts 1.1&1.2 + */ + getType(ch: string): string; + } + + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class Unicode { + /** + * Determines whether the specified code point is a digit character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a digit character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines whether the specified code point is a digit character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a digit character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is a digit. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is a digit, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isDigit(ch: string): boolean; + + /** + * Determines if the specified character is a space character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a space character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a space character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a space character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is a space. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is a space, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isSpaceChar(ch: string): boolean; + + /** + * Determines if the specified character is a whitespace character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a whitespace character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a whitespace character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a whitespace character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is a whitespace. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is a white space, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isWhitespace(ch: string): boolean; + + /** + * Determines if the specified character is a RTL character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a RTL character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a RTL character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a RTL character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is of the right to left (RTL) language. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character is of the RTL language, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isRTL(ch: string): boolean; + + /** + * Determines if the specified character is a Ideographic character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Ideographic character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a Ideographic character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Ideographic character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is an ideographic character. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character an ideographic character, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isIdeograph(ch: string): boolean; + + /** + * Determines if the specified character is a Letter or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Letter + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a Letter or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Letter + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is a letter. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character a letter, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isLetter(ch: string): boolean; + + /** + * Determines if the specified character is a LowerCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a LowerCase character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a LowerCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a LowerCase character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is a lowercase letter. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character a lowercase letter, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isLowerCase(ch: string): boolean; + + /** + * Determines if the specified character is a UpperCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a UpperCase character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a UpperCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a UpperCase character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Checks whether the input character is an uppercase letter. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { boolean } true if the input character an uppercase letter, and false otherwise. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static isUpperCase(ch: string): boolean; + + /** + * Get the general category value of the specified character. + * + * @param { string } char - the character to be tested + * @returns { string } the general category of the specified character. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get the general category value of the specified character. + * + * @param { string } char - the character to be tested + * @returns { string } the general category of the specified character. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the type of the input character. + * + * @param { string } ch - Input character. If the input is a string, only the type of the first character is + * checked. + * @returns { string } Type of the input character. + * @static + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getType(ch: string): string; + } + + /** + * Checks whether the 24-hour clock is used. + * + * @returns { boolean } true if the 24-hour clock is used, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'7','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#is24HourClock + * @arkts 1.1&1.2 + */ + export function is24HourClock(): boolean; + + /** + * Sets the 24-hour clock. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { boolean } option - Whether to enable the 24-hour clock. The value "true" means to enable the 24-hour + * clock, and the value "false" means the opposite. + * @returns { boolean } true if the setting is successful, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'7','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#set24HourClock + * @arkts 1.1&1.2 + */ + export function set24HourClock(option: boolean): boolean; + + /** + * Adds a preferred language to the specified position on the preferred language list. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } language - Preferred language to add. + * @param { number } [index] - Position to which the preferred language is added. The default value is the length of + * the preferred language list. + * @returns { boolean } true if the operation is successful, and false otherwise. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#addPreferredLanguage + * @arkts 1.1&1.2 + */ + export function addPreferredLanguage(language: string, index?: number): boolean; + + /** + * Removes a preferred language from the specified position on the preferred language list. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { number } index - Position of the preferred language to delete. + * @returns { boolean } Whether the operation is successful. The value "true" indicates that the operation is + * successful, and the value "false" indicates the opposite. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#removePreferredLanguage + * @arkts 1.1&1.2 + */ + export function removePreferredLanguage(index: number): boolean; + + /** + * Obtains the list of preferred languages. + * + * @returns { Array } List of preferred languages. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#getPreferredLanguageList + * @arkts 1.1&1.2 + */ + export function getPreferredLanguageList(): Array; + + /** + * Obtains the first language in the preferred language list. + * + * @returns { string } First language in the preferred language list. + * @syscap SystemCapability.Global.I18n + * @since arkts {'1.1':'8','1.2':'20'} + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#getFirstPreferredLanguage + * @arkts 1.1&1.2 + */ + export function getFirstPreferredLanguage(): string; + + /** + * Get the default TimeZone object or the TimeZone object corresponds to zoneID. + * + * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. + * @returns { TimeZone } a TimeZone object corresponds to zoneID. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the default TimeZone object or the TimeZone object corresponds to zoneID. + * + * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. + * @returns { TimeZone } a TimeZone object corresponds to zoneID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the TimeZone object corresponding to the specified time zone ID. + * + * @param { string } [zoneID] - Time zone ID. The default value is the system time zone. + * @returns { TimeZone } TimeZone object corresponding to the time zone ID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export function getTimeZone(zoneID?: string): TimeZone; + + /** + * Provides the API for accessing TimeZone name, rawOffset and offset information. + * + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Provides the API for accessing TimeZone name, rawOffset and offset information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for accessing TimeZone name, rawOffset and offset information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class TimeZone { + /** + * Get the id of the TimeZone object. + * + * @returns { string } a string represents the timezone id. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the id of the TimeZone object. + * + * @returns { string } a string represents the timezone id. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the ID of the specified TimeZone object. + * + * @returns { string } Time zone ID corresponding to the TimeZone object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getID(): string; + + /** + * Get the displayName of the TimeZone Object under the locale. + * + * @param { string } [locale] - the locale tag use to display timezone object's name. + * @param { boolean } [isDST] - wether consider daylight saving time when display timezone object's name. + * @returns { string } a string represents the display name. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Obtains time zone display name in the specified language. + * + * @param { string } [locale] - System locale, which consists of the language, script, and country/region. + * The default value is the current system locale. + * @param { boolean } [isDST] - Whether DST information is displayed. The value "true" indicates that DST + * information is displayed, and the value "false" indicates the opposite. + * The default value is false. + * @returns { string } Time zone display name in the specified language. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getDisplayName(locale?: string, isDST?: boolean): string; + + /** + * Get the raw offset of the TimeZone object. + * + * @returns { number } a number represents the raw offset. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the raw offset of the TimeZone object. + * + * @returns { number } a number represents the raw offset. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the raw offset of the specified time zone. + * + * @returns { number } Raw offset of the time zone, in milliseconds. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getRawOffset(): number; + + /** + * Get the offset of the TimeZone object. + * + * @param { number } [date] - Indicates a date use to compute offset. + * @returns { number } a number represents the offset with date. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the offset of the TimeZone object. + * + * @param { number } [date] - Indicates a date use to compute offset. + * @returns { number } a number represents the offset with date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the offset of the specified time zone at the specified time. + * + * @param { number } [date] - Specified time, in milliseconds. The default value is the system time. + * @returns { number } Time zone offset, in milliseconds. When the DST is used, the time zone offset + * is the raw time zone offset plus the DST offset. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getOffset(date?: number): number; + + /** + * Get available TimeZone ID list. + * + * @returns { Array } a string array represents the available TimeZone ID list. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get available TimeZone ID list. + * + * @returns { Array } a string array represents the available TimeZone ID list. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the list of time zone IDs supported by the system. + * + * @returns { Array } List of time zone IDs supported by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getAvailableIDs(): Array; + + /** + * Get available Zone City ID list. + * + * @returns { Array } a string array represents the available Zone City ID list. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the list of time zone city IDs supported by the system. + * + * @returns { Array } List of time zone city IDs supported by the system. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getAvailableZoneCityIDs(): Array; + + /** + * Get City display name in a certain locale. + * + * @param { string } cityID - Zone City ID. + * @param { string } locale - locale used to display city name. + * @returns { string } a string represents the display name of City in locale. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains time zone city display name in the specified language. + * + * @param { string } cityID - Time zone city ID. + * @param { string } locale - System locale, which consists of the language, script, and country/region. + * @returns { string } Time zone city display name in the specified language. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getCityDisplayName(cityID: string, locale: string): string; + + /** + * Get TimeZone Object from city ID. + * + * @param { string } cityID - Zone City ID. + * @returns { TimeZone } a TimeZone Object from city ID. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Creates a TimeZone object corresponding to the specified time zone city. + * + * @param { string } cityID - Time zone city ID. The value must be a time zone city ID supported by the system. + * @returns { TimeZone } TimeZone object corresponding to the specified time zone city ID. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getTimezoneFromCity(cityID: string): TimeZone; + + /** + * Get the possible time zones from the specified longitude and latitude. + * + * @param { number } longitude value + * @param { number } latitude value + * @returns { Array } Returns a TimeZone array from the specified longitude and latitude. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Creates an array of TimeZone objects corresponding to the specified location. + * + * @param { number } longitude - Longitude. The value range is [-180, 179.9). A positive value is used for east + * longitude and a negative value is used for west longitude. + * @param { number } latitude - Latitude. The value range is [-90, 89.9). A positive value is used for north + * latitude and a negative value is used for south latitude. + * @returns { Array } TimeZone objects corresponding to the specified location. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getTimezonesByLocation(longitude: number, latitude: number): Array; + + /** + * Get the zone rules object corresponds to the timezone objects. + * + * @returns { ZoneRules } Returns a ZoneRuels object which defines timezone offset changing rule. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + public getZoneRules(): ZoneRules; + } + + /** + * Provides the API for obtaining timezone offset changing rules information. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + export class ZoneRules { + /** + * Get the next timezone offset transition after date. + * + * @param { number } [ date ] - Indicates milliseconds. + * @returns { ZoneOffsetTransition } Returns a timezone offset transition after date. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + public nextTransition(date?: number): ZoneOffsetTransition; + } + + /** + * Provides the API for obtaining a timezone transition information. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + export class ZoneOffsetTransition { + /** + * Obtains the timestamp of the change in the time zone offset. + * + * @returns { number } Timestamp of the change in the time zone offset. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + public getMilliseconds(): number; + + /** + * Get the offset after time zone offset trasition. + * + * @returns { number } Returns the offset after time zone offset trasition. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + public getOffsetAfter(): number; + + /** + * Get the offset before time zone offset trasition. + * + * @returns { number } Returns the offset before time zone offset trasition. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + public getOffsetBefore(): number; + } + + /** + * Provides the API for transliterate text from one format to another. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides the API for transliterate text from one format to another. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class Transliterator { + /** + * Get a string array of all available transliterator ids. + * + * @returns { string[] } a string array of all available transliterator ids. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains a list of IDs supported by the Transliterator object. + * + * @returns { string[] } List of IDs supported by the Transliterator object. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getAvailableIDs(): string[]; + + /** + * Get a Transliterator that is specified by id name. + * + * @param { string } id - specified the type of Transliterator. id is formed by source and dest. Transliterator will transliterate + * the input string from source format to the dest format. For example, a Simplified Chinese to Latn + * Transliterator will transform the text written in Chinese to Latn characters. + * @returns { Transliterator } Transliterator that is specified by id name. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Creates a Transliterator object based on the specified ID. + * + * @param { string } id - ID supported by the Transliterator object. + * @returns { Transliterator } Transliterator object. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getInstance(id: string): Transliterator; + + /** + * Transform the input text. + * + * @param { string } text - text to be transliterated. + * @returns { string } the output text that is transliterated from source format to the dest format. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Converts the input text from the source format to the target format. + * + * @param { string } text - Input text. + * @returns { string } Text after conversion. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + transform(text: string): string; + } + + /** + * Enumerates the Normalizer modes. + * + * @enum { number } + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Enumerates text normalization modes. + * + * @enum { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export enum NormalizerMode { + /** + * Normalization form C, characters are decomposed and then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form C, characters are decomposed and then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + NFC = 1, + /** + * Normalization form D, characters are decomposed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form D, characters are decomposed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + NFD = 2, + /** + * Normalization form KC, characters are decomposed by compatibility, then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form KC, characters are decomposed by compatibility, then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + NFKC = 3, + /** + * Normalization form KD, characters are decomposed by compatibility + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form KD, characters are decomposed by compatibility + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + NFKD = 4 + } + + /** + * Provides the API for text encoding normalization. + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Provides the API for text encoding normalization. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class Normalizer { + /** + * Get a Normalizer that is specified by normalize mode. + * + * @param { NormalizerMode } mode - specified the mode of Normalizer. It must be a valid mode. + * @returns { Normalizer } Transliterator that is specified by id name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Obtains a Normalizer object. + * + * @param { NormalizerMode } mode - Text normalization mode. + * @returns { Normalizer } Normalizer object for text normalization. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getInstance(mode: NormalizerMode): Normalizer; + + /** + * Get a normalized string of specified mode. + * + * @param { string } text - text to normalized. + * @returns { string } a normalized string from source. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalizes input strings. + * + * @param { string } text - Input strings. + * @returns { string } Normalized strings. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + normalize(text: string): string; + } + + /** + * Represents the language or country/region suggestion type. + * + * @enum { number } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + export enum SuggestionType { + /** + * Not a recommended language or country/region. + * + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + SUGGESTION_TYPE_NONE = 0, + /** + * Country/region recommended by the system language or language recommended by the system country/region. + * + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + SUGGESTION_TYPE_RELATED = 1, + /** + * Language recommended by the country/region of the SIM card. + * + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + SUGGESTION_TYPE_SIM = 2, + } + + /** + * Represents the language or country/region sorting option. + * + * @interface SortOptions + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface SortOptions { + /** + * Locale information, which consists of the language, script, and country/region, for example, "zh-Hans-CN". + * The default value is the current system locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + locale?: string; + + /** + * Whether to use the local name for sorting. The value "true" means to use the local name for sorting, and the + * value "false" means the opposite. If getLanguageInfoArray is called, the default value of isUseLocalName is + * true. If getRegionInfoArray is called, the default value of isUseLocalName is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + isUseLocalName?: boolean; + + /** + * Whether to move the recommended language or country/region to the top in the sorting result. The value "true" + * means to move the recommended language or country/region to the top, and the value "false" means the opposite. + * The default value is true. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + isSuggestedFirst?: boolean; + } + + /** + * Represents the locale information, which consists of the language, script, and country/region. + * + * @interface LocaleItem + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface LocaleItem { + /** + * Language code or country/region code, for example, "zh" or "CN". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + id: string; + + /** + * Language or country/region suggestion type. + * + * @type { SuggestionType } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + suggestionType: SuggestionType; + + /** + * Representation of ID in the specified locale in SystemLocaleManager. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + displayName: string; + + /** + * Local name of the ID. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + localName?: string; + } + + /** + * Represents a time zone and city combination item. + * + * @interface TimeZoneCityItem + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface TimeZoneCityItem { + /** + * Time zone ID, for example, "Asia/Shanghai". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + zoneId: string; + + /** + * City ID, for example, "Shanghai". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + cityId: string; + + /** + * City display name in the system locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + cityDisplayName: string; + + /** + * Offset of the time zone ID. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + offset: number; + + /** + * Time zone display name in the system locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + zoneDisplayName: string; + + /** + * Fixed offset of the time zone ID. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + rawOffset?: number; + } + + /** + * Provide some functions for settings and startup guide to select language or region. + * + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class SystemLocaleManager { + /** + * Creates a SystemLocaleManager object. + * + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * Obtains sorted language array for setting or startup guide app. + * + * @param { Array } languages - The languages whose name will be sorted and displayed. + * @param { SortOptions } options - Sort options for locale item. + * @returns { Array } Locale Informations sorted for specified options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since 10 + */ + /** + * Obtains the list of languages after sorting. + * + * @param { Array } languages - Valid IDs of the languages to be sorted. + * @param { SortOptions } options - Language sorting option. + * @returns { Array } Language list after sorting. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getLanguageInfoArray(languages: Array, options?: SortOptions): Array; + + /** + * Obtains sorted region array for setting or startup guide app. + * + * @param { Array } regions - The regions whose name will be sorted and displayed. + * @param { SortOptions } options - Sort options for locale item. + * @returns { Array } Locale Informations sorted for specified options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since 10 + */ + /** + * Obtains the IDs of the countries or regions after sorting. + * + * @param { Array } regions - Valid IDs of the countries or regions to be sorted. + * @param { SortOptions } options - Country/region sorting option. By default, locale is the current system + * locale, isUseLocalName is false, and isSuggestedFirst is true. + * @returns { Array } IDs of the countries or regions after sorting. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getRegionInfoArray(regions: Array, options?: SortOptions): Array; + + /** + * Obtains sorted time zone city info array for showing time zone list + * + * @returns { Array } Time zone city information sorted by city name. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since 10 + */ + /** + * Obtains list of time zone city items after sorting. + * + * @returns { Array } List of time zone city items after sorting. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + static getTimeZoneCityItemArray(): Array; + } + + /** + * Provides the informations of one holiday. + * + * @interface HolidayInfoItem + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Represents the holiday information. + * + * @interface HolidayInfoItem + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface HolidayInfoItem { + /** + * Holiday base name. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday name. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + baseName: string; + + /** + * Holiday start year. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Year of the holiday. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + year: number; + + /** + * Holiday start month. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Month of the holiday. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + month: number; + + /** + * Holiday start day. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Day of the holiday. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + day: number; + + /** + * Holiday local name array. + * + * @type { ?Array } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Local names of the holiday. + * + * @type { ?Array } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + localNames?: Array; + } + + /** + * Provides the informations holiday locale name. + * + * @interface HolidayLocalName + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Represents the name of a holiday in different languages. + * + * @interface HolidayLocalName + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface HolidayLocalName { + /** + * Holiday locale name language id. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Language, for example, "ar", "en", or "tr". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + language: string; \ No newline at end of file diff --git a/api/intl_3.d.ts b/api/intl_3.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa7783e416d93f39c55fca47670cbeec39182621 --- /dev/null +++ b/api/intl_3.d.ts @@ -0,0 +1,496 @@ +/** + * Holiday local name. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Local name of a holiday. For example, the Turkish name of Sacrifice Feast is Kurban Bayrami. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + name: string; + } + + /** + * Provide some functions to manage holidays in a country or region. Partly follows the RFC2445 standard. + * + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Provide some functions to manage holidays in a country or region. Partly follows the RFC2445 standard. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class HolidayManager { + /** + * A constructor used to create a HolidayManager object. + * + * @param { String } icsPath - the path of the iCalendar format file to create HolidayManager object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Creates a HolidayManager object for parsing holiday data. + * + * @param { String } icsPath - Path of the .ics file with the read permission granted for applications. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + constructor(icsPath: String); + + /** + * Returns true if the given date is a holiday. If the date is not given, + * the date object of current time is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a holiday day. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Determines whether the specified date is a holiday. + * + * @param { Date } [date] - Date and time. Note: The month starts from 0. For example, 0 indicates January. + * The default value is the current date. + * @returns { boolean } true if the specified date is a holiday, and false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + isHoliday(date?: Date): boolean; + + /** + * Obtains holiday info array for a specified year + * + * @param { number } [year] - specified holiday year. If the year is not given, + * the current year is used. + * @returns { Array } holiday information array for one year. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Obtains the holiday information list of the specified year. + * + * @param { number } [year] - Specified year, for example, 2023.
The default value is the current year. + * @returns { Array } Holiday information list. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + getHolidayInfoItemArray(year?: number): Array; + } + + /** + * Provides the informations of one entity. + * + * @interface EntityInfoItem + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Defines a list of entities. + * + * @interface EntityInfoItem + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface EntityInfoItem { + /** + * Entity begin position. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Start position of the entity in the input string. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + begin: number; + + /** + * Entity end position. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * End position of the entity the input string. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + end: number; + + /** + * Entity type. Field values such as phone_number, date + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Entity type. The value can be "phone_number" or "date". "phone_number" indicates that the entity is a phone + * number, and "date" indicates that the entity is a date. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + type: string; + } + + /** + * Provide some functions to find named entity in text. + * + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Provide some functions to find named entity in text. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class EntityRecognizer { + /** + * A constructor used to create a EntityRecognizer object. + * + * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Creates an entityRecognizer object. This object is used to recognize entities in the text for the specified + * locale. + * + * @param { string } [locale] - Locale ID, which consists of the language, script, and country/region, for example, + * "zh-Hans-CN". The default value is the current system locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + constructor(locale?: string); + + /** + * Obtains holiday info array for a specified text + * + * @param { string } text - the text to find entities. + * @returns { Array } entity information array found. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Obtains entity information in the text object. + * + * @param { string } text - text object. + * @returns { Array } List of entities in the text. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + findEntityInfo(text: string): Array; + } + + /** + * Obtains a SimpleDateTimeFormat object based on the specified pattern string. For details about the display + * differences between the objects obtained by this API and getSimpleDateTimeFormatBySkeleton, + * see SimpleDateTimeFormat. + * + * @param { string } pattern - Valid pattern. For details about the supported characters and their meanings, see + * [Date Field Symbol Table](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). + * This parameter also supports custom text enclosed in single quotation marks (''). + * @param { intl.Locale } [locale] - Locale object. The default value is the current system locale. + * @returns { SimpleDateTimeFormat } SimpleDateTimeFormat object. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ + export function getSimpleDateTimeFormatByPattern(pattern: string, locale?: intl.Locale): SimpleDateTimeFormat; + + /** + * Create a SimpleDateTimeFormat object by pattern and locale. + * The default value of locale is the current system locale. + * + * @param { string } pattern - the pattern used to create SimpleDateTimeFormat object. + * @param { Intl.Locale } [locale] - the Intl.Locale object used to create Intl.SimpleDateTimeFormat object. + * @returns { SimpleDateTimeFormat } a SimpleDateTimeFormat object created from pattern. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + export function getSimpleDateTimeFormatByPattern(pattern: string, locale?: Intl.Locale): SimpleDateTimeFormat; + + /** + * Obtains a SimpleDateTimeFormat object based on the specified skeleton. For details about the display differences + * between the objects obtained by this API and getSimpleDateTimeFormatByPattern, see SimpleDateTimeFormat. + * + * @param { string } skeleton - Valid skeleton. For details about the supported characters and their meanings, see + * [Date Field Symbol Table](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). + * This parameter does not support custom text. + * @param { intl.Locale } [locale] - Locale object. The default value is the current system locale. + * @returns { SimpleDateTimeFormat } SimpleDateTimeFormat object. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ + export function getSimpleDateTimeFormatBySkeleton(skeleton: string, locale?: intl.Locale): SimpleDateTimeFormat; + + /** + * Create a SimpleDateTimeFormat object by skeleton and locale. This method create a pattern by locale and skeleton, the pattern + * includes locale specific separators, and the fields'order will be adjust for that locale. + * The default value of locale is the current system locale. + * + * @param { string } skeleton - the skeleton used to create SimpleDateTimeFormat object. + * @param { Intl.Locale } [locale] - the Intl.Locale object used to create SimpleDateTimeFormat object. + * @returns { SimpleDateTimeFormat } a SimpleDateTimeFormat object created from skeleton. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + export function getSimpleDateTimeFormatBySkeleton(skeleton: string, locale?: Intl.Locale): SimpleDateTimeFormat; + + /** + * Provide a simple date time formatting interface. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class SimpleDateTimeFormat { + /** + * Formats the date and time. + * + * @param { Date } date - Date and time. Note: The month starts from 0. For example, 0 indicates January. + * @returns { string } A string containing the formatted date and time. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + format(date: Date): string; + } + + /** + * Obtains a SimpleNumberFormat object based on the specified skeleton. + * + * @param { string } skeleton - Valid skeleton. For details about the supported characters and their meanings, see + * [Number Skeletons](https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#number-skeletons). + * @param { intl.Locale } [locale] - Locale object. The default value is the current system locale. + * @returns { SimpleNumberFormat } SimpleNumberFormat object. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ + export function getSimpleNumberFormatBySkeleton(skeleton: string, locale?: intl.Locale): SimpleNumberFormat; + + /** + * Create a SimpleNumberFormat object by pattern and locale. + * The default value of locale is the current system locale. + * + * @param { string } skeleton - the skeleton used to create SimpleNumberFormat object. + * @param { Intl.Locale } [locale] - the Intl.Locale object used to create SimpleNumberFormat object. + * @returns { SimpleNumberFormat } a SimpleNumberFormat object created from pattern. + * @throws { BusinessError } 8900001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + export function getSimpleNumberFormatBySkeleton(skeleton: string, locale?: Intl.Locale): SimpleNumberFormat; + + /** + * Provide a simple number formatting interface. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class SimpleNumberFormat { + /** + * Formats a number. + * + * @param { number } value - Number to be formatted. + * @returns { string } Formatted number. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + format(value: number): string; + } + + /** + * Provide a number formatting interface which could format number to StyleString. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + export class StyledNumberFormat { + /** + * Creates a NumberFormat object for rich text display. + * + * @param { intl.NumberFormat | SimpleNumberFormat } numberFormat - NumberFormat object. + * @param { StyledNumberFormatOptions } [ options ] - Configuration options of the NumberFormat object. + * The default value is the default text style. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @deprecated since 20 + * @arkts 1.1&1.2 + */ + constructor(numberFormat: intl.NumberFormat | SimpleNumberFormat, options?: StyledNumberFormatOptions); + + /** + * A constructor used to create a StyledNumberFormat object. + * + * @param { Intl.NumberFormat | SimpleNumberFormat } numberFormat - Indicates the number format object that used to format number. + * @param { StyledNumberFormatOptions } [ options ] - Indicates the options used to format the number. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + constructor(numberFormat: Intl.NumberFormat | SimpleNumberFormat, options?: StyledNumberFormatOptions); + + + /** + * Formats a number as a rich text object. + * + * @param { number } value - Number to be formatted. + * @returns { StyledString } Rich text object after formatting. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + format(value: number): StyledString; + } + + /** + * Represents optional configuration items for the NumberFormat object. + * + * @interface StyledNumberFormatOptions + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + export interface StyledNumberFormatOptions { + /** + * Text style for the integer part. The default value is the default text style. + * + * @type { ?TextStyle } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + integer?: TextStyle; + + /** + * Text style for the decimal point. The default value is the default text style. + * + * @type { ?TextStyle } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + decimal?: TextStyle; + + /** + * Text style for the fraction part. The default value is the default text style. + * + * @type { ?TextStyle } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + fraction?: TextStyle; + + /** + * Text style for the unit. The default value is the default text style. + * + * @type { ?TextStyle } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 + */ + unit?: TextStyle; + } +} +export default i18n; diff --git a/api/intl_4.d.ts b/api/intl_4.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391