1 Star 0 Fork 4K

Feng Lin/interface_sdk-js

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
@ohos.i18n.d.ts 113.63 KB
Copy Edit Raw Blame History
罗博明 authored 2024-07-17 17:45 +08:00 . add type info
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370
/*
* 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
*/
import { BusinessError } from './@ohos.base';
/**
* 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 11
*/
declare namespace i18n {
/**
* 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.
* @syscap SystemCapability.Global.I18n
* @since 7
* @deprecated since 9
* @useinstead ohos.System.getDisplayCountry
*/
export function 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.
* @syscap SystemCapability.Global.I18n
* @since 7
* @deprecated since 9
* @useinstead ohos.System.getDisplayLanguage
*/
export function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;
/**
* Obtains the language currently used by the system.
*
* @returns { string } the language currently used by the system.
* @syscap SystemCapability.Global.I18n
* @since 7
* @deprecated since 9
* @useinstead ohos.System.getSystemLanguage
*/
export function getSystemLanguage(): string;
/**
* Obtains the region currently used by the system.
*
* @returns { string } the region currently used by the system.
* @syscap SystemCapability.Global.I18n
* @since 7
* @deprecated since 9
* @useinstead ohos.System.getSystemRegion
*/
export function getSystemRegion(): string;
/**
* Obtains the locale currently used by the system.
*
* @returns { string } the locale currently used by the system.
* @syscap SystemCapability.Global.I18n
* @since 7
* @deprecated since 9
* @useinstead ohos.System.getSystemLocale
*/
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 11
*/
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 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
* @atomicservice
* @since 12
*/
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 name localized for display on a given locale.
*
* @param { string } language - The locale whose language name will be displayed. It must be a valid language.
* @param { string } locale - The locale used to display the language. It must be a valid locale.
* @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 - 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 11
*/
static getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;
/**
* Obtains all languages supported by the system.
*
* @returns { Array<string> } all languages supported by the system.
* @syscap SystemCapability.Global.I18n
* @since 9
*/
/**
* Obtains all languages supported by the system.
*
* @returns { Array<string> } all languages supported by the system.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
static getSystemLanguages(): Array<string>;
/**
* 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<string> } 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 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<string> } 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
* @atomicservice
* @since 12
*/
static getSystemCountries(language: string): Array<string>;
/**
* 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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 language currently used by the system.
*
* @returns { string } the language currently used by the system.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @form
* @atomicservice
* @since 11
*/
static getSystemLanguage(): string;
/**
* Set the language currently used by the system.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { string } language - The language to be used. It must be a valid language.
* @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 9
*/
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 region currently used by the system.
*
* @returns { string } the region currently used by the system.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
static getSystemRegion(): string;
/**
* Set the region currently used by the system.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { string } region - The region to be used. It must be a valid 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 9
*/
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 locale currently used by the system.
*
* @returns { string } the locale currently used by the system.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 11
*/
static getSystemLocale(): string;
/**
* Set the locale currently used by the system.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { string } locale - The locale to be used. It must be a valid locale.
* @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 9
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static is24HourClock(): boolean;
/**
* Set 24-hour system.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { boolean } option - represent the boolean to be set.
* @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 9
*/
static set24HourClock(option: boolean): void;
/**
* Add one language to preferred language List.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { string } language - the language to be added. It must be a valid language.
* @param { number } [index] - the position of preferred language list to be inserted.
* @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 9
*/
static addPreferredLanguage(language: string, index?: number): void;
/**
* Remove one language from preferred language list.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { number } index - the position of removed language in 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 9
*/
static removePreferredLanguage(index: number): void;
/**
* Access the system preferred language list.
*
* @returns { Array<string> } a string Array represent the preferred language list.
* @syscap SystemCapability.Global.I18n
* @since 9
*/
/**
* Access the system preferred language list.
*
* @returns { Array<string> } a string Array represent the preferred language list.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
static getPreferredLanguageList(): Array<string>;
/**
* Get the first preferred language of system.
*
* @returns { string } a string represent the first preferred language of system.
* @syscap SystemCapability.Global.I18n
* @since 9
*/
/**
* Get the first preferred language of system.
*
* @returns { string } a string represent the first preferred language of system.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* Get the preferred language of App.
*
* @returns { string } a string represent the preferred language of App.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
static getAppPreferredLanguage(): string;
/**
* Set whether to use local digit.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { boolean } flag - a boolean variable represents whether to use local digit
* @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 9
*/
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
*/
/**
* Get whether to use local digit.
*
* @returns { boolean } a boolean represents whether to use local digit.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
static getUsingLocalDigit(): boolean;
}
/**
* Provides util functions.
*
* @interface Util
* @syscap SystemCapability.Global.I18n
* @since 8
* @deprecated since 9
* @useinstead ohos.i18n/i18n.I18NUtil
*/
export interface Util {
/**
* 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 8
* @deprecated since 9
* @useinstead ohos.i18n/i18n.I18NUtil#unitConvert
*/
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 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static getTimePeriodName(hour:number, locale?: string): string;
/**
* Get the best matched locale in the specified list.
*
* @param { string } locale - the origin locale. It must be a valid locale.
* @param { string[] } localeList - a list of locales to be matched. It must be a valid locale.
* @returns { string } the string of the best matched locale name.
* The return value may be empty string due to none is matched.
* @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 12
*/
static getBestMatchLocale(locale: string, localeList: string[]): string;
/**
* Get a three-letter abbreviation of the specified language.
*
* @param { string } locale - the origin locale or language code. It must be a valid locale.
* @returns { string } 3 letter language code.
* @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 12
*/
static getThreeLetterLanguage(locale: string): string;
/**
* Get a three-letter abbreviation of the specified region.
*
* @param { string } locale - the origin locale or region code. It must be a valid locale.
* @returns { string } 3 letter region code.
* @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 12
*/
static getThreeLetterRegion(locale: string): string;
}
/**
* Provides the options of unit.
*
* @interface UnitInfo
* @syscap SystemCapability.Global.I18n
* @since 8
*/
/**
* Provides the options of unit.
*
* @interface UnitInfo
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
export interface UnitInfo {
/**
* Unit name.
*
* @syscap SystemCapability.Global.I18n
* @since 8
*/
/**
* Unit name.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
unit: string;
/**
* The measurement system of the unit.
*
* @syscap SystemCapability.Global.I18n
* @since 8
*/
/**
* The measurement system of the unit.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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
*/
/**
* Provides the options of PhoneNumberFormat.
*
* @interface PhoneNumberFormatOptions
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* Indicates the type to format phone number.
*
* @type { ?string }
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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 12
*/
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
*/
/**
* set the date.
*
* @param { Date } date - Date object used to set the time and date.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* set the time.
*
* @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* Set the timezone of this calendar.
*
* @param { string } timezone - The id of a timezone.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* Get the timezone id of this calendar instance.
*
* @returns { string } the timezone id of this calendar.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
getDisplayName(locale: string): string;
/**
* 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* Get the UTC milliseconds.
*
* @returns { number } the calendar time as UTC milliseconds.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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 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
* @atomicservice
* @since 12
*/
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 12
*/
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 current position of the BreakIterator instance.
*
* @returns { number } the current position of the BreakIterator instance.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* Set the text to be processed.
*
* @param { string } text - Indicates the text to be processed by the BreakIterator.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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 being processed.
*
* @returns { string } the text that is processed by the BreakIterator.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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 12
*/
export class IndexUtil {
/**
* Get a list of labels for use as a UI index
*
* @returns { Array<string> } a list of labels
* @syscap SystemCapability.Global.I18n
* @since 8
*/
/**
* Get a list of labels for use as a UI index
*
* @returns { Array<string> } a list of labels
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
getIndexList(): Array<string>;
/**
* 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* Get corresponding index of the input text.
*
* @param { string } text - input text
* @returns { string } index of the input text
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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 8
* @deprecated since 9
* @useinstead Unicode
*/
export class Character {
/**
* 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 8
* @deprecated since 9
* @useinstead Unicode.isDigit
*/
isDigit(char: 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 8
* @deprecated since 9
* @useinstead Unicode.isSpaceChar
*/
isSpaceChar(char: 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 8
* @deprecated since 9
* @useinstead Unicode.isWhitespace
*/
isWhitespace(char: 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 8
* @deprecated since 9
* @useinstead Unicode.isRTL
*/
isRTL(char: 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 8
* @deprecated since 9
* @useinstead Unicode.isIdeograph
*/
isIdeograph(char: 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 8
* @deprecated since 9
* @useinstead Unicode.isLetter
*/
isLetter(char: 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 8
* @deprecated since 9
* @useinstead Unicode.isLowerCase
*/
isLowerCase(char: 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 8
* @deprecated since 9
* @useinstead Unicode.isUpperCase
*/
isUpperCase(char: 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 8
* @deprecated since 9
* @useinstead Unicode.getType
*/
getType(char: 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 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isDigit(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isSpaceChar(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isWhitespace(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isRTL(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isIdeograph(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isLetter(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isLowerCase(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static isUpperCase(char: 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
static getType(char: string): string;
}
/**
* check out whether system is 24-hour system.
*
* @returns { boolean } a boolean represent whether system is 24-hour system.
* @syscap SystemCapability.Global.I18n
* @since 7
* @deprecated since 9
* @useinstead ohos.i18n/i18n.System#is24HourClock
*/
export function is24HourClock(): boolean;
/**
* set 24-hour system.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { boolean } option - represent the boolean to be set.
* @returns { boolean } a boolean represent whether setting 24-hour system success.
* @syscap SystemCapability.Global.I18n
* @since 7
* @deprecated since 9
* @useinstead ohos.i18n/i18n.System#set24HourClock
*/
export function set24HourClock(option: boolean): boolean;
/**
* Add one language to preferred language List.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { string } language - the language to be added.
* @param { number } [index] - the position of preferred language list to be inserted.
* @returns { boolean } a boolean represent whether language added success.
* @syscap SystemCapability.Global.I18n
* @since 8
* @deprecated since 9
* @useinstead ohos.i18n/i18n.System#addPreferredLanguage
*/
export function addPreferredLanguage(language: string, index?: number): boolean;
/**
* Remove one language from preferred language list.
*
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { number } index - the position of removed language in preferred language list.
* @returns { boolean } a boolean represent whether removed success.
* @syscap SystemCapability.Global.I18n
* @since 8
* @deprecated since 9
* @useinstead ohos.i18n/i18n.System#removePreferredLanguage
*/
export function removePreferredLanguage(index: number): boolean;
/**
* Access the system preferred language list.
*
* @returns { Array<string> } a string Array represent the preferred language list.
* @syscap SystemCapability.Global.I18n
* @since 8
* @deprecated since 9
* @useinstead ohos.i18n/i18n.System#getPreferredLanguageList
*/
export function getPreferredLanguageList(): Array<string>;
/**
* Get the first preferred language of system.
*
* @returns { string } a string represent the first preferred language of system.
* @syscap SystemCapability.Global.I18n
* @since 8
* @deprecated since 9
* @useinstead ohos.i18n/i18n.System#getFirstPreferredLanguage
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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 12
*/
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
*/
/**
* Get the id of the TimeZone object.
*
* @returns { string } a string represents the timezone id.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* Get the raw offset of the TimeZone object.
*
* @returns { number } a number represents the raw offset.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
getOffset(date?: number): number;
/**
* Get available TimeZone ID list.
*
* @returns { Array<string> } a string array represents the available TimeZone ID list.
* @syscap SystemCapability.Global.I18n
* @since 9
*/
/**
* Get available TimeZone ID list.
*
* @returns { Array<string> } a string array represents the available TimeZone ID list.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @since 10
*/
/**
* Get available TimeZone ID list.
*
* @returns { Array<string> } a string array represents the available TimeZone ID list.
* @syscap SystemCapability.Global.I18n
* @crossplatform
* @atomicservice
* @since 12
*/
static getAvailableIDs(): Array<string>;
/**
* Get available Zone City ID list.
*
* @returns { Array<string> } a string array represents the available Zone City ID list.
* @syscap SystemCapability.Global.I18n
* @since 9
*/
/**
* Get available Zone City ID list.
*
* @returns { Array<string> } a string array represents the available Zone City ID list.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
static getAvailableZoneCityIDs(): Array<string>;
/**
* 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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* Get TimeZone Object from city ID.
*
* @param { string } cityID - Zone City ID.
* @returns { TimeZone } a TimeZone Object from city ID.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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<TimeZone> } 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
*/
/**
* Get the possible time zones from the specified longitude and latitude.
*
* @param { number } longitude value
* @param { number } latitude value
* @returns { Array<TimeZone> } 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
* @atomicservice
* @since 12
*/
static getTimezonesByLocation(longitude: number, latitude: number): Array<TimeZone>;
}
/**
* 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 12
*/
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
*/
/**
* Get a string array of all available transliterator ids.
*
* @returns { string[] } a string array of all available transliterator ids.
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
transform(text: string): string;
}
/**
* Enumerates the Normalizer modes.
*
* @enum { number }
* @syscap SystemCapability.Global.I18n
* @since 10
*/
/**
* Enumerates the Normalizer modes.
*
* @enum { number }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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 12
*/
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 12
*/
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 12
*/
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 12
*/
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 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
normalize(text: string): string;
}
/**
* Enumerates the locale suggestion type modes.
*
* @enum { number }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
export enum SuggestionType {
/**
* No correlation between language and region.
*
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
SUGGESTION_TYPE_NONE = 0,
/**
* The language related to the specified region
*
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
SUGGESTION_TYPE_RELATED = 1,
/**
* The region is SIM card region.
*
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
SUGGESTION_TYPE_SIM = 2,
}
/**
* Provides the options which is used to sort the locales.
*
* @interface SortOptions
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
export interface SortOptions {
/**
* Locale code.
*
* @type { ?string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
locale?: string;
/**
* Whether to use local names for sorting
*
* @type { ?boolean }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
isUseLocalName?: boolean;
/**
* Whether to put the suggested item at the top
*
* @type { ?boolean }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
isSuggestedFirst?: boolean;
}
/**
* Provide information for a language or region
*
* @interface LocaleItem
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
export interface LocaleItem {
/**
* language or region id.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
id: string;
/**
* The suggestion type of the language or region.
*
* @type { SuggestionType }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
suggestionType: SuggestionType;
/**
* The display name of the language or region in specified language
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
displayName: string;
/**
* The display name of the language or region in local language
* @type { ?string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
localName?: string;
}
/**
* Provides the informations of one time zone city.
*
* @interface TimeZoneCityItem
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
export interface TimeZoneCityItem {
/**
* Time zone id.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
zoneId: string;
/**
* City id.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
cityId: string;
/**
* The display name of the city.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
cityDisplayName: string;
/**
* The time zone offset for the city.
* @type { number }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
offset: number;
/**
* The display name of the time zone for the city.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
zoneDisplayName: string;
/**
* The time zone raw offset for the city.
* @type { ?number }
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
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 10
*/
export class SystemLocaleManager {
/**
* A constructor used to create a SystemLocaleManager object.
*
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
constructor();
/**
* Obtains sorted language array for setting or startup guide app.
*
* @param { Array<string> } languages - The languages whose name will be sorted and displayed.
* @param { SortOptions } options - Sort options for locale item.
* @returns { Array<LocaleItem> } 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 sorted language array for setting or startup guide app.
*
* @param { Array<string> } languages - The languages whose name will be sorted and displayed.
* @param { SortOptions } options - Sort options for locale item.
* @returns { Array<LocaleItem> } Locale Informations sorted for specified options.
* @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 12
*/
getLanguageInfoArray(languages: Array<string>, options?: SortOptions): Array<LocaleItem>;
/**
* Obtains sorted region array for setting or startup guide app.
*
* @param { Array<string> } regions - The regions whose name will be sorted and displayed.
* @param { SortOptions } options - Sort options for locale item.
* @returns { Array<LocaleItem> } 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 sorted region array for setting or startup guide app.
*
* @param { Array<string> } regions - The regions whose name will be sorted and displayed.
* @param { SortOptions } options - Sort options for locale item.
* @returns { Array<LocaleItem> } Locale Informations sorted for specified options.
* @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 12
*/
getRegionInfoArray(regions: Array<string>, options?: SortOptions): Array<LocaleItem>;
/**
* Obtains sorted time zone city info array for showing time zone list
*
* @returns { Array<TimeZoneCityItem> } Time zone city information sorted by city name.
* @syscap SystemCapability.Global.I18n
* @systemapi Hide this for inner system use.
* @since 10
*/
/**
* Obtains sorted time zone city info array for showing time zone list
*
* @returns { Array<TimeZoneCityItem> } Time zone city information sorted by city name.
* @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 12
*/
static getTimeZoneCityItemArray(): Array<TimeZoneCityItem>;
}
/**
* Provides the informations of one holiday.
*
* @interface HolidayInfoItem
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Provides the informations of one holiday.
*
* @interface HolidayInfoItem
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
export interface HolidayInfoItem {
/**
* Holiday base name.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Holiday base name.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
baseName: string;
/**
* Holiday start year.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Holiday start year.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
year: number;
/**
* Holiday start month.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Holiday start month.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
month: number;
/**
* Holiday start day.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Holiday start day.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
day: number;
/**
* Holiday local name array.
*
* @type { ?Array<HolidayLocalName> }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Holiday local name array.
*
* @type { ?Array<HolidayLocalName> }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
localNames?: Array<HolidayLocalName>;
}
/**
* Provides the informations holiday locale name.
*
* @interface HolidayLocalName
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Provides the informations holiday locale name.
*
* @interface HolidayLocalName
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
export interface HolidayLocalName {
/**
* Holiday locale name language id.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Holiday locale name language id.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
language: string;
/**
* Holiday local name.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Holiday local name.
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
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<HolidayInfoItem> } 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 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<HolidayInfoItem> } 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
* @atomicservice
* @since 12
*/
getHolidayInfoItemArray(year?: number): Array<HolidayInfoItem>;
}
/**
* Provides the informations of one entity.
*
* @interface EntityInfoItem
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Provides the informations of one entity.
*
* @interface EntityInfoItem
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
export interface EntityInfoItem {
/**
* Entity begin position.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Entity begin position.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
begin: number;
/**
* Entity end position.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Entity end position.
*
* @type { number }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
end: number;
/**
* Entity type. Field values such as phone_number, date
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @since 11
*/
/**
* Entity type. Field values such as phone_number, date
*
* @type { string }
* @syscap SystemCapability.Global.I18n
* @atomicservice
* @since 12
*/
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 12
*/
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
*/
/**
* 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
* @atomicservice
* @since 12
*/
constructor(locale?: string);
/**
* Obtains holiday info array for a specified text
*
* @param { string } text - the text to find entities.
* @returns { Array<EntityInfoItem> } 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 holiday info array for a specified text
*
* @param { string } text - the text to find entities.
* @returns { Array<EntityInfoItem> } 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
* @atomicservice
* @since 12
*/
findEntityInfo(text: string): Array<EntityInfoItem>;
}
}
export default i18n;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

Search