diff --git a/api/@ohos.i18n.d.ts b/api/@ohos.i18n.d.ts index 1a370d6351eba2a6c870d1f3fe6cd4cdb5e90a8e..e1626d0e0beab6c32e38a674c3887c252a96dc24 100644 --- a/api/@ohos.i18n.d.ts +++ b/api/@ohos.i18n.d.ts @@ -364,7 +364,7 @@ export class Calendar { * @param locale The locale to be used. * @return Returns true representing the locale is an RTL locale * - * @since 8 + * @since 7 */ export function isRTL(locale: string): boolean; @@ -473,6 +473,17 @@ export class BreakIterator { isBoundary(offset: number): boolean; } +/** + * Get IndexUtil object. + * + * @syscap SystemCapability.Global.I18n + * @param locale Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @return Returns IndexUtil object. + * @since 8 + */ +export function getInstance(locale?:string): IndexUtil; + /** * Sequence text can be grouped under the specified area, * and grouping index with different lengths can be specified. @@ -481,17 +492,6 @@ export class BreakIterator { * @since 8 */ export class IndexUtil { - /** - * Get IndexUtil object. - * - * @syscap SystemCapability.Global.I18n - * @param locale Indicates a character string containing the locale information, including - * the language and optionally the script and region, for the NumberFormat object. - * @return Returns IndexUtil object. - * @since 8 - */ - getInstance(locale?:string): IndexUtil; - /** * Get a list of labels for use as a UI index * @@ -614,7 +614,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @return Returns a boolean represent whether system is 24-hour system. - * @since 8 + * @since 7 */ export function is24HourClock(): boolean; @@ -624,7 +624,7 @@ export class Character { * @syscap SystemCapability.Global.I18n * @param option represent the boolean to be set. * @return Returns a boolean represent whether setting 24-hour system success. - * @since 8 + * @since 7 */ export function set24HourClock(option: boolean): boolean; @@ -673,7 +673,7 @@ export function getFirstPreferredLanguage(): string; * @syscap SystemCapability.Global.I18n * @param zoneID TimeZone ID used to create TimeZone Object. * @return Returns a TimeZone object corresponds to zoneID. - * @since 8 + * @since 7 */ export function getTimeZone(zoneID?: string): TimeZone; @@ -681,7 +681,7 @@ export function getTimeZone(zoneID?: string): TimeZone; * Provides the API for accessing TimeZone name, rawOffset and offset information. * * @syscap SystemCapability.Global.I18n - * @since 8 + * @since 7 */ export class TimeZone { /** @@ -689,19 +689,10 @@ export class TimeZone { * * @syscap SystemCapability.Global.I18n * @return Returns a string represents the timezone id. - * @since 8 + * @since 7 */ getID(): string; - /** - * Get the displayName of the TimeZone Object under the default locale. - * - * @syscap SystemCapability.Global.I18n - * @return Returns a string represents the display name. - * @since 8 - */ - getDisplayName(): string; - /** * Get the displayName of the TimeZone Object under the locale. * @@ -709,16 +700,16 @@ export class TimeZone { * @param locale the locale tag use to display timezone object's name. * @param isDST wether conside daylight saving time when display timezone object's name. * @return Returns a string represents the display name. - * @since 8 + * @since 7 */ - getDisplayName(locale: string, isDST?: boolean): string; + getDisplayName(locale?: string, isDST?: boolean): string; /** * Get the raw offset of the TimeZone object. * * @syscap SystemCapability.Global.I18n * @return Returns a number represents the raw offset. - * @since 8 + * @since 7 */ getRawOffset(): number; @@ -728,8 +719,9 @@ export class TimeZone { * @syscap SystemCapability.Global.I18n * @date Indicates a date use to compute offset. * @return Returns a number represents the offset with date. - * @since 8 + * @since 7 */ - getOffset(date: number): number; + getOffset(date?: number): number; +} } -} \ No newline at end of file +export default i18n; \ No newline at end of file diff --git a/api/@ohos.intl.d.ts b/api/@ohos.intl.d.ts index cf384e60714bb09a5b1c4c8cf74b696bd4338119..7476a203e8e56494fe73d97f05a2ad1ff74598df 100755 --- a/api/@ohos.intl.d.ts +++ b/api/@ohos.intl.d.ts @@ -23,49 +23,49 @@ declare namespace intl { /** * Provides the options of Locale. * - * @since 8 + * @since 6 * @syscap SystemCapability.Global.I18n */ export interface LocaleOptions { /** * Indicates the calendar. * - * @since 8 + * @since 6 */ calendar: string; /** * Indicates the collation. * - * @since 8 + * @since 6 */ collation: string; /** * Indicates the hourCycle. * - * @since 8 + * @since 6 */ hourCycle: string; /** * Indicates the numberingSystem. * - * @since 8 + * @since 6 */ numberingSystem: string; /** * Indicates the numeric. * - * @since 8 + * @since 6 */ numeric: boolean; /** * Indicates the caseFirst. * - * @since 8 + * @since 6 */ caseFirst: string; } @@ -81,7 +81,7 @@ export class Locale { * A constructor used to create a Locale object. * * @syscap SystemCapability.Global.I18n - * @since 6 + * @since 8 */ constructor(); @@ -131,31 +131,49 @@ export class Locale { /** * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ caseFirst: string /** * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ calendar: string /** * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ collation: string /** * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ hourCycle: string /** * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ numberingSystem: string /** * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ numeric: boolean @@ -164,6 +182,7 @@ export class Locale { * * @syscap SystemCapability.Global.I18n * @return Returns locale information in string form. + * @since 6 */ toString(): string; @@ -172,6 +191,7 @@ export class Locale { * * @syscap SystemCapability.Global.I18n * @return Returns maximized locale. + * @since 6 */ maximize(): Locale; @@ -180,6 +200,7 @@ export class Locale { * * @syscap SystemCapability.Global.I18n * @return Returns minimized locale. + * @since 6 */ minimize(): Locale; } @@ -188,100 +209,157 @@ export class Locale { * Provides the options of date time format. * * @syscap SystemCapability.Global.I18n + * @since 6 */ export interface DateTimeOptions { /** * Indicates the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ locale: string /** * Indicates the date style. + * @syscap SystemCapability.Global.I18n + * @since 6 */ dateStyle: string /** * Indicates the time style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ timeStyle: string /** * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ hourCycle: string /** * Indicates the timezone. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ timeZone: string /** * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ numberingSystem: string /** * Indicates whether is 12 hour or not. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ hour12: boolean /** * Indicates the weekday style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ weekday: string /** * Indicates the era style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ era: string /** * Indicates the year style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ year: string /** * Indicates the month style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ month: string /** * Indicates the day style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ day: string /** * Indicates the hour style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ hour: string /** * Indicates the minute style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ minute: string /** * Indicates the second style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ second: string /** * Indicates the timezone name. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ timeZoneName: string /** * Indicates the day period format. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ dayPeriod: string /** * Indicates the locale matching algorithm. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ localeMatcher: string /** * Indicates the format matching algorithm. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ formatMatcher: string } @@ -347,100 +425,158 @@ export class DateTimeFormat { * Provides the options of number format. * * @syscap SystemCapability.Global.I18n + * @since 6 */ export interface NumberOptions { /** * Indicates the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ locale: string /** * Indicates the currency. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ currency: string /** * Indicates the currency sign. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ currencySign: string /** * Indicates the currency display format. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ currencyDisplay: string /** * Indicates the unit. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ unit: string /** * Indicates the unit display format. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ unitDisplay: string /** * Indicates the unit display format. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ unitUsage: string /** * Indicates the sign display format. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ signDisplay: string /** * Indicates the compact display format. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ compactDisplay: string /** * Indicates the notation. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ notation: string /** * Indicates the locale matching algorithm. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ localeMatcher: string /** * Indicates the style. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ style: string /** * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ numberingSystem: string /** * Indicates whether using grouping or not. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ useGrouping: boolean /** * Indicates the minimum integer digits. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ minimumIntegerDigits: number /** * Indicates the minimum fraction digits. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ minimumFractionDigits: number /** * Indicates the maximum fraction digits. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ maximumFractionDigits: number /** * Indicates the minimum significant digits. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ minimumSignificantDigits: number /** * Indicates the maximum significant digits. + * + * @syscap SystemCapability.Global.I18n + * @since 6 */ maximumSignificantDigits: number } @@ -449,6 +585,7 @@ export interface NumberOptions { * Provides the API for formatting number strings. * * @syscap SystemCapability.Global.I18n + * @since 6 */ export class NumberFormat { /** @@ -500,41 +637,62 @@ export interface CollatorOptions { /** * The locale matching algorithm to use. * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ localeMatcher: string; /** * Whether the comparison is for sorting or for searching for matching strings. * Possible values are "sort" and "search"; the default is "sort". + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ usage: string; /** * Which differences in the strings should lead to non-zero result values. * Possible values are "base", "accent", "case", "variant". + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ sensitivity: string; /** * Whether punctuation should be ignored. * Possible values are true and false; the default is false. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ ignorePunctuation: boolean; /** * Variant collations for certain locales. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ collation: string; /** * Whether numeric collation should be used. * Possible values are true and false; the default is false. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ numeric: boolean; /** * Whether upper case or lower case should sort first. * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ caseFirst: string; } @@ -599,23 +757,35 @@ export interface PluralRulesOptions { /** * The locale matching algorithm to use. * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ localeMatcher: string; /** * The type to use. Possible values are: "cardinal", "ordinal" + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ type: string; /** * The minimum number of integer digits to use. * Possible values are from 1 to 21; the default is 1. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ 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; + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ minimumFractionDigits: number; @@ -623,18 +793,27 @@ export interface PluralRulesOptions { * 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; + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ maximumFractionDigits: number; /** * The minimum number of significant digits to use. * Possible values are from 1 to 21; the default is 1. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ minimumSignificantDigits: number; /** * The maximum number of significant digits to use. * Possible values are from 1 to 21; the default is 21. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ maximumSignificantDigits: number; } @@ -687,18 +866,27 @@ export class PluralRules { /** * The locale matching algorithm to use. * Possible values are: lookup, best fit + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ localeMatcher: string; /** * The format of output message. * Possible values are: always, auto + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ numeric: string; /** * The length of the internationalized message. * Possible values are: long, short, narrow + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ style: string; } @@ -712,23 +900,35 @@ export class PluralRules { export interface RelativeTimeFormatResolvedOptions { /** * The BCP 47 language tag for the locale actually used. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ locale: string; /** * The length of the internationalized message. * Possible values are: long, short, narrow + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ style: string; /** * The format of output message. * Possible values are: always, auto + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ numeric: string; /** * The value requested using the Unicode extension key "nu" or filled in as a default. + * + * @syscap SystemCapability.Global.I18n + * @since 8 */ numberingSystem: string; }