From f6ee1642857dc2afcd1089336bb68dc1b5b07649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=8D=9A=E6=98=8E?= Date: Thu, 11 Jan 2024 02:47:34 +0000 Subject: [PATCH] add preference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 罗博明 --- api/@ohos.i18n.d.ts | 122 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/api/@ohos.i18n.d.ts b/api/@ohos.i18n.d.ts index fec24522c..a0334b7a6 100644 --- a/api/@ohos.i18n.d.ts +++ b/api/@ohos.i18n.d.ts @@ -98,6 +98,113 @@ declare namespace i18n { */ export function getSystemLocale(): string; + /** + * Enumeration of user prefercen options. + * + * @enum { string } PreferenceOptions + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + enum PreferenceOptions { + /** + * Temperature prference option + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + TEMPERATURE_PRFERENCE = 'temperature_prference', + /** + * First day of week prference + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + FIRST_DAY_OF_WEEK_PRFERENCE = 'first_day_of_week_prference' + } + + /** + * Enumeration of temperature unit keys. + * + * @enum { string } PreferenceOptions + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + enum TemperatureUnitKeys { + /** + * Celsius key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + CELSIUS = 'celsius', + /** + * Fahrenheit key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + FAHRENHEIT = 'fahrenheit' + } + + /** + * Enumeration of week day keys. + * + * @enum { string } WeekDayKeys + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + enum WeekDayKeys { + /** + * Monday key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + MONDAY = 'monday', + /** + * Tuesday key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + TUESDAY = 'tuesday', + /** + * Wednesday key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + WEDNESDAY = 'wednesday', + /** + * Thursday key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + THURSDAY = 'thursday', + /** + * Friday key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + FRIDAY = 'friday', + /** + * Saturday key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + SATURDAY = 'saturday', + /** + * Sunday key + * + * @syscap SystemCapability.Global.I18n + * @since 12 + */ + SUNDAY = 'sunday' + } + /** * Provides system functions. * @@ -479,6 +586,21 @@ declare namespace i18n { * @since 9 */ static getUsingLocalDigit(): boolean; + + /** + * Set user preference for i18n apis. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { PreferenceOptions } preferce - a variable represents whice preferce would be set + * @param { string } value - a string variable represents the preferce value + * @throws { BusinessError } 201 - the application does not have permission to call this function + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18n + * @systemapi Hide this for inner system use. + * @since 12 + */ + static setUserPreference(preferce: PreferenceOptions, value: string): void; } /**