mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-30 10:53:31 +00:00
add character, index-util, relative time format and breakIterator to i18n
Signed-off-by: sunyaozu <sunyaozu@huawei.com>
This commit is contained in:
parent
ce3d734172
commit
f9d0c390b5
279
api/@ohos.i18n.d.ts
vendored
279
api/@ohos.i18n.d.ts
vendored
@ -16,6 +16,7 @@
|
||||
/**
|
||||
* Provides international settings related APIs.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 7
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
*/
|
||||
@ -23,6 +24,7 @@ declare namespace i18n {
|
||||
/**
|
||||
* Obtains the country or region name localized for display on a given locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param country The locale whose country or region name will be displayed.
|
||||
* @param locale The locale used to display the country or region.
|
||||
* @param sentenceCase Specifies whether the country or region name is displayed in sentence case.
|
||||
@ -34,6 +36,7 @@ export function getDisplayCountry(country: string, locale: string, sentenceCase?
|
||||
/**
|
||||
* Obtains the language name localized for display on a given locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param language The locale whose language name will be displayed.
|
||||
* @param locale The locale used to display the language.
|
||||
* @param sentenceCase Specifies whether the language name is displayed in sentence case.
|
||||
@ -45,6 +48,7 @@ export function getDisplayLanguage(language: string, locale: string, sentenceCas
|
||||
/**
|
||||
* Obtain all languages supported by the system.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns all languages supported by the system.
|
||||
* @since 7
|
||||
* @systemapi Hide this for inner system use.
|
||||
@ -54,6 +58,7 @@ export function getSystemLanguages(): Array<string>;
|
||||
/**
|
||||
* Obtain all regions supported by the system in the language.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param language The language used to get the list of regions.
|
||||
* @return Returns all regions supported by the system in the language.
|
||||
* @since 7
|
||||
@ -64,6 +69,7 @@ export function getSystemCountries(language: string): Array<string>;
|
||||
/**
|
||||
* Determine whether the current language or region is recommended.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param language The language code.
|
||||
* @param region The region code.
|
||||
* @return Returns whether the current language or region is recommended.
|
||||
@ -75,6 +81,7 @@ export function isSuggested(language: string, region?: string): boolean;
|
||||
/**
|
||||
* Obtain the language currently used by the system.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the language currently used by the system.
|
||||
* @since 7
|
||||
*/
|
||||
@ -83,6 +90,7 @@ export function getSystemLanguage(): string;
|
||||
/**
|
||||
* Set the language currently used by the system.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param language The language to be used.
|
||||
* @since 7
|
||||
* @systemapi Hide this for inner system use.
|
||||
@ -92,6 +100,7 @@ export function setSystemLanguage(language: string): boolean;
|
||||
/**
|
||||
* Obtain the region currently used by the system.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the region currently used by the system.
|
||||
* @since 7
|
||||
*/
|
||||
@ -100,6 +109,7 @@ export function getSystemRegion(): string;
|
||||
/**
|
||||
* Set the region currently used by the system.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param region The region to be used.
|
||||
* @since 7
|
||||
* @systemapi Hide this for inner system use.
|
||||
@ -109,6 +119,7 @@ export function setSystemRegion(region: string): boolean;
|
||||
/**
|
||||
* Obtain the locale currently used by the system.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the locale currently used by the system.
|
||||
* @since 7
|
||||
*/
|
||||
@ -117,6 +128,7 @@ export function getSystemLocale(): string;
|
||||
/**
|
||||
* Set the locale currently used by the system.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale The locale to be used.
|
||||
* @since 7
|
||||
* @systemapi Hide this for inner system use.
|
||||
@ -126,11 +138,14 @@ export function setSystemLocale(locale: string): boolean;
|
||||
/**
|
||||
* Provides util functions.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export interface Util {
|
||||
/**
|
||||
* Convert from unit to to unit and format according to the locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param fromUnit Information of the unit to be converted.
|
||||
* @param toUnit Information about the unit to be converted to.
|
||||
* @param value Indicates the number to be formatted.
|
||||
@ -144,6 +159,7 @@ export interface Util {
|
||||
/**
|
||||
* Provides the options of unit.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export interface UnitInfo {
|
||||
@ -161,6 +177,7 @@ export interface UnitInfo {
|
||||
/**
|
||||
* Provides the options of PhoneNumberFormat.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export interface PhoneNumberFormatOptions {
|
||||
@ -173,11 +190,14 @@ export interface PhoneNumberFormatOptions {
|
||||
/**
|
||||
* Provides the API for formatting phone number strings
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export class PhoneNumberFormat {
|
||||
/**
|
||||
* A constructor used to create a PhoneNumberFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param country Indicates a character string containing the country information for the PhoneNumberFormat object.
|
||||
* @param type Indicates the type used to format the phone number, includes: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL".
|
||||
* @since 8
|
||||
@ -186,6 +206,8 @@ export class PhoneNumberFormat {
|
||||
|
||||
/**
|
||||
* Judges whether phone number is valid.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param number Indicates the input phone number to be judged.
|
||||
* @return Returns a boolean indicates whether the input phone number is valid.
|
||||
* @since 8
|
||||
@ -194,6 +216,8 @@ export class PhoneNumberFormat {
|
||||
|
||||
/**
|
||||
* Obtains the formatted phone number strings of number.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param number Indicates the input phone number to be formatted.
|
||||
* @return Returns the formatted phone number.
|
||||
* @since 8
|
||||
@ -204,6 +228,7 @@ export class PhoneNumberFormat {
|
||||
/**
|
||||
* Get a Calendar instance specified by locale and type.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale The locale used to get calendar.
|
||||
* @param 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,
|
||||
@ -216,6 +241,7 @@ export class Calendar {
|
||||
/**
|
||||
* set the date.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param date Date object used to set the time and date.
|
||||
* @since 8
|
||||
*/
|
||||
@ -224,6 +250,7 @@ export class Calendar {
|
||||
/**
|
||||
* set the time.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param time Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT.
|
||||
* @since 8
|
||||
*/
|
||||
@ -232,6 +259,7 @@ export class Calendar {
|
||||
/**
|
||||
* Set the time
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param year The year field of the calendar, ranges from 0 to 9999.
|
||||
* @param month The month field of the calendar, ranges from 0 to 11.
|
||||
* @param date The day field of the calendar, ranges from 1 to 31.
|
||||
@ -245,6 +273,7 @@ export class Calendar {
|
||||
/**
|
||||
* Set the timezone of this calendar.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param timezone The id of a timezone.
|
||||
* @since 8
|
||||
*/
|
||||
@ -253,6 +282,7 @@ export class Calendar {
|
||||
/**
|
||||
* Get the timezone id of this calendar instance.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the timezone id of this calendar.
|
||||
* @since 8
|
||||
*/
|
||||
@ -261,6 +291,7 @@ export class Calendar {
|
||||
/**
|
||||
* Get the start day of a week. 0 indicates Sunday, 6 indicates Saturday.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns start day of a week.
|
||||
* @since 8
|
||||
*/
|
||||
@ -269,6 +300,7 @@ export class Calendar {
|
||||
/**
|
||||
* Set the start day of a week. 0 indicates Sunday, 6 indicates Saturday.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param value Indicates the start day of a week. 0 indicates Sunday, 6 indicates Saturday.
|
||||
* @since 8
|
||||
*/
|
||||
@ -277,6 +309,7 @@ export class Calendar {
|
||||
/**
|
||||
* Get the minial days of a week, which is needed for the first day of a year.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the minimal days of a week.
|
||||
* @since 8
|
||||
*/
|
||||
@ -285,6 +318,7 @@ export class Calendar {
|
||||
/**
|
||||
* Set the minial days of a week, which is needed for the first week of a year.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param value The value to be set.
|
||||
* @since 8
|
||||
*/
|
||||
@ -293,6 +327,7 @@ export class Calendar {
|
||||
/**
|
||||
* Get the associated value with the field.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param 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.
|
||||
@ -304,6 +339,7 @@ export class Calendar {
|
||||
/**
|
||||
* Get calendar's name localized for display in the given locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale Locale used to get the localized name for this calendar.
|
||||
* @return Returns the localized name of this calendar.
|
||||
* @since 8
|
||||
@ -314,6 +350,7 @@ export class Calendar {
|
||||
* Returns true if the given date is a weekend day. If the date is not given,
|
||||
* the date object of this calendar is used.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param date Date object whose attribute is desired.
|
||||
* @return Returns whether the date is a weekend day.
|
||||
* @since 8
|
||||
@ -324,10 +361,252 @@ export class Calendar {
|
||||
/**
|
||||
* Judge whether the locale is RTL locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale The locale to be used.
|
||||
* @return Returns true representing the locale is an RTL locale
|
||||
*
|
||||
* @since 8
|
||||
*/
|
||||
export function isRTL(locale: string): boolean;
|
||||
|
||||
/**
|
||||
* Obtains a BreakIterator object for finding the location of break point in text.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale the returned BreakIterator will adapt the rule, specified by the locale, to break text.
|
||||
* @return Returns a newly constructed BreakIterator object.
|
||||
* @since 8
|
||||
*/
|
||||
export function getLineInstance(locale: string): BreakIterator;
|
||||
|
||||
/**
|
||||
* The BreakIterator class is used for finding the location of break point in text.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export class BreakIterator {
|
||||
/**
|
||||
* Obtains the current position of the BreakIterator instance.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the current position of the BreakIterator instance.
|
||||
* @since 8
|
||||
*/
|
||||
current(): number;
|
||||
|
||||
/**
|
||||
* Set the BreakIterator's position to the first break point, the first break point is always the beginning of the
|
||||
* processed text.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the index of the first break point.
|
||||
* @since 8
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the index of the last break point.
|
||||
* @since 8
|
||||
*/
|
||||
last(): number;
|
||||
|
||||
/**
|
||||
* Set the BreakItertor's position to the nth break point from the current break point.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param index indicates the number of break points to advance. If index is not given, n is treated as 1.
|
||||
* @return Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1.
|
||||
* @since 8
|
||||
*/
|
||||
next(index?: number): number;
|
||||
|
||||
/**
|
||||
* Set the BreakItertor's position to the break point preceding the current break point.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1.
|
||||
* @since 8
|
||||
*/
|
||||
previous(): number;
|
||||
|
||||
/**
|
||||
* Set the text to be processed.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param text Indicates the text to be processed by the BreakIterator.
|
||||
* @since 8
|
||||
*/
|
||||
setLineBreakText(text: string): void;
|
||||
|
||||
/**
|
||||
* Set the BreakIterator's position to the first break point following the specified offset.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1.
|
||||
* @since 8
|
||||
*/
|
||||
following(offset: number): number;
|
||||
|
||||
/**
|
||||
* Obtains the text being processed.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the text that is processed by the BreakIterator.
|
||||
* @since 8
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param offset The offset to be checked.
|
||||
* @return Returns true if the offset is a break point.
|
||||
* @since 8
|
||||
*/
|
||||
isBoundary(offset: number): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sequence text can be grouped under the specified area,
|
||||
* and grouping index with different lengths can be specified.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export class IndexUtil {
|
||||
/**
|
||||
* Get IndexUtil object.
|
||||
*
|
||||
* @sysCap SystemCapability.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
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns a list of labels
|
||||
* @since 8
|
||||
*/
|
||||
getIndexList(): Array<string>;
|
||||
|
||||
/**
|
||||
* Add the index characters from a Locale to the index.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale The locale whose index characters are to be added.
|
||||
* @since 8
|
||||
*/
|
||||
addLocale(locale: string);
|
||||
|
||||
/**
|
||||
* Get corresponding index of the input text.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param text input text
|
||||
* @since 8
|
||||
*/
|
||||
getIndex(text: string): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the API for accessing unicode character properties, sunch as whether a character is a digit.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export class Character {
|
||||
/**
|
||||
* Determines whether the specified code point is a digit character
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a digit character
|
||||
*/
|
||||
isDigit(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified character is a space character or not.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a space character
|
||||
*/
|
||||
isSpaceChar(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified character is a whitespace character
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a whitespace character
|
||||
*/
|
||||
isWhitespace(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified character is a RTL character or not.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a RTL character
|
||||
*/
|
||||
isRTL(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified character is a Ideographic character or not.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a Ideographic character
|
||||
*/
|
||||
isIdeograph(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified character is a Letter or not.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a Letter
|
||||
*/
|
||||
isLetter(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified character is a LowerCase character or not.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a LowerCase character
|
||||
*/
|
||||
isLowerCase(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified character is a UpperCase character or not.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns true if the character is a UpperCase character
|
||||
*/
|
||||
isUpperCase(char: string): boolean;
|
||||
|
||||
/**
|
||||
* Get the general category value of the specified character.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param char the character to be tested
|
||||
* @return Returns the general category of the specified character.
|
||||
*/
|
||||
getType(char: string): string;
|
||||
}
|
||||
}
|
156
api/@ohos.intl.d.ts
vendored
156
api/@ohos.intl.d.ts
vendored
@ -16,6 +16,7 @@
|
||||
/**
|
||||
* Provides internationalization related APIs.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
* @devices phone, tablet, tv, wearable, car
|
||||
*/
|
||||
@ -23,12 +24,14 @@ declare namespace intl {
|
||||
/**
|
||||
* Provides APIs for obtaining locale information.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
*/
|
||||
export class Locale {
|
||||
/**
|
||||
* A constructor used to create a Locale object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale Indicates a character string containing the locale information, including
|
||||
* the language and optionally the script and region.
|
||||
* @since 6
|
||||
@ -38,6 +41,7 @@ export class Locale {
|
||||
/**
|
||||
* Indicates the language of the locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
*/
|
||||
language: string
|
||||
@ -45,6 +49,7 @@ export class Locale {
|
||||
/**
|
||||
* Indicates the script of the locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
*/
|
||||
script: string
|
||||
@ -52,6 +57,7 @@ export class Locale {
|
||||
/**
|
||||
* Indicates the region of the locale.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
*/
|
||||
region: string
|
||||
@ -60,6 +66,7 @@ export class Locale {
|
||||
* Indicates the basic locale information, which is returned as a substring of
|
||||
* a complete locale string.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
*/
|
||||
baseName: string
|
||||
@ -97,6 +104,7 @@ export class Locale {
|
||||
/**
|
||||
* Convert the locale information to string.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns locale information in string form.
|
||||
*/
|
||||
toString(): string;
|
||||
@ -104,6 +112,7 @@ export class Locale {
|
||||
/**
|
||||
* Maximize the locale's base information.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns maximized locale.
|
||||
*/
|
||||
maximize(): Locale;
|
||||
@ -111,6 +120,7 @@ export class Locale {
|
||||
/**
|
||||
* Minimize the locale's base information.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns minimized locale.
|
||||
*/
|
||||
minimize(): Locale;
|
||||
@ -118,6 +128,8 @@ export class Locale {
|
||||
|
||||
/**
|
||||
* Provides the options of date time format.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
*/
|
||||
export interface DateTimeOptions {
|
||||
/**
|
||||
@ -219,12 +231,14 @@ export interface DateTimeOptions {
|
||||
/**
|
||||
* Provides the API for formatting date strings.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
*/
|
||||
export class DateTimeFormat {
|
||||
/**
|
||||
* A constructor used to create a DateTimeFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
constructor();
|
||||
@ -232,6 +246,7 @@ export class DateTimeFormat {
|
||||
/**
|
||||
* A constructor used to create a DateTimeFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale Indicates 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.
|
||||
@ -242,6 +257,7 @@ export class DateTimeFormat {
|
||||
/**
|
||||
* Obtains the formatted date strings.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param date Indicates the Date object to be formatted.
|
||||
* @return Returns a date string formatted based on the specified locale.
|
||||
* @since 6
|
||||
@ -251,6 +267,7 @@ export class DateTimeFormat {
|
||||
/**
|
||||
* Obtains the formatted date strings of a date range.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @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.
|
||||
@ -261,6 +278,7 @@ export class DateTimeFormat {
|
||||
/**
|
||||
* Obtains the options of the DateTimeFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the options of the DateTimeFormat object.
|
||||
* @since 6
|
||||
*/
|
||||
@ -269,6 +287,8 @@ export class DateTimeFormat {
|
||||
|
||||
/**
|
||||
* Provides the options of number format.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
*/
|
||||
export interface NumberOptions {
|
||||
/**
|
||||
@ -369,11 +389,14 @@ export interface NumberOptions {
|
||||
|
||||
/**
|
||||
* Provides the API for formatting number strings.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
*/
|
||||
export class NumberFormat {
|
||||
/**
|
||||
* A constructor used to create a NumberFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 6
|
||||
*/
|
||||
constructor();
|
||||
@ -381,6 +404,7 @@ export class NumberFormat {
|
||||
/**
|
||||
* A constructor used to create a NumberFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @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.
|
||||
@ -391,6 +415,7 @@ export class NumberFormat {
|
||||
/**
|
||||
* Obtains the formatted number string.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param number Indicates the number to be formatted.
|
||||
* @return Returns a number string formatted based on the specified locale.
|
||||
* @since 6
|
||||
@ -400,6 +425,7 @@ export class NumberFormat {
|
||||
/**
|
||||
* Obtains the options of the NumberFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns the options of the NumberFormat object.
|
||||
* @since 6
|
||||
*/
|
||||
@ -409,6 +435,7 @@ export class NumberFormat {
|
||||
/**
|
||||
* Provides the options of Collator
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export interface CollatorOptions {
|
||||
@ -457,18 +484,21 @@ export interface CollatorOptions {
|
||||
/**
|
||||
* Enable language-sensitive string comparison.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export class Collator {
|
||||
/**
|
||||
* A constructor used to create Collator object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* A constructor used to create Collator Object;
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale Indicates a character string containing the locale information, including
|
||||
* the language and optionally the script and region, for the Collator object.
|
||||
* @param options Indicates the options used to initialize Collator object.
|
||||
@ -479,6 +509,7 @@ export class Collator {
|
||||
/**
|
||||
* compares two strings according to the sort order of this Collator object
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param first The first string to compare.
|
||||
* @param second The second string to compare.
|
||||
* @return Returns a number indicating how first compare to second:
|
||||
@ -493,6 +524,7 @@ export class Collator {
|
||||
* Returns a new object with properties reflecting the locale and collation options computed
|
||||
* during initialization of the object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @return Returns a CollatorOptions object reflecting the properties of this object.
|
||||
* @since 8
|
||||
*/
|
||||
@ -502,6 +534,7 @@ export class Collator {
|
||||
/**
|
||||
* Provides the options of PluralRules
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export interface PluralRulesOptions {
|
||||
@ -551,12 +584,14 @@ export interface PluralRulesOptions {
|
||||
/**
|
||||
* Enables plural-sensitive formatting and plural-related language rules.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
export class PluralRules {
|
||||
/**
|
||||
* A constructor used to create PluralRules object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @since 8
|
||||
*/
|
||||
constructor();
|
||||
@ -564,6 +599,7 @@ export class PluralRules {
|
||||
/**
|
||||
* A constructor used to create PluralRules object.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param locale Indicates a character string containing the locale information, including
|
||||
* the language and optionally the script and region, for the PluralRules object.
|
||||
* @param options Indicates the options used to initialize PluralRules object.
|
||||
@ -574,6 +610,7 @@ export class PluralRules {
|
||||
/**
|
||||
* Returns a string indicating which plural rule to use for locale-aware formatting.
|
||||
*
|
||||
* @sysCap SystemCapability.I18N
|
||||
* @param n The number to get a plural rule for.
|
||||
* @return A string representing the pluralization category of the number,
|
||||
* can be one of zero, one, two, few, many or other.
|
||||
@ -581,5 +618,124 @@ export class PluralRules {
|
||||
*/
|
||||
select(n: number): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the input options of RelativeTimeFormat.
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @since 8
|
||||
*/
|
||||
export interface RelativeTimeFormatInputOptions {
|
||||
/**
|
||||
* The locale matching algorithm to use.
|
||||
* Possible values are: lookup, best fit
|
||||
*/
|
||||
localeMatcher: string;
|
||||
|
||||
/**
|
||||
* The format of output message.
|
||||
* Possible values are: always, auto
|
||||
*/
|
||||
numeric: string;
|
||||
|
||||
/**
|
||||
* The length of the internationalized message.
|
||||
* Possible values are: long, short, narrow
|
||||
*/
|
||||
style: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the resolved options of RelativeTimeFormat.
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @since 8
|
||||
*/
|
||||
export interface RelativeTimeFormatResolvedOptions {
|
||||
/**
|
||||
* The BCP 47 language tag for the locale actually used.
|
||||
*/
|
||||
locale: string;
|
||||
|
||||
/**
|
||||
* The length of the internationalized message.
|
||||
* Possible values are: long, short, narrow
|
||||
*/
|
||||
style: string;
|
||||
|
||||
/**
|
||||
* The format of output message.
|
||||
* Possible values are: always, auto
|
||||
*/
|
||||
numeric: string;
|
||||
|
||||
/**
|
||||
* The value requested using the Unicode extension key "nu" or filled in as a default.
|
||||
*/
|
||||
numberingSystem: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a Time period length value and a unit, RelativeTimeFormat object enables
|
||||
* language-sensitive relative time formatting.
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @since 8
|
||||
*/
|
||||
export class RelativeTimeFormat {
|
||||
/**
|
||||
* A constructor used to create RelativeTimeFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @since 8
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* A constructor used to create RelativeTimeFormat object.
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @param locale Indicates a character string containing the locale information, including
|
||||
* the language and optionally the script and region, for the RelativeTimeFormat object.
|
||||
* @param options Indicates the options used to initialize RelativeTimeFormat object.
|
||||
* @since 8
|
||||
*/
|
||||
constructor(locale: string | Array<string>, options?: RelativeTimeFormatInputOptions);
|
||||
|
||||
/**
|
||||
* formats a value and unit according to the locale and formatting options of this object.
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @param value Numeric value to use in the internationalized relative time message.
|
||||
* @param unit Unit to use in the relative time internationalized message.
|
||||
* Possible values are: year, quarter, month, week, day, hour, minute, second.
|
||||
* @returns formatted language-sensitive relative time.
|
||||
* @since 8
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @param value Numeric value to use in the internationalized relative time message.
|
||||
* @param unit to use in the relative time internationalized message.
|
||||
* Possible values are: year, quarter, month, week, day, hour, minute, second.
|
||||
* @returns an Array of objects representing the relative time format in parts
|
||||
* @since 8
|
||||
*/
|
||||
formatToParts(value: number, unit: string): Array<object>;
|
||||
|
||||
/**
|
||||
* Returns a new object with properties reflecting the locale and formatting options computed during
|
||||
* initialization of the object.
|
||||
*
|
||||
* @sysCap SystemCapability.Intl
|
||||
* @returns RelativeTimeFormatOptions which reflecting the locale and formatting options of the object.
|
||||
* @since 8
|
||||
*/
|
||||
resolvedOptions(): RelativeTimeFormatResolvedOptions;
|
||||
}
|
||||
}
|
||||
export default intl;
|
Loading…
Reference in New Issue
Block a user