update intl apis

Signed-off-by: meaty-bag-and-wangwang-meat <zouzhexi@huawei.com>
This commit is contained in:
meaty-bag-and-wangwang-meat 2021-09-27 17:01:44 +08:00
parent ddb7fcef01
commit 8e4f3105a5
2 changed files with 320 additions and 3 deletions

4
api/@ohos.i18n.d.ts vendored
View File

@ -17,7 +17,7 @@
* Provides international settings related APIs.
*
* @since 7
* @devices phone, table, tv, wearable, car
* @devices phone, tablet, tv, wearable, car
*/
declare namespace i18n {
/**
@ -43,7 +43,7 @@ export function getDisplayCountry(country: string, locale: string, sentenceCase?
export function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;
/**
* Obtain all regions supported by the system.
* Obtain all languages supported by the system.
*
* @return Returns all languages supported by the system.
* @since 7

319
api/@ohos.intl.d.ts vendored
View File

@ -63,6 +63,157 @@ export class Locale {
* @since 6
*/
baseName: string
/**
* Indicates the case first style of the locale.
*/
caseFirst: string
/**
* Indicates the calendar.
*/
calendar: string
/**
* Indicates the collation.
*/
collation: string
/**
* Indicates the hour cycle.
*/
hourCycle: string
/**
* Indicates the numbering system.
*/
numberingSystem: string
/**
* Indicates whether it is numeric.
*/
numeric: boolean
/**
* Convert the locale information to string.
*
* @return Returns locale information in string form.
*/
toString(): string;
/**
* Maximize the locale's base information.
*
* @return Returns maximized locale.
*/
maximize(): Locale;
/**
* Minimize the locale's base information.
*
* @return Returns minimized locale.
*/
minimize(): Locale;
}
/**
* Provides the options of date time format.
*/
export interface DateTimeOptions {
/**
* Indicates the locale.
*/
locale: string
/**
* Indicates the date style.
*/
dateStyle: string
/**
* Indicates the time style.
*/
timeStyle: string
/**
* Indicates the hour cycle.
*/
hourCycle: string
/**
* Indicates the timezone.
*/
timeZone: string
/**
* Indicates the numbering system.
*/
numberingSystem: string
/**
* Indicates whether is 12 hour or not.
*/
hour12: boolean
/**
* Indicates the weekday style.
*/
weekday: string
/**
* Indicates the era style.
*/
era: string
/**
* Indicates the year style.
*/
year: string
/**
* Indicates the month style.
*/
month: string
/**
* Indicates the day style.
*/
day: string
/**
* Indicates the hour style.
*/
hour: string
/**
* Indicates the minute style.
*/
minute: string
/**
* Indicates the second style.
*/
second: string
/**
* Indicates the timezone name.
*/
timeZoneName: string
/**
* Indicates the day period format.
*/
dayPeriod: string
/**
* Indicates the locale matching algorithm.
*/
localeMatcher: string
/**
* Indicates the format matching algorithm.
*/
formatMatcher: string
}
/**
@ -76,9 +227,20 @@ export class DateTimeFormat {
*
* @param locale Indicates a character string containing the locale information, including
* the language and optionally the script and region, for the DateTimeFormat object.
* @param options Indicates the options used to format the date.
* @since 6
*/
constructor(locale?: string);
constructor(locale: string, options?: DateTimeOptions);
/**
* A constructor used to create a DateTimeFormat object.
*
* @param locale Indicates an array of character string containing the locale information, including
* the language and optionally the script and region, for the DateTimeFormat object.
* @param options Indicates the options used to format the date.
* @since 6
*/
constructor(locale: Array<string>, options?: DateTimeOptions);
/**
* Obtains the formatted date strings.
@ -88,6 +250,161 @@ export class DateTimeFormat {
* @since 6
*/
format(date: Date): string;
/**
* Obtains the formatted date strings of a date range.
*
* @param startDate Indicates the start date of the date range.
* @param endDate Indicates the end date of the date range.
* @return Returns a date string formatted based on the specified locale.
* @since 6
*/
formatRange(startDate: Date, endDate: Date): string;
/**
* Obtains the options of the DateTimeFormat object.
*
* @return Returns the options of the DateTimeFormat object.
* @since 6
*/
resolvedOptions(): DateTimeOptions;
}
/**
* Provides the options of number format.
*/
export interface NumberOptions {
/**
* Indicates the locale.
*/
locale: string
/**
* Indicates the currency.
*/
currency: string
/**
* Indicates the currency sign.
*/
currencySign: string
/**
* Indicates the currency display format.
*/
currencyDisplay: string
/**
* Indicates the unit.
*/
unit: string
/**
* Indicates the unit display format.
*/
unitDisplay: string
/**
* Indicates the sign display format.
*/
signDisplay: string
/**
* Indicates the compact display format.
*/
compactDisplay: string
/**
* Indicates the notation.
*/
notation: string
/**
* Indicates the locale matching algorithm.
*/
localeMatcher: string
/**
* Indicates the style.
*/
style: string
/**
* Indicates the numbering system.
*/
numberingSystem: string
/**
* Indicates whether using grouping or not.
*/
useGrouping: boolean
/**
* Indicates the minimum integer digits.
*/
minimumIntegerDigits: number
/**
* Indicates the minimum fraction digits.
*/
minimumFractionDigits: number
/**
* Indicates the maximum fraction digits.
*/
maximumFractionDigits: number
/**
* Indicates the minimum significant digits.
*/
minimumSignificantDigits: number
/**
* Indicates the maximum significant digits.
*/
maximumSignificantDigits: number
}
/**
* Provides the API for formatting number strings.
*/
export class NumberFormat {
/**
* A constructor used to create a NumberFormat object.
*
* @param locale Indicates a character string containing the locale information, including
* the language and optionally the script and region, for the NumberFormat object.
* @param options Indicates the options used to format the number.
* @since 6
*/
constructor(locale: string, options?: NumberOptions);
/**
* A constructor used to create a NumberFormat object.
*
* @param locale Indicates an array of character string containing the locale information, including
* the language and optionally the script and region, for the NumberFormat object.
* @param options Indicates the options used to format the number.
* @since 6
*/
constructor(locale: Array<string>, options?: NumberOptions);
/**
* Obtains the formatted number string.
*
* @param number Indicates the number to be formatted.
* @return Returns a number string formatted based on the specified locale.
* @since 6
*/
format(number: number): string;
/**
* Obtains the options of the NumberFormat object.
*
* @return Returns the options of the NumberFormat object.
* @since 6
*/
resolvedOptions(): NumberOptions;
}
}
export default intl;