1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit LocalizationKit 19 */ 20 21import { BusinessError } from './@ohos.base'; 22import intl from '@ohos.intl'; 23 24/** 25 * Provides international settings related APIs. 26 * 27 * @namespace i18n 28 * @syscap SystemCapability.Global.I18n 29 * @since 7 30 */ 31/** 32 * Provides international settings related APIs. 33 * 34 * @namespace i18n 35 * @syscap SystemCapability.Global.I18n 36 * @crossplatform 37 * @form 38 * @atomicservice 39 * @since 11 40 */ 41declare namespace i18n { 42 /** 43 * Obtains the country or region name localized for display on a given locale. 44 * 45 * @param { string } country - The locale whose country or region name will be displayed. 46 * @param { string } locale - The locale used to display the country or region. 47 * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. 48 * @returns { string } the country or region name localized for display on a given locale. 49 * @syscap SystemCapability.Global.I18n 50 * @since 7 51 * @deprecated since 9 52 * @useinstead ohos.System.getDisplayCountry 53 */ 54 export function getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; 55 56 /** 57 * Obtains the language name localized for display on a given locale. 58 * 59 * @param { string } language - The locale whose language name will be displayed. 60 * @param { string } locale - The locale used to display the language. 61 * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. 62 * @returns { string } the language name localized for display on a given locale. 63 * @syscap SystemCapability.Global.I18n 64 * @since 7 65 * @deprecated since 9 66 * @useinstead ohos.System.getDisplayLanguage 67 */ 68 export function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; 69 70 /** 71 * Obtains the language currently used by the system. 72 * 73 * @returns { string } the language currently used by the system. 74 * @syscap SystemCapability.Global.I18n 75 * @since 7 76 * @deprecated since 9 77 * @useinstead ohos.System.getSystemLanguage 78 */ 79 export function getSystemLanguage(): string; 80 81 /** 82 * Obtains the region currently used by the system. 83 * 84 * @returns { string } the region currently used by the system. 85 * @syscap SystemCapability.Global.I18n 86 * @since 7 87 * @deprecated since 9 88 * @useinstead ohos.System.getSystemRegion 89 */ 90 export function getSystemRegion(): string; 91 92 /** 93 * Obtains the locale currently used by the system. 94 * 95 * @returns { string } the locale currently used by the system. 96 * @syscap SystemCapability.Global.I18n 97 * @since 7 98 * @deprecated since 9 99 * @useinstead ohos.System.getSystemLocale 100 */ 101 export function getSystemLocale(): string; 102 103 /** 104 * Provides system functions. 105 * 106 * @syscap SystemCapability.Global.I18n 107 * @since 9 108 */ 109 /** 110 * Provides system functions. 111 * 112 * @syscap SystemCapability.Global.I18n 113 * @crossplatform 114 * @since 10 115 */ 116 /** 117 * Provides system functions. 118 * 119 * @syscap SystemCapability.Global.I18n 120 * @crossplatform 121 * @form 122 * @atomicservice 123 * @since 11 124 */ 125 export class System { 126 /** 127 * Obtains the country or region name localized for display on a given locale. 128 * 129 * @param { string } country - The locale whose country or region name will be displayed. 130 * @param { string } locale - The locale used to display the country or region. 131 * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. 132 * @returns { string } the country or region name localized for display on a given locale. 133 * @throws { BusinessError } 401 - check param failed 134 * @throws { BusinessError } 890001 - param value not valid 135 * @syscap SystemCapability.Global.I18n 136 * @since 9 137 */ 138 /** 139 * Obtains the country or region name localized for display on a given locale. 140 * 141 * @param { string } country - The locale whose country or region name will be displayed. It must be a valid country. 142 * @param { string } locale - The locale used to display the country or region. It must be a valid locale. 143 * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. 144 * @returns { string } the country or region name localized for display on a given locale. 145 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 146 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 147 * @syscap SystemCapability.Global.I18n 148 * @crossplatform 149 * @since 10 150 */ 151 /** 152 * Obtains the country or region name localized for display on a given locale. 153 * 154 * @param { string } country - The locale whose country or region name will be displayed. It must be a valid country. 155 * @param { string } locale - The locale used to display the country or region. It must be a valid locale. 156 * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. 157 * @returns { string } the country or region name localized for display on a given locale. 158 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 159 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 160 * @syscap SystemCapability.Global.I18n 161 * @crossplatform 162 * @atomicservice 163 * @since 12 164 */ 165 static getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; 166 167 /** 168 * Obtains the language name localized for display on a given locale. 169 * 170 * @param { string } language - The locale whose language name will be displayed. 171 * @param { string } locale - The locale used to display the language. 172 * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. 173 * @returns { string } the language name localized for display on a given locale. 174 * @throws { BusinessError } 401 - check param failed 175 * @throws { BusinessError } 890001 - param value not valid 176 * @syscap SystemCapability.Global.I18n 177 * @since 9 178 */ 179 /** 180 * Obtains the language name localized for display on a given locale. 181 * 182 * @param { string } language - The locale whose language name will be displayed. 183 * @param { string } locale - The locale used to display the language. 184 * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. 185 * @returns { string } the language name localized for display on a given locale. 186 * @throws { BusinessError } 401 - check param failed 187 * @throws { BusinessError } 890001 - param value not valid 188 * @syscap SystemCapability.Global.I18n 189 * @crossplatform 190 * @since 10 191 */ 192 /** 193 * Obtains the language name localized for display on a given locale. 194 * 195 * @param { string } language - The locale whose language name will be displayed. It must be a valid language. 196 * @param { string } locale - The locale used to display the language. It must be a valid locale. 197 * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. 198 * @returns { string } the language name localized for display on a given locale. 199 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 200 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 201 * @syscap SystemCapability.Global.I18n 202 * @crossplatform 203 * @atomicservice 204 * @since 11 205 */ 206 static getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; 207 208 /** 209 * Obtains all languages supported by the system. 210 * 211 * @returns { Array<string> } all languages supported by the system. 212 * @syscap SystemCapability.Global.I18n 213 * @since 9 214 */ 215 /** 216 * Obtains all languages supported by the system. 217 * 218 * @returns { Array<string> } all languages supported by the system. 219 * @syscap SystemCapability.Global.I18n 220 * @atomicservice 221 * @since 12 222 */ 223 static getSystemLanguages(): Array<string>; 224 225 /** 226 * Obtains all regions supported by the system in the language. 227 * 228 * @param { string } language - The language used to get the list of regions. It must be a valid language. 229 * @returns { Array<string> } all countries or regions supported by the system in the language. 230 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 231 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 232 * @syscap SystemCapability.Global.I18n 233 * @since 9 234 */ 235 /** 236 * Obtains all regions supported by the system in the language. 237 * 238 * @param { string } language - The language used to get the list of regions. It must be a valid language. 239 * @returns { Array<string> } all countries or regions supported by the system in the language. 240 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 241 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 242 * @syscap SystemCapability.Global.I18n 243 * @atomicservice 244 * @since 12 245 */ 246 static getSystemCountries(language: string): Array<string>; 247 248 /** 249 * Determine whether the current language or region is recommended. 250 * 251 * @param { string } language - The language code. It must be a valid language. 252 * @param { string } [region] - The region code. It must be a valid region. 253 * @returns { boolean } whether the current language or region is recommended. 254 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 255 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 256 * @syscap SystemCapability.Global.I18n 257 * @since 9 258 */ 259 /** 260 * Determine whether the current language or region is recommended. 261 * 262 * @param { string } language - The language code. It must be a valid language. 263 * @param { string } [region] - The region code. It must be a valid region. 264 * @returns { boolean } whether the current language or region is recommended. 265 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 266 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 267 * @syscap SystemCapability.Global.I18n 268 * @atomicservice 269 * @since 12 270 */ 271 static isSuggested(language: string, region?: string): boolean; 272 273 /** 274 * Obtains the language currently used by the system. 275 * 276 * @returns { string } the language currently used by the system. 277 * @syscap SystemCapability.Global.I18n 278 * @since 9 279 */ 280 /** 281 * Obtains the language currently used by the system. 282 * 283 * @returns { string } the language currently used by the system. 284 * @syscap SystemCapability.Global.I18n 285 * @crossplatform 286 * @since 10 287 */ 288 /** 289 * Obtains the language currently used by the system. 290 * 291 * @returns { string } the language currently used by the system. 292 * @syscap SystemCapability.Global.I18n 293 * @crossplatform 294 * @form 295 * @atomicservice 296 * @since 11 297 */ 298 static getSystemLanguage(): string; 299 300 /** 301 * Set the language currently used by the system. 302 * 303 * @permission ohos.permission.UPDATE_CONFIGURATION 304 * @param { string } language - The language to be used. It must be a valid language. 305 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 306 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 307 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 308 * @syscap SystemCapability.Global.I18n 309 * @systemapi Hide this for inner system use. 310 * @since 9 311 */ 312 static setSystemLanguage(language: string): void; 313 314 /** 315 * Obtains the region currently used by the system. 316 * 317 * @returns { string } the region currently used by the system. 318 * @syscap SystemCapability.Global.I18n 319 * @since 9 320 */ 321 /** 322 * Obtains the region currently used by the system. 323 * 324 * @returns { string } the region currently used by the system. 325 * @syscap SystemCapability.Global.I18n 326 * @crossplatform 327 * @since 10 328 */ 329 /** 330 * Obtains the region currently used by the system. 331 * 332 * @returns { string } the region currently used by the system. 333 * @syscap SystemCapability.Global.I18n 334 * @crossplatform 335 * @atomicservice 336 * @since 12 337 */ 338 static getSystemRegion(): string; 339 340 /** 341 * Set the region currently used by the system. 342 * 343 * @permission ohos.permission.UPDATE_CONFIGURATION 344 * @param { string } region - The region to be used. It must be a valid region. 345 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 346 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 347 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 348 * @syscap SystemCapability.Global.I18n 349 * @systemapi Hide this for inner system use. 350 * @since 9 351 */ 352 static setSystemRegion(region: string): void; 353 354 /** 355 * Obtains the locale currently used by the system. 356 * 357 * @returns { string } the locale currently used by the system. 358 * @syscap SystemCapability.Global.I18n 359 * @since 9 360 */ 361 /** 362 * Obtains the locale currently used by the system. 363 * 364 * @returns { string } the locale currently used by the system. 365 * @syscap SystemCapability.Global.I18n 366 * @crossplatform 367 * @since 10 368 */ 369 /** 370 * Obtains the locale currently used by the system. 371 * 372 * @returns { string } the locale currently used by the system. 373 * @syscap SystemCapability.Global.I18n 374 * @crossplatform 375 * @atomicservice 376 * @since 11 377 */ 378 static getSystemLocale(): string; 379 380 /** 381 * Set the locale currently used by the system. 382 * 383 * @permission ohos.permission.UPDATE_CONFIGURATION 384 * @param { string } locale - The locale to be used. It must be a valid locale. 385 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 386 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 387 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 388 * @syscap SystemCapability.Global.I18n 389 * @systemapi Hide this for inner system use. 390 * @since 9 391 */ 392 static setSystemLocale(locale: string): void; 393 394 /** 395 * Check out whether system is 24-hour system. 396 * 397 * @returns { boolean } a boolean represent whether system is 24-hour system. 398 * @syscap SystemCapability.Global.I18n 399 * @since 9 400 */ 401 /** 402 * Check out whether system is 24-hour system. 403 * 404 * @returns { boolean } a boolean represent whether system is 24-hour system. 405 * @syscap SystemCapability.Global.I18n 406 * @crossplatform 407 * @since 10 408 */ 409 /** 410 * Check out whether system is 24-hour system. 411 * 412 * @returns { boolean } a boolean represent whether system is 24-hour system. 413 * @syscap SystemCapability.Global.I18n 414 * @crossplatform 415 * @form 416 * @since 11 417 */ 418 /** 419 * Check out whether system is 24-hour system. 420 * 421 * @returns { boolean } a boolean represent whether system is 24-hour system. 422 * @syscap SystemCapability.Global.I18n 423 * @crossplatform 424 * @form 425 * @atomicservice 426 * @since 12 427 */ 428 static is24HourClock(): boolean; 429 430 /** 431 * Set 24-hour system. 432 * 433 * @permission ohos.permission.UPDATE_CONFIGURATION 434 * @param { boolean } option - represent the boolean to be set. 435 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 436 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 437 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 438 * @syscap SystemCapability.Global.I18n 439 * @systemapi Hide this for inner system use. 440 * @since 9 441 */ 442 static set24HourClock(option: boolean): void; 443 444 /** 445 * Add one language to preferred language List. 446 * 447 * @permission ohos.permission.UPDATE_CONFIGURATION 448 * @param { string } language - the language to be added. It must be a valid language. 449 * @param { number } [index] - the position of preferred language list to be inserted. 450 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 451 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 452 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 453 * @syscap SystemCapability.Global.I18n 454 * @systemapi Hide this for inner system use. 455 * @since 9 456 */ 457 static addPreferredLanguage(language: string, index?: number): void; 458 459 /** 460 * Remove one language from preferred language list. 461 * 462 * @permission ohos.permission.UPDATE_CONFIGURATION 463 * @param { number } index - the position of removed language in preferred language list. 464 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 465 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 466 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 467 * @syscap SystemCapability.Global.I18n 468 * @systemapi Hide this for inner system use. 469 * @since 9 470 */ 471 static removePreferredLanguage(index: number): void; 472 473 /** 474 * Access the system preferred language list. 475 * 476 * @returns { Array<string> } a string Array represent the preferred language list. 477 * @syscap SystemCapability.Global.I18n 478 * @since 9 479 */ 480 /** 481 * Access the system preferred language list. 482 * 483 * @returns { Array<string> } a string Array represent the preferred language list. 484 * @syscap SystemCapability.Global.I18n 485 * @atomicservice 486 * @since 12 487 */ 488 static getPreferredLanguageList(): Array<string>; 489 490 /** 491 * Get the first preferred language of system. 492 * 493 * @returns { string } a string represent the first preferred language of system. 494 * @syscap SystemCapability.Global.I18n 495 * @since 9 496 */ 497 /** 498 * Get the first preferred language of system. 499 * 500 * @returns { string } a string represent the first preferred language of system. 501 * @syscap SystemCapability.Global.I18n 502 * @atomicservice 503 * @since 12 504 */ 505 static getFirstPreferredLanguage(): string; 506 507 /** 508 * Set the preferred language of App. 509 * 510 * @param { string } language - the language to be set. It must be a valid language. 511 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 512 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 513 * @syscap SystemCapability.Global.I18n 514 * @since 11 515 */ 516 /** 517 * Set the preferred language of App. 518 * 519 * @param { string } language - the language to be set. It must be a valid language. 520 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 521 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 522 * @syscap SystemCapability.Global.I18n 523 * @atomicservice 524 * @since 12 525 */ 526 static setAppPreferredLanguage(language: string): void; 527 528 /** 529 * Get the preferred language of App. 530 * 531 * @returns { string } a string represent the preferred language of App. 532 * @syscap SystemCapability.Global.I18n 533 * @since 9 534 */ 535 /** 536 * Get the preferred language of App. 537 * 538 * @returns { string } a string represent the preferred language of App. 539 * @syscap SystemCapability.Global.I18n 540 * @atomicservice 541 * @since 12 542 */ 543 static getAppPreferredLanguage(): string; 544 545 /** 546 * Set whether to use local digit. 547 * 548 * @permission ohos.permission.UPDATE_CONFIGURATION 549 * @param { boolean } flag - a boolean variable represents whether to use local digit 550 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 551 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 552 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 553 * @syscap SystemCapability.Global.I18n 554 * @systemapi Hide this for inner system use. 555 * @since 9 556 */ 557 static setUsingLocalDigit(flag: boolean): void; 558 559 /** 560 * Get whether to use local digit. 561 * 562 * @returns { boolean } a boolean represents whether to use local digit. 563 * @syscap SystemCapability.Global.I18n 564 * @since 9 565 */ 566 /** 567 * Get whether to use local digit. 568 * 569 * @returns { boolean } a boolean represents whether to use local digit. 570 * @syscap SystemCapability.Global.I18n 571 * @atomicservice 572 * @since 12 573 */ 574 static getUsingLocalDigit(): boolean; 575 576 /** 577 * Gets the equivalent simplest representation of input language id. 578 * When no parameter is passed in, current system language's simplest representation will be returned. 579 * If current system language is a dialect language, then system language's simplest representation will be returned; 580 * If current system language is not a dialect language, but it has a dialect language which is supported by system, 581 * then the dialect language's simplest representation will be returned; 582 * If current system language is not a dialect language, and it doesn't have a dialect language which is supported by system, 583 * then the system language's simplest representation will be returned; 584 * 585 * @param { string } [language] - The language code. It must be a valid language. 586 * @returns { string } The equivalent simplest representation of language. 587 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 588 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 589 * @syscap SystemCapability.Global.I18n 590 * @atomicservice 591 * @since 15 592 */ 593 static getSimplifiedLanguage(language?: string): string; 594 595 /** 596 * Set user's preferrence for temperature type. 597 * 598 * @permission ohos.permission.UPDATE_CONFIGURATION 599 * @param { TemperatureType } type - Indicates a temperature type. 600 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 601 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 602 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 603 * @syscap SystemCapability.Global.I18n 604 * @systemapi Hide this for inner system use. 605 * @since 18 606 */ 607 static setTemperatureType(type: TemperatureType): void; 608 609 /** 610 * Get user's preferrence for temperature type. 611 * 612 * @returns { TemperatureType } temperature type. 613 * @syscap SystemCapability.Global.I18n 614 * @atomicservice 615 * @since 18 616 */ 617 static getTemperatureType(): TemperatureType; 618 619 /** 620 * Get temperature name by TemperatureType. 621 * 622 * @param { TemperatureType } type - Indicates a temperature type. 623 * @returns { string } temperature name. 624 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 625 * @syscap SystemCapability.Global.I18n 626 * @atomicservice 627 * @since 18 628 */ 629 static getTemperatureName(type: TemperatureType): string; 630 631 /** 632 * Set user's preferrence for first day of week. 633 * 634 * @permission ohos.permission.UPDATE_CONFIGURATION 635 * @param { WeekDay } type - one of week days. 636 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 637 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 638 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 639 * @syscap SystemCapability.Global.I18n 640 * @systemapi Hide this for inner system use. 641 * @since 18 642 */ 643 static setFirstDayOfWeek(type: WeekDay): void; 644 645 /** 646 * Get user's preferrence for first day of week. 647 * 648 * @returns { WeekDay } one of week days. 649 * @syscap SystemCapability.Global.I18n 650 * @atomicservice 651 * @since 18 652 */ 653 static getFirstDayOfWeek(): WeekDay; 654 } 655 656 /** 657 * Enumerates the week day. 658 * 659 * @enum { number } 660 * @syscap SystemCapability.Global.I18n 661 * @atomicservice 662 * @since 18 663 */ 664 export enum WeekDay { 665 /** 666 * Indicates Monday. 667 * 668 * @syscap SystemCapability.Global.I18n 669 * @atomicservice 670 * @since 18 671 */ 672 MON = 1, 673 674 /** 675 * Indicates Tuesday. 676 * 677 * @syscap SystemCapability.Global.I18n 678 * @atomicservice 679 * @since 18 680 */ 681 TUE = 2, 682 683 /** 684 * Indicates Wednesday. 685 * 686 * @syscap SystemCapability.Global.I18n 687 * @atomicservice 688 * @since 18 689 */ 690 WED = 3, 691 692 /** 693 * Indicates Thursday. 694 * 695 * @syscap SystemCapability.Global.I18n 696 * @atomicservice 697 * @since 18 698 */ 699 THU = 4, 700 701 /** 702 * Indicates Friday. 703 * 704 * @syscap SystemCapability.Global.I18n 705 * @atomicservice 706 * @since 18 707 */ 708 FRI = 5, 709 710 /** 711 * Indicates Saturday. 712 * 713 * @syscap SystemCapability.Global.I18n 714 * @atomicservice 715 * @since 18 716 */ 717 SAT = 6, 718 719 /** 720 * Indicates Sunday. 721 * 722 * @syscap SystemCapability.Global.I18n 723 * @atomicservice 724 * @since 18 725 */ 726 SUN = 7 727 } 728 729 /** 730 * Enumerates the temperature types. 731 * 732 * @enum { number } 733 * @syscap SystemCapability.Global.I18n 734 * @atomicservice 735 * @since 18 736 */ 737 export enum TemperatureType { 738 /** 739 * Celesius temperature type. 740 * 741 * @syscap SystemCapability.Global.I18n 742 * @atomicservice 743 * @since 18 744 */ 745 CELSIUS = 1, 746 747 /** 748 * Fahrenheit temperature type. 749 * 750 * @syscap SystemCapability.Global.I18n 751 * @atomicservice 752 * @since 18 753 */ 754 FAHRENHEIT = 2, 755 756 /** 757 * Kelvin temperature type. 758 * 759 * @syscap SystemCapability.Global.I18n 760 * @atomicservice 761 * @since 18 762 */ 763 KELVIN = 3 764 } 765 766 /** 767 * Provides util functions. 768 * 769 * @interface Util 770 * @syscap SystemCapability.Global.I18n 771 * @since 8 772 * @deprecated since 9 773 * @useinstead ohos.i18n/i18n.I18NUtil 774 */ 775 export interface Util { 776 /** 777 * Convert from unit to unit and format according to the locale. 778 * 779 * @param { UnitInfo } fromUnit - Information of the unit to be converted. 780 * @param { UnitInfo } toUnit - Information about the unit to be converted to. 781 * @param { number } value - Indicates the number to be formatted. 782 * @param { string } locale - The locale to be used. 783 * @param { string } [style] - The style of format. 784 * @returns { string } converted number and unit. 785 * @syscap SystemCapability.Global.I18n 786 * @since 8 787 * @deprecated since 9 788 * @useinstead ohos.i18n/i18n.I18NUtil#unitConvert 789 */ 790 unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string; 791 } 792 793 /** 794 * Provides util functions. 795 * 796 * @syscap SystemCapability.Global.I18n 797 * @since 9 798 */ 799 /** 800 * Provides util functions. 801 * 802 * @syscap SystemCapability.Global.I18n 803 * @crossplatform 804 * @since 10 805 */ 806 /** 807 * Provides util functions. 808 * 809 * @syscap SystemCapability.Global.I18n 810 * @crossplatform 811 * @atomicservice 812 * @since 12 813 */ 814 export class I18NUtil { 815 /** 816 * Convert from unit to unit and format according to the locale. 817 * 818 * @param { UnitInfo } fromUnit - Information of the unit to be converted. 819 * @param { UnitInfo } toUnit - Information about the unit to be converted to. 820 * @param { number } value - Indicates the number to be formatted. 821 * @param { string } locale - The locale to be used. 822 * @param { string } [style] - The style of format. 823 * @returns { string } converted number and unit. 824 * @syscap SystemCapability.Global.I18n 825 * @since 9 826 */ 827 /** 828 * Convert from unit to unit and format according to the locale. 829 * 830 * @param { UnitInfo } fromUnit - Information of the unit to be converted. 831 * @param { UnitInfo } toUnit - Information about the unit to be converted to. 832 * @param { number } value - Indicates the number to be formatted. 833 * @param { string } locale - The locale to be used. 834 * @param { string } [style] - The style of format. 835 * @returns { string } converted number and unit. 836 * @syscap SystemCapability.Global.I18n 837 * @atomicservice 838 * @since 12 839 */ 840 static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string; 841 842 /** 843 * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. 844 * 'y' stands for year, 'L' stands for month, d stands for day. 845 * 846 * @param { string } locale - Information of the locale 847 * @returns { string } the string of 'y', 'L', 'd' joined by '-'. 848 * @syscap SystemCapability.Global.I18n 849 * @since 9 850 */ 851 /** 852 * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. 853 * 'y' stands for year, 'L' stands for month, d stands for day. 854 * 855 * @param { string } locale - Information of the locale. 856 * @returns { string } the string of 'y', 'L', 'd' joined by '-'. 857 * @syscap SystemCapability.Global.I18n 858 * @crossplatform 859 * @since 10 860 */ 861 /** 862 * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. 863 * 'y' stands for year, 'L' stands for month, d stands for day. 864 * 865 * @param { string } locale - Information of the locale. 866 * @returns { string } the string of 'y', 'L', 'd' joined by '-'. 867 * @syscap SystemCapability.Global.I18n 868 * @crossplatform 869 * @atomicservice 870 * @since 12 871 */ 872 static getDateOrder(locale: string): string; 873 874 /** 875 * Get the time period name for the specified hour. 876 * 877 * @param { number } hour - the hour value. 878 * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. 879 * @returns { string } the string of time period name. The return value may be empty string 880 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 881 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 882 * @syscap SystemCapability.Global.I18n 883 * @since 11 884 */ 885 /** 886 * Get the time period name for the specified hour. 887 * 888 * @param { number } hour - the hour value. 889 * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. 890 * @returns { string } the string of time period name. The return value may be empty string 891 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 892 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 893 * @syscap SystemCapability.Global.I18n 894 * @atomicservice 895 * @since 12 896 */ 897 static getTimePeriodName(hour:number, locale?: string): string; 898 899 /** 900 * Get the best matched locale in the specified list. 901 * 902 * @param { string } locale - the origin locale. It must be a valid locale. 903 * @param { string[] } localeList - a list of locales to be matched. It must be a valid locale. 904 * @returns { string } the string of the best matched locale name. 905 * The return value may be empty string due to none is matched. 906 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 907 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 908 * @static 909 * @syscap SystemCapability.Global.I18n 910 * @crossplatform 911 * @atomicservice 912 * @since 12 913 */ 914 static getBestMatchLocale(locale: string, localeList: string[]): string; 915 916 /** 917 * Get a three-letter abbreviation of the specified language. 918 * 919 * @param { string } locale - the origin locale or language code. It must be a valid locale. 920 * @returns { string } 3 letter language code. 921 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 922 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 923 * @static 924 * @syscap SystemCapability.Global.I18n 925 * @atomicservice 926 * @since 12 927 */ 928 static getThreeLetterLanguage(locale: string): string; 929 930 /** 931 * Get a three-letter abbreviation of the specified region. 932 * 933 * @param { string } locale - the origin locale or region code. It must be a valid locale. 934 * @returns { string } 3 letter region code. 935 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 936 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 937 * @static 938 * @syscap SystemCapability.Global.I18n 939 * @atomicservice 940 * @since 12 941 */ 942 static getThreeLetterRegion(locale: string): string; 943 944 /** 945 * Get the localized file path. 946 * Return the mirrored file path if the locale is RTL. Otherwise return the input file path. 947 * The default value of locale is current system locale. 948 * 949 * @param { string } path - the file path that needs to be localized. 950 * @param [ string ] delimiter - the file path's delimiter. 951 * @param [ intl.Locale ] locale - the locale object used to localized file path. 952 * @returns { string } the localized file path. 953 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 954 * @static 955 * @syscap SystemCapability.Global.I18n 956 * @atomicservice 957 * @since 18 958 */ 959 static getUnicodeWrappedFilePath(path: string, delimiter?: string, locale?: intl.Locale): string; 960 } 961 962 /** 963 * Provides the options of unit. 964 * 965 * @interface UnitInfo 966 * @syscap SystemCapability.Global.I18n 967 * @since 8 968 */ 969 /** 970 * Provides the options of unit. 971 * 972 * @interface UnitInfo 973 * @syscap SystemCapability.Global.I18n 974 * @atomicservice 975 * @since 12 976 */ 977 export interface UnitInfo { 978 /** 979 * Unit name. 980 * 981 * @syscap SystemCapability.Global.I18n 982 * @since 8 983 */ 984 /** 985 * Unit name. 986 * 987 * @type { string } 988 * @syscap SystemCapability.Global.I18n 989 * @atomicservice 990 * @since 12 991 */ 992 unit: string; 993 994 /** 995 * The measurement system of the unit. 996 * 997 * @syscap SystemCapability.Global.I18n 998 * @since 8 999 */ 1000 /** 1001 * The measurement system of the unit. 1002 * 1003 * @type { string } 1004 * @syscap SystemCapability.Global.I18n 1005 * @atomicservice 1006 * @since 12 1007 */ 1008 measureSystem: string; 1009 } 1010 1011 /** 1012 * Provides the options of PhoneNumberFormat. 1013 * 1014 * @interface PhoneNumberFormatOptions 1015 * @syscap SystemCapability.Global.I18n 1016 * @since 8 1017 */ 1018 /** 1019 * Provides the options of PhoneNumberFormat. 1020 * 1021 * @interface PhoneNumberFormatOptions 1022 * @syscap SystemCapability.Global.I18n 1023 * @crossplatform 1024 * @since 11 1025 */ 1026 /** 1027 * Provides the options of PhoneNumberFormat. 1028 * 1029 * @interface PhoneNumberFormatOptions 1030 * @syscap SystemCapability.Global.I18n 1031 * @crossplatform 1032 * @atomicservice 1033 * @since 12 1034 */ 1035 export interface PhoneNumberFormatOptions { 1036 /** 1037 * Indicates the type to format phone number. 1038 * 1039 * @type { string } 1040 * @syscap SystemCapability.Global.I18n 1041 * @since 8 1042 */ 1043 /** 1044 * Indicates the type to format phone number. 1045 * 1046 * @type { ?string } 1047 * @syscap SystemCapability.Global.I18n 1048 * @since 9 1049 */ 1050 /** 1051 * Indicates the type to format phone number. 1052 * 1053 * @type { ?string } 1054 * @syscap SystemCapability.Global.I18n 1055 * @crossplatform 1056 * @since 11 1057 */ 1058 /** 1059 * Indicates the type to format phone number. 1060 * 1061 * @type { ?string } 1062 * @syscap SystemCapability.Global.I18n 1063 * @crossplatform 1064 * @atomicservice 1065 * @since 12 1066 */ 1067 type?: string; 1068 } 1069 1070 /** 1071 * Provides the API for formatting phone number strings 1072 * 1073 * @syscap SystemCapability.Global.I18n 1074 * @since 8 1075 */ 1076 /** 1077 * Provides the API for formatting phone number strings 1078 * 1079 * @syscap SystemCapability.Global.I18n 1080 * @crossplatform 1081 * @since 11 1082 */ 1083 /** 1084 * Provides the API for formatting phone number strings 1085 * 1086 * @syscap SystemCapability.Global.I18n 1087 * @crossplatform 1088 * @atomicservice 1089 * @since 12 1090 */ 1091 export class PhoneNumberFormat { 1092 /** 1093 * A constructor used to create a PhoneNumberFormat object. 1094 * 1095 * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. 1096 * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". 1097 * @syscap SystemCapability.Global.I18n 1098 * @since 8 1099 */ 1100 /** 1101 * A constructor used to create a PhoneNumberFormat object. 1102 * 1103 * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. 1104 * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". 1105 * @syscap SystemCapability.Global.I18n 1106 * @crossplatform 1107 * @since 11 1108 */ 1109 /** 1110 * A constructor used to create a PhoneNumberFormat object. 1111 * 1112 * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. 1113 * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". 1114 * @syscap SystemCapability.Global.I18n 1115 * @crossplatform 1116 * @atomicservice 1117 * @since 12 1118 */ 1119 constructor(country: string, options?: PhoneNumberFormatOptions); 1120 1121 /** 1122 * Judge whether phone number is valid. 1123 * 1124 * @param { string } number - Indicates the input phone number. 1125 * @returns { boolean } a boolean indicates whether the input phone number is valid. 1126 * @syscap SystemCapability.Global.I18n 1127 * @since 8 1128 */ 1129 /** 1130 * Judge whether phone number is valid. 1131 * 1132 * @param { string } number - Indicates the input phone number. 1133 * @returns { boolean } a boolean indicates whether the input phone number is valid. 1134 * @syscap SystemCapability.Global.I18n 1135 * @crossplatform 1136 * @since 11 1137 */ 1138 /** 1139 * Judge whether phone number is valid. 1140 * 1141 * @param { string } number - Indicates the input phone number. 1142 * @returns { boolean } a boolean indicates whether the input phone number is valid. 1143 * @syscap SystemCapability.Global.I18n 1144 * @crossplatform 1145 * @atomicservice 1146 * @since 12 1147 */ 1148 isValidNumber(number: string): boolean; 1149 1150 /** 1151 * Obtains the formatted phone number strings of number. 1152 * 1153 * @param { string } number - Indicates the input phone number to be formatted. 1154 * @returns { string } the formatted phone number. 1155 * @syscap SystemCapability.Global.I18n 1156 * @since 8 1157 */ 1158 /** 1159 * Obtains the formatted phone number strings of number. 1160 * 1161 * @param { string } number - Indicates the input phone number to be formatted. 1162 * @returns { string } the formatted phone number. 1163 * @syscap SystemCapability.Global.I18n 1164 * @crossplatform 1165 * @since 11 1166 */ 1167 /** 1168 * Obtains the formatted phone number strings of number. 1169 * 1170 * @param { string } number - Indicates the input phone number to be formatted. 1171 * @returns { string } the formatted phone number. 1172 * @syscap SystemCapability.Global.I18n 1173 * @crossplatform 1174 * @atomicservice 1175 * @since 12 1176 */ 1177 format(number: string): string; 1178 1179 /** 1180 * Determine the location by phone number, and return it according to the specified regional language. 1181 * 1182 * @param { string } number - input phone number. 1183 * @param { string } locale - locale ID. 1184 * @returns { string } a string represents phone number's location. 1185 * @syscap SystemCapability.Global.I18n 1186 * @since 9 1187 */ 1188 /** 1189 * Determine the location by phone number, and return it according to the specified regional language. 1190 * 1191 * @param { string } number - input phone number. 1192 * @param { string } locale - locale ID. 1193 * @returns { string } a string represents phone number's location. 1194 * @syscap SystemCapability.Global.I18n 1195 * @atomicservice 1196 * @since 12 1197 */ 1198 getLocationName(number: string, locale: string): string; 1199 } 1200 1201 /** 1202 * Get a Calendar instance specified by locale and type. 1203 * 1204 * @param { string } locale - The locale used to get calendar. 1205 * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. 1206 * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, 1207 * japanese, persian. 1208 * @returns { Calendar } Calendar object 1209 * @syscap SystemCapability.Global.I18n 1210 * @since 8 1211 */ 1212 /** 1213 * Get a Calendar instance specified by locale and type. 1214 * 1215 * @param { string } locale - The locale used to get calendar. 1216 * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. 1217 * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, 1218 * japanese, persian. 1219 * @returns { Calendar } Calendar object 1220 * @syscap SystemCapability.Global.I18n 1221 * @crossplatform 1222 * @since 10 1223 */ 1224 /** 1225 * Get a Calendar instance specified by locale and type. 1226 * 1227 * @param { string } locale - The locale used to get calendar. 1228 * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. 1229 * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, 1230 * japanese, persian. 1231 * @returns { Calendar } Calendar object 1232 * @syscap SystemCapability.Global.I18n 1233 * @crossplatform 1234 * @atomicservice 1235 * @since 12 1236 */ 1237 export function getCalendar(locale: string, type?: string): Calendar; 1238 1239 /** 1240 * Provides the API for accessing Calendar name, time and date related information. 1241 * 1242 * @syscap SystemCapability.Global.I18n 1243 * @since 7 1244 */ 1245 /** 1246 * Provides the API for accessing Calendar name, time and date related information. 1247 * 1248 * @syscap SystemCapability.Global.I18n 1249 * @crossplatform 1250 * @since 10 1251 */ 1252 /** 1253 * Provides the API for accessing Calendar name, time and date related information. 1254 * 1255 * @syscap SystemCapability.Global.I18n 1256 * @crossplatform 1257 * @atomicservice 1258 * @since 12 1259 */ 1260 export class Calendar { 1261 /** 1262 * set the date. 1263 * 1264 * @param { Date } date - Date object used to set the time and date. 1265 * @syscap SystemCapability.Global.I18n 1266 * @since 8 1267 */ 1268 /** 1269 * set the date. 1270 * 1271 * @param { Date } date - Date object used to set the time and date. 1272 * @syscap SystemCapability.Global.I18n 1273 * @crossplatform 1274 * @since 10 1275 */ 1276 /** 1277 * set the date. 1278 * 1279 * @param { Date } date - Date object used to set the time and date. 1280 * @syscap SystemCapability.Global.I18n 1281 * @crossplatform 1282 * @atomicservice 1283 * @since 12 1284 */ 1285 setTime(date: Date): void; 1286 1287 /** 1288 * set the time. 1289 * 1290 * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. 1291 * @syscap SystemCapability.Global.I18n 1292 * @since 8 1293 */ 1294 /** 1295 * set the time. 1296 * 1297 * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. 1298 * @syscap SystemCapability.Global.I18n 1299 * @crossplatform 1300 * @since 10 1301 */ 1302 /** 1303 * set the time. 1304 * 1305 * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. 1306 * @syscap SystemCapability.Global.I18n 1307 * @crossplatform 1308 * @atomicservice 1309 * @since 12 1310 */ 1311 setTime(time: number): void; 1312 1313 /** 1314 * Set the time 1315 * 1316 * @param { number } year - The year field of the calendar, ranges from 0 to 9999. 1317 * @param { number } month - The month field of the calendar, ranges from 0 to 11. 1318 * @param { number } date - The day field of the calendar, ranges from 1 to 31. 1319 * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. 1320 * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. 1321 * @param { number } second - the second field of the calendar, ranges from 0 to 59. 1322 * @syscap SystemCapability.Global.I18n 1323 * @since 8 1324 */ 1325 /** 1326 * Set the time 1327 * 1328 * @param { number } year - The year field of the calendar, ranges from 0 to 9999. 1329 * @param { number } month - The month field of the calendar, ranges from 0 to 11. 1330 * @param { number } date - The day field of the calendar, ranges from 1 to 31. 1331 * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. 1332 * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. 1333 * @param { number } second - the second field of the calendar, ranges from 0 to 59. 1334 * @syscap SystemCapability.Global.I18n 1335 * @crossplatform 1336 * @since 10 1337 */ 1338 /** 1339 * Set the time 1340 * 1341 * @param { number } year - The year field of the calendar, ranges from 0 to 9999. 1342 * @param { number } month - The month field of the calendar, ranges from 0 to 11. 1343 * @param { number } date - The day field of the calendar, ranges from 1 to 31. 1344 * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. 1345 * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. 1346 * @param { number } second - the second field of the calendar, ranges from 0 to 59. 1347 * @syscap SystemCapability.Global.I18n 1348 * @crossplatform 1349 * @atomicservice 1350 * @since 12 1351 */ 1352 set(year: number, month: number, date: number, hour?: number, minute?: number, second?: number): void; 1353 1354 /** 1355 * Set the timezone of this calendar. 1356 * 1357 * @param { string } timezone - The id of a timezone. 1358 * @syscap SystemCapability.Global.I18n 1359 * @since 8 1360 */ 1361 /** 1362 * Set the timezone of this calendar. 1363 * 1364 * @param { string } timezone - The id of a timezone. 1365 * @syscap SystemCapability.Global.I18n 1366 * @crossplatform 1367 * @since 10 1368 */ 1369 /** 1370 * Set the timezone of this calendar. 1371 * 1372 * @param { string } timezone - The id of a timezone. 1373 * @syscap SystemCapability.Global.I18n 1374 * @crossplatform 1375 * @atomicservice 1376 * @since 12 1377 */ 1378 setTimeZone(timezone: string): void; 1379 1380 /** 1381 * Get the timezone id of this calendar instance. 1382 * 1383 * @returns { string } the timezone id of this calendar. 1384 * @syscap SystemCapability.Global.I18n 1385 * @since 8 1386 */ 1387 /** 1388 * Get the timezone id of this calendar instance. 1389 * 1390 * @returns { string } the timezone id of this calendar. 1391 * @syscap SystemCapability.Global.I18n 1392 * @crossplatform 1393 * @since 10 1394 */ 1395 /** 1396 * Get the timezone id of this calendar instance. 1397 * 1398 * @returns { string } the timezone id of this calendar. 1399 * @syscap SystemCapability.Global.I18n 1400 * @crossplatform 1401 * @atomicservice 1402 * @since 12 1403 */ 1404 getTimeZone(): string; 1405 1406 /** 1407 * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1408 * 1409 * @returns { number } start day of a week. 1410 * @syscap SystemCapability.Global.I18n 1411 * @since 8 1412 */ 1413 /** 1414 * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1415 * 1416 * @returns { number } start day of a week. 1417 * @syscap SystemCapability.Global.I18n 1418 * @crossplatform 1419 * @since 10 1420 */ 1421 /** 1422 * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1423 * 1424 * @returns { number } start day of a week. 1425 * @syscap SystemCapability.Global.I18n 1426 * @crossplatform 1427 * @atomicservice 1428 * @since 12 1429 */ 1430 getFirstDayOfWeek(): number; 1431 1432 /** 1433 * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1434 * 1435 * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1436 * @syscap SystemCapability.Global.I18n 1437 * @since 8 1438 */ 1439 /** 1440 * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1441 * 1442 * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1443 * @syscap SystemCapability.Global.I18n 1444 * @crossplatform 1445 * @since 10 1446 */ 1447 /** 1448 * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1449 * 1450 * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. 1451 * @syscap SystemCapability.Global.I18n 1452 * @crossplatform 1453 * @atomicservice 1454 * @since 12 1455 */ 1456 setFirstDayOfWeek(value: number): void; 1457 1458 /** 1459 * Get the minimal days of a week, which is needed for the first day of a year. 1460 * 1461 * @returns { number } the minimal days of a week. 1462 * @syscap SystemCapability.Global.I18n 1463 * @since 8 1464 */ 1465 /** 1466 * Get the minimal days of a week, which is needed for the first day of a year. 1467 * 1468 * @returns { number } the minimal days of a week. 1469 * @syscap SystemCapability.Global.I18n 1470 * @crossplatform 1471 * @since 10 1472 */ 1473 /** 1474 * Get the minimal days of a week, which is needed for the first day of a year. 1475 * 1476 * @returns { number } the minimal days of a week. 1477 * @syscap SystemCapability.Global.I18n 1478 * @crossplatform 1479 * @atomicservice 1480 * @since 12 1481 */ 1482 getMinimalDaysInFirstWeek(): number; 1483 1484 /** 1485 * Set the minimal days of a week, which is needed for the first week of a year. 1486 * 1487 * @param { number } value - The value to be set. 1488 * @syscap SystemCapability.Global.I18n 1489 * @since 8 1490 */ 1491 /** 1492 * Set the minimal days of a week, which is needed for the first week of a year. 1493 * 1494 * @param { number } value - The value to be set. 1495 * @syscap SystemCapability.Global.I18n 1496 * @crossplatform 1497 * @since 10 1498 */ 1499 /** 1500 * Set the minimal days of a week, which is needed for the first week of a year. 1501 * 1502 * @param { number } value - The value to be set. 1503 * @syscap SystemCapability.Global.I18n 1504 * @crossplatform 1505 * @atomicservice 1506 * @since 12 1507 */ 1508 setMinimalDaysInFirstWeek(value: number): void; 1509 1510 /** 1511 * Get the associated value with the field. 1512 * 1513 * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week 1514 * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, 1515 * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. 1516 * @returns { number } the associated value. 1517 * @syscap SystemCapability.Global.I18n 1518 * @since 8 1519 */ 1520 /** 1521 * Get the associated value with the field. 1522 * 1523 * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week 1524 * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, 1525 * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. 1526 * @returns { number } the associated value. 1527 * @syscap SystemCapability.Global.I18n 1528 * @crossplatform 1529 * @since 10 1530 */ 1531 /** 1532 * Get the associated value with the field. 1533 * 1534 * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week 1535 * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, 1536 * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. 1537 * @returns { number } the associated value. 1538 * @syscap SystemCapability.Global.I18n 1539 * @crossplatform 1540 * @atomicservice 1541 * @since 12 1542 */ 1543 get(field: string): number; 1544 1545 /** 1546 * Get calendar's name localized for display in the given locale. 1547 * 1548 * @param { string } locale - Locale used to get the localized name for this calendar. It must be a valid locale. 1549 * @returns { string } the localized name of this calendar. 1550 * @syscap SystemCapability.Global.I18n 1551 * @since 8 1552 */ 1553 /** 1554 * Get calendar's name localized for display in the given locale. 1555 * 1556 * @param { string } locale - Locale used to get the localized name for this calendar. It must be a valid locale. 1557 * @returns { string } the localized name of this calendar. 1558 * @syscap SystemCapability.Global.I18n 1559 * @atomicservice 1560 * @since 12 1561 */ 1562 getDisplayName(locale: string): string; 1563 1564 /** 1565 * Returns true if the given date is a weekend day. If the date is not given, 1566 * the date object of this calendar is used. 1567 * 1568 * @param { Date } [date] - Date object whose attribute is desired. 1569 * @returns { boolean } whether the date is a weekend day. 1570 * @syscap SystemCapability.Global.I18n 1571 * @since 8 1572 */ 1573 /** 1574 * Returns true if the given date is a weekend day. If the date is not given, 1575 * the date object of this calendar is used. 1576 * 1577 * @param { Date } [date] - Date object whose attribute is desired. 1578 * @returns { boolean } whether the date is a weekend day. 1579 * @syscap SystemCapability.Global.I18n 1580 * @crossplatform 1581 * @since 10 1582 */ 1583 /** 1584 * Returns true if the given date is a weekend day. If the date is not given, 1585 * the date object of this calendar is used. 1586 * 1587 * @param { Date } [date] - Date object whose attribute is desired. 1588 * @returns { boolean } whether the date is a weekend day. 1589 * @syscap SystemCapability.Global.I18n 1590 * @crossplatform 1591 * @atomicservice 1592 * @since 12 1593 */ 1594 isWeekend(date?: Date): boolean; 1595 1596 /** 1597 * Adds or subtract the specified amount of time to the given calendar field. 1598 * 1599 * @param { string } field - field values such as year, month, week_of_year, week_of_month, date, day_of_year, day_of_week 1600 * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond 1601 * @param { number } amount - the amount of date or time to be added to the field. 1602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1603 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 1604 * @syscap SystemCapability.Global.I18n 1605 * @crossplatform 1606 * @since 11 1607 */ 1608 /** 1609 * Adds or subtract the specified amount of time to the given calendar field. 1610 * 1611 * @param { string } field - field values such as year, month, week_of_year, week_of_month, date, day_of_year, day_of_week 1612 * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond 1613 * @param { number } amount - the amount of date or time to be added to the field. 1614 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1615 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 1616 * @syscap SystemCapability.Global.I18n 1617 * @crossplatform 1618 * @atomicservice 1619 * @since 12 1620 */ 1621 add(field: string, amount: number): void; 1622 1623 /** 1624 * Get the UTC milliseconds. 1625 * 1626 * @returns { number } the calendar time as UTC milliseconds. 1627 * @syscap SystemCapability.Global.I18n 1628 * @crossplatform 1629 * @since 11 1630 */ 1631 /** 1632 * Get the UTC milliseconds. 1633 * 1634 * @returns { number } the calendar time as UTC milliseconds. 1635 * @syscap SystemCapability.Global.I18n 1636 * @crossplatform 1637 * @atomicservice 1638 * @since 12 1639 */ 1640 getTimeInMillis(): number; 1641 1642 /** 1643 * Returns days comparison result. 1644 * 1645 * @param { Date } date - Date object to be compared. 1646 * @returns { number } value of of the comparison result. A positive value indicates that the date is later, 1647 * and a negative value indicates that the date is earlier. 1648 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1649 * @syscap SystemCapability.Global.I18n 1650 * @crossplatform 1651 * @since 11 1652 */ 1653 /** 1654 * Returns days comparison result. 1655 * 1656 * @param { Date } date - Date object to be compared. 1657 * @returns { number } value of of the comparison result. A positive value indicates that the date is later, 1658 * and a negative value indicates that the date is earlier. 1659 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1660 * @syscap SystemCapability.Global.I18n 1661 * @crossplatform 1662 * @atomicservice 1663 * @since 12 1664 */ 1665 compareDays(date: Date): number; 1666 } 1667 1668 /** 1669 * Judge whether the locale is RTL locale. 1670 * 1671 * @param { string } locale - The locale to be used. 1672 * @returns { boolean } true representing the locale is an RTL locale 1673 * @syscap SystemCapability.Global.I18n 1674 * @since 7 1675 */ 1676 /** 1677 * Judge whether the locale is RTL locale. 1678 * 1679 * @param { string } locale - The locale to be used. 1680 * @returns { boolean } true representing the locale is an RTL locale 1681 * @syscap SystemCapability.Global.I18n 1682 * @crossplatform 1683 * @since 10 1684 */ 1685 /** 1686 * Judge whether the locale is RTL locale. 1687 * 1688 * @param { string } locale - The locale to be used. 1689 * @returns { boolean } true representing the locale is an RTL locale 1690 * @syscap SystemCapability.Global.I18n 1691 * @crossplatform 1692 * @atomicservice 1693 * @since 12 1694 */ 1695 export function isRTL(locale: string): boolean; 1696 1697 /** 1698 * Obtains a BreakIterator object for finding the location of break point in text. 1699 * 1700 * @param { string } locale - the returned BreakIterator will adapt the rule, specified by the locale, to break text. 1701 * @returns { BreakIterator } a newly constructed BreakIterator object. 1702 * @syscap SystemCapability.Global.I18n 1703 * @since 8 1704 */ 1705 /** 1706 * Obtains a BreakIterator object for finding the location of break point in text. 1707 * 1708 * @param { string } locale - the returned BreakIterator will adapt the rule, specified by the locale, to break text. 1709 * @returns { BreakIterator } a newly constructed BreakIterator object. 1710 * @syscap SystemCapability.Global.I18n 1711 * @atomicservice 1712 * @since 12 1713 */ 1714 export function getLineInstance(locale: string): BreakIterator; 1715 1716 /** 1717 * The BreakIterator class is used for finding the location of break point in text. 1718 * 1719 * @syscap SystemCapability.Global.I18n 1720 * @since 8 1721 */ 1722 /** 1723 * The BreakIterator class is used for finding the location of break point in text. 1724 * 1725 * @syscap SystemCapability.Global.I18n 1726 * @atomicservice 1727 * @since 12 1728 */ 1729 export class BreakIterator { 1730 /** 1731 * Obtains the current position of the BreakIterator instance. 1732 * 1733 * @returns { number } the current position of the BreakIterator instance. 1734 * @syscap SystemCapability.Global.I18n 1735 * @since 8 1736 */ 1737 /** 1738 * Obtains the current position of the BreakIterator instance. 1739 * 1740 * @returns { number } the current position of the BreakIterator instance. 1741 * @syscap SystemCapability.Global.I18n 1742 * @atomicservice 1743 * @since 12 1744 */ 1745 current(): number; 1746 1747 /** 1748 * Set the BreakIterator's position to the first break point, the first break point is always the beginning of the 1749 * processed text. 1750 * 1751 * @returns { number } the index of the first break point. 1752 * @syscap SystemCapability.Global.I18n 1753 * @since 8 1754 */ 1755 /** 1756 * Set the BreakIterator's position to the first break point, the first break point is always the beginning of the 1757 * processed text. 1758 * 1759 * @returns { number } the index of the first break point. 1760 * @syscap SystemCapability.Global.I18n 1761 * @atomicservice 1762 * @since 12 1763 */ 1764 first(): number; 1765 1766 /** 1767 * Set the BreakIterator's position to the last break point. the last break point is always the index beyond the 1768 * last character of the processed text. 1769 * 1770 * @returns { number } the index of the last break point. 1771 * @syscap SystemCapability.Global.I18n 1772 * @since 8 1773 */ 1774 /** 1775 * Set the BreakIterator's position to the last break point. the last break point is always the index beyond the 1776 * last character of the processed text. 1777 * 1778 * @returns { number } the index of the last break point. 1779 * @syscap SystemCapability.Global.I18n 1780 * @atomicservice 1781 * @since 12 1782 */ 1783 last(): number; 1784 1785 /** 1786 * Set the BreakIterator's position to the nth break point from the current break point. 1787 * 1788 * @param { number } [index] - indicates the number of break points to advance. If index is not given, n is treated as 1. 1789 * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. 1790 * @syscap SystemCapability.Global.I18n 1791 * @since 8 1792 */ 1793 /** 1794 * Set the BreakIterator's position to the nth break point from the current break point. 1795 * 1796 * @param { number } [index] - indicates the number of break points to advance. If index is not given, n is treated as 1. 1797 * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. 1798 * @syscap SystemCapability.Global.I18n 1799 * @atomicservice 1800 * @since 12 1801 */ 1802 next(index?: number): number; 1803 1804 /** 1805 * Set the BreakIterator's position to the break point preceding the current break point. 1806 * 1807 * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. 1808 * @syscap SystemCapability.Global.I18n 1809 * @since 8 1810 */ 1811 /** 1812 * Set the BreakIterator's position to the break point preceding the current break point. 1813 * 1814 * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. 1815 * @syscap SystemCapability.Global.I18n 1816 * @atomicservice 1817 * @since 12 1818 */ 1819 previous(): number; 1820 1821 /** 1822 * Set the text to be processed. 1823 * 1824 * @param { string } text - Indicates the text to be processed by the BreakIterator. 1825 * @syscap SystemCapability.Global.I18n 1826 * @since 8 1827 */ 1828 /** 1829 * Set the text to be processed. 1830 * 1831 * @param { string } text - Indicates the text to be processed by the BreakIterator. 1832 * @syscap SystemCapability.Global.I18n 1833 * @atomicservice 1834 * @since 12 1835 */ 1836 setLineBreakText(text: string): void; 1837 1838 /** 1839 * Set the BreakIterator's position to the first break point following the specified offset. 1840 * 1841 * @param { number } offset 1842 * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. 1843 * @syscap SystemCapability.Global.I18n 1844 * @since 8 1845 */ 1846 /** 1847 * Set the BreakIterator's position to the first break point following the specified offset. 1848 * 1849 * @param { number } offset 1850 * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. 1851 * @syscap SystemCapability.Global.I18n 1852 * @atomicservice 1853 * @since 12 1854 */ 1855 following(offset: number): number; 1856 1857 /** 1858 * Obtains the text being processed. 1859 * 1860 * @returns { string } the text that is processed by the BreakIterator. 1861 * @syscap SystemCapability.Global.I18n 1862 * @since 8 1863 */ 1864 /** 1865 * Obtains the text being processed. 1866 * 1867 * @returns { string } the text that is processed by the BreakIterator. 1868 * @syscap SystemCapability.Global.I18n 1869 * @atomicservice 1870 * @since 12 1871 */ 1872 getLineBreakText(): string; 1873 1874 /** 1875 * Returns true if the position indicated by the offset is a break point, otherwise false. The BreakIterator's 1876 * position will be set to the position indicated by the offset if it returns true, otherwise the BreakIterator 1877 * will be moved to the break point following the offset. 1878 * 1879 * @param { number } offset The offset to be checked. 1880 * @returns { boolean } true if the offset is a break point. 1881 * @syscap SystemCapability.Global.I18n 1882 * @since 8 1883 */ 1884 /** 1885 * Returns true if the position indicated by the offset is a break point, otherwise false. The BreakIterator's 1886 * position will be set to the position indicated by the offset if it returns true, otherwise the BreakIterator 1887 * will be moved to the break point following the offset. 1888 * 1889 * @param { number } offset The offset to be checked. 1890 * @returns { boolean } true if the offset is a break point. 1891 * @syscap SystemCapability.Global.I18n 1892 * @atomicservice 1893 * @since 12 1894 */ 1895 isBoundary(offset: number): boolean; 1896 } 1897 1898 /** 1899 * Get IndexUtil object. 1900 * 1901 * @param { string } [locale] - Indicates a character string containing the locale information, including 1902 * the language and optionally the script and region, for the NumberFormat object. 1903 * @returns { IndexUtil } IndexUtil object. 1904 * @syscap SystemCapability.Global.I18n 1905 * @since 8 1906 */ 1907 /** 1908 * Get IndexUtil object. 1909 * 1910 * @param { string } [locale] - Indicates a character string containing the locale information, including 1911 * the language and optionally the script and region, for the NumberFormat object. 1912 * @returns { IndexUtil } IndexUtil object. 1913 * @syscap SystemCapability.Global.I18n 1914 * @atomicservice 1915 * @since 12 1916 */ 1917 export function getInstance(locale?: string): IndexUtil; 1918 1919 /** 1920 * Sequence text can be grouped under the specified area, 1921 * and grouping index with different lengths can be specified. 1922 * 1923 * @syscap SystemCapability.Global.I18n 1924 * @since 8 1925 */ 1926 /** 1927 * Sequence text can be grouped under the specified area, 1928 * and grouping index with different lengths can be specified. 1929 * 1930 * @syscap SystemCapability.Global.I18n 1931 * @atomicservice 1932 * @since 12 1933 */ 1934 export class IndexUtil { 1935 /** 1936 * Get a list of labels for use as a UI index 1937 * 1938 * @returns { Array<string> } a list of labels 1939 * @syscap SystemCapability.Global.I18n 1940 * @since 8 1941 */ 1942 /** 1943 * Get a list of labels for use as a UI index 1944 * 1945 * @returns { Array<string> } a list of labels 1946 * @syscap SystemCapability.Global.I18n 1947 * @atomicservice 1948 * @since 12 1949 */ 1950 getIndexList(): Array<string>; 1951 1952 /** 1953 * Add the index characters from a Locale to the index. 1954 * 1955 * @param { string } locale - The locale whose index characters are to be added. 1956 * @syscap SystemCapability.Global.I18n 1957 * @since 8 1958 */ 1959 /** 1960 * Add the index characters from a Locale to the index. 1961 * 1962 * @param { string } locale - The locale whose index characters are to be added. 1963 * @syscap SystemCapability.Global.I18n 1964 * @atomicservice 1965 * @since 12 1966 */ 1967 addLocale(locale: string): void; 1968 1969 /** 1970 * Get corresponding index of the input text. 1971 * 1972 * @param { string } text - input text 1973 * @returns { string } index of the input text 1974 * @syscap SystemCapability.Global.I18n 1975 * @since 8 1976 */ 1977 /** 1978 * Get corresponding index of the input text. 1979 * 1980 * @param { string } text - input text 1981 * @returns { string } index of the input text 1982 * @syscap SystemCapability.Global.I18n 1983 * @atomicservice 1984 * @since 12 1985 */ 1986 getIndex(text: string): string; 1987 } 1988 1989 /** 1990 * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. 1991 * 1992 * @syscap SystemCapability.Global.I18n 1993 * @since 8 1994 * @deprecated since 9 1995 * @useinstead Unicode 1996 */ 1997 export class Character { 1998 /** 1999 * Determines whether the specified code point is a digit character 2000 * 2001 * @param { string } char - the character to be tested 2002 * @returns { boolean } true if the character is a digit character 2003 * @syscap SystemCapability.Global.I18n 2004 * @since 8 2005 * @deprecated since 9 2006 * @useinstead Unicode.isDigit 2007 */ 2008 isDigit(char: string): boolean; 2009 2010 /** 2011 * Determines if the specified character is a space character or not. 2012 * 2013 * @param { string } char - the character to be tested 2014 * @returns { boolean } true if the character is a space character 2015 * @syscap SystemCapability.Global.I18n 2016 * @since 8 2017 * @deprecated since 9 2018 * @useinstead Unicode.isSpaceChar 2019 */ 2020 isSpaceChar(char: string): boolean; 2021 2022 /** 2023 * Determines if the specified character is a whitespace character 2024 * 2025 * @param { string } char - the character to be tested 2026 * @returns { boolean } true if the character is a whitespace character 2027 * @syscap SystemCapability.Global.I18n 2028 * @since 8 2029 * @deprecated since 9 2030 * @useinstead Unicode.isWhitespace 2031 */ 2032 isWhitespace(char: string): boolean; 2033 2034 /** 2035 * Determines if the specified character is a RTL character or not. 2036 * 2037 * @param { string } char - the character to be tested 2038 * @returns { boolean } true if the character is a RTL character 2039 * @syscap SystemCapability.Global.I18n 2040 * @since 8 2041 * @deprecated since 9 2042 * @useinstead Unicode.isRTL 2043 */ 2044 isRTL(char: string): boolean; 2045 2046 /** 2047 * Determines if the specified character is a Ideographic character or not. 2048 * 2049 * @param { string } char - the character to be tested 2050 * @returns { boolean } true if the character is a Ideographic character 2051 * @syscap SystemCapability.Global.I18n 2052 * @since 8 2053 * @deprecated since 9 2054 * @useinstead Unicode.isIdeograph 2055 */ 2056 isIdeograph(char: string): boolean; 2057 2058 /** 2059 * Determines if the specified character is a Letter or not. 2060 * 2061 * @param { string } char - the character to be tested 2062 * @returns { boolean } true if the character is a Letter 2063 * @syscap SystemCapability.Global.I18n 2064 * @since 8 2065 * @deprecated since 9 2066 * @useinstead Unicode.isLetter 2067 */ 2068 isLetter(char: string): boolean; 2069 2070 /** 2071 * Determines if the specified character is a LowerCase character or not. 2072 * 2073 * @param { string } char - the character to be tested 2074 * @returns { boolean } true if the character is a LowerCase character 2075 * @syscap SystemCapability.Global.I18n 2076 * @since 8 2077 * @deprecated since 9 2078 * @useinstead Unicode.isLowerCase 2079 */ 2080 isLowerCase(char: string): boolean; 2081 2082 /** 2083 * Determines if the specified character is a UpperCase character or not. 2084 * 2085 * @param { string } char - the character to be tested 2086 * @returns { boolean } true if the character is a UpperCase character 2087 * @syscap SystemCapability.Global.I18n 2088 * @since 8 2089 * @deprecated since 9 2090 * @useinstead Unicode.isUpperCase 2091 */ 2092 isUpperCase(char: string): boolean; 2093 2094 /** 2095 * Get the general category value of the specified character. 2096 * 2097 * @param { string } char - the character to be tested 2098 * @returns { string } the general category of the specified character. 2099 * @syscap SystemCapability.Global.I18n 2100 * @since 8 2101 * @deprecated since 9 2102 * @useinstead Unicode.getType 2103 */ 2104 getType(char: string): string; 2105 } 2106 2107 /** 2108 * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. 2109 * 2110 * @syscap SystemCapability.Global.I18n 2111 * @since 9 2112 */ 2113 /** 2114 * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. 2115 * 2116 * @syscap SystemCapability.Global.I18n 2117 * @crossplatform 2118 * @since 10 2119 */ 2120 /** 2121 * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. 2122 * 2123 * @syscap SystemCapability.Global.I18n 2124 * @crossplatform 2125 * @atomicservice 2126 * @since 12 2127 */ 2128 export class Unicode { 2129 /** 2130 * Determines whether the specified code point is a digit character 2131 * 2132 * @param { string } char - the character to be tested 2133 * @returns { boolean } true if the character is a digit character 2134 * @syscap SystemCapability.Global.I18n 2135 * @since 9 2136 */ 2137 /** 2138 * Determines whether the specified code point is a digit character 2139 * 2140 * @param { string } char - the character to be tested 2141 * @returns { boolean } true if the character is a digit character 2142 * @syscap SystemCapability.Global.I18n 2143 * @crossplatform 2144 * @since 10 2145 */ 2146 /** 2147 * Determines whether the specified code point is a digit character 2148 * 2149 * @param { string } char - the character to be tested 2150 * @returns { boolean } true if the character is a digit character 2151 * @syscap SystemCapability.Global.I18n 2152 * @crossplatform 2153 * @atomicservice 2154 * @since 12 2155 */ 2156 static isDigit(char: string): boolean; 2157 2158 /** 2159 * Determines if the specified character is a space character or not. 2160 * 2161 * @param { string } char - the character to be tested 2162 * @returns { boolean } true if the character is a space character 2163 * @syscap SystemCapability.Global.I18n 2164 * @since 9 2165 */ 2166 /** 2167 * Determines if the specified character is a space character or not. 2168 * 2169 * @param { string } char - the character to be tested 2170 * @returns { boolean } true if the character is a space character 2171 * @syscap SystemCapability.Global.I18n 2172 * @crossplatform 2173 * @since 10 2174 */ 2175 /** 2176 * Determines if the specified character is a space character or not. 2177 * 2178 * @param { string } char - the character to be tested 2179 * @returns { boolean } true if the character is a space character 2180 * @syscap SystemCapability.Global.I18n 2181 * @crossplatform 2182 * @atomicservice 2183 * @since 12 2184 */ 2185 static isSpaceChar(char: string): boolean; 2186 2187 /** 2188 * Determines if the specified character is a whitespace character 2189 * 2190 * @param { string } char - the character to be tested 2191 * @returns { boolean } true if the character is a whitespace character 2192 * @syscap SystemCapability.Global.I18n 2193 * @since 9 2194 */ 2195 /** 2196 * Determines if the specified character is a whitespace character 2197 * 2198 * @param { string } char - the character to be tested 2199 * @returns { boolean } true if the character is a whitespace character 2200 * @syscap SystemCapability.Global.I18n 2201 * @crossplatform 2202 * @since 10 2203 */ 2204 /** 2205 * Determines if the specified character is a whitespace character 2206 * 2207 * @param { string } char - the character to be tested 2208 * @returns { boolean } true if the character is a whitespace character 2209 * @syscap SystemCapability.Global.I18n 2210 * @crossplatform 2211 * @atomicservice 2212 * @since 12 2213 */ 2214 static isWhitespace(char: string): boolean; 2215 2216 /** 2217 * Determines if the specified character is a RTL character or not. 2218 * 2219 * @param { string } char - the character to be tested 2220 * @returns { boolean } true if the character is a RTL character 2221 * @syscap SystemCapability.Global.I18n 2222 * @since 9 2223 */ 2224 /** 2225 * Determines if the specified character is a RTL character or not. 2226 * 2227 * @param { string } char - the character to be tested 2228 * @returns { boolean } true if the character is a RTL character 2229 * @syscap SystemCapability.Global.I18n 2230 * @crossplatform 2231 * @since 10 2232 */ 2233 /** 2234 * Determines if the specified character is a RTL character or not. 2235 * 2236 * @param { string } char - the character to be tested 2237 * @returns { boolean } true if the character is a RTL character 2238 * @syscap SystemCapability.Global.I18n 2239 * @crossplatform 2240 * @atomicservice 2241 * @since 12 2242 */ 2243 static isRTL(char: string): boolean; 2244 2245 /** 2246 * Determines if the specified character is a Ideographic character or not. 2247 * 2248 * @param { string } char - the character to be tested 2249 * @returns { boolean } true if the character is a Ideographic character 2250 * @syscap SystemCapability.Global.I18n 2251 * @since 9 2252 */ 2253 /** 2254 * Determines if the specified character is a Ideographic character or not. 2255 * 2256 * @param { string } char - the character to be tested 2257 * @returns { boolean } true if the character is a Ideographic character 2258 * @syscap SystemCapability.Global.I18n 2259 * @crossplatform 2260 * @since 10 2261 */ 2262 /** 2263 * Determines if the specified character is a Ideographic character or not. 2264 * 2265 * @param { string } char - the character to be tested 2266 * @returns { boolean } true if the character is a Ideographic character 2267 * @syscap SystemCapability.Global.I18n 2268 * @crossplatform 2269 * @atomicservice 2270 * @since 12 2271 */ 2272 static isIdeograph(char: string): boolean; 2273 2274 /** 2275 * Determines if the specified character is a Letter or not. 2276 * 2277 * @param { string } char - the character to be tested 2278 * @returns { boolean } true if the character is a Letter 2279 * @syscap SystemCapability.Global.I18n 2280 * @since 9 2281 */ 2282 /** 2283 * Determines if the specified character is a Letter or not. 2284 * 2285 * @param { string } char - the character to be tested 2286 * @returns { boolean } true if the character is a Letter 2287 * @syscap SystemCapability.Global.I18n 2288 * @crossplatform 2289 * @since 10 2290 */ 2291 /** 2292 * Determines if the specified character is a Letter or not. 2293 * 2294 * @param { string } char - the character to be tested 2295 * @returns { boolean } true if the character is a Letter 2296 * @syscap SystemCapability.Global.I18n 2297 * @crossplatform 2298 * @atomicservice 2299 * @since 12 2300 */ 2301 static isLetter(char: string): boolean; 2302 2303 /** 2304 * Determines if the specified character is a LowerCase character or not. 2305 * 2306 * @param { string } char - the character to be tested 2307 * @returns { boolean } true if the character is a LowerCase character 2308 * @syscap SystemCapability.Global.I18n 2309 * @since 9 2310 */ 2311 /** 2312 * Determines if the specified character is a LowerCase character or not. 2313 * 2314 * @param { string } char - the character to be tested 2315 * @returns { boolean } true if the character is a LowerCase character 2316 * @syscap SystemCapability.Global.I18n 2317 * @crossplatform 2318 * @since 10 2319 */ 2320 /** 2321 * Determines if the specified character is a LowerCase character or not. 2322 * 2323 * @param { string } char - the character to be tested 2324 * @returns { boolean } true if the character is a LowerCase character 2325 * @syscap SystemCapability.Global.I18n 2326 * @crossplatform 2327 * @atomicservice 2328 * @since 12 2329 */ 2330 static isLowerCase(char: string): boolean; 2331 2332 /** 2333 * Determines if the specified character is a UpperCase character or not. 2334 * 2335 * @param { string } char - the character to be tested 2336 * @returns { boolean } true if the character is a UpperCase character 2337 * @syscap SystemCapability.Global.I18n 2338 * @since 9 2339 */ 2340 /** 2341 * Determines if the specified character is a UpperCase character or not. 2342 * 2343 * @param { string } char - the character to be tested 2344 * @returns { boolean } true if the character is a UpperCase character 2345 * @syscap SystemCapability.Global.I18n 2346 * @crossplatform 2347 * @since 10 2348 */ 2349 /** 2350 * Determines if the specified character is a UpperCase character or not. 2351 * 2352 * @param { string } char - the character to be tested 2353 * @returns { boolean } true if the character is a UpperCase character 2354 * @syscap SystemCapability.Global.I18n 2355 * @crossplatform 2356 * @atomicservice 2357 * @since 12 2358 */ 2359 static isUpperCase(char: string): boolean; 2360 2361 /** 2362 * Get the general category value of the specified character. 2363 * 2364 * @param { string } char - the character to be tested 2365 * @returns { string } the general category of the specified character. 2366 * @syscap SystemCapability.Global.I18n 2367 * @since 9 2368 */ 2369 /** 2370 * Get the general category value of the specified character. 2371 * 2372 * @param { string } char - the character to be tested 2373 * @returns { string } the general category of the specified character. 2374 * @syscap SystemCapability.Global.I18n 2375 * @crossplatform 2376 * @since 10 2377 */ 2378 /** 2379 * Get the general category value of the specified character. 2380 * 2381 * @param { string } char - the character to be tested 2382 * @returns { string } the general category of the specified character. 2383 * @syscap SystemCapability.Global.I18n 2384 * @crossplatform 2385 * @atomicservice 2386 * @since 12 2387 */ 2388 static getType(char: string): string; 2389 } 2390 2391 /** 2392 * check out whether system is 24-hour system. 2393 * 2394 * @returns { boolean } a boolean represent whether system is 24-hour system. 2395 * @syscap SystemCapability.Global.I18n 2396 * @since 7 2397 * @deprecated since 9 2398 * @useinstead ohos.i18n/i18n.System#is24HourClock 2399 */ 2400 export function is24HourClock(): boolean; 2401 2402 /** 2403 * set 24-hour system. 2404 * 2405 * @permission ohos.permission.UPDATE_CONFIGURATION 2406 * @param { boolean } option - represent the boolean to be set. 2407 * @returns { boolean } a boolean represent whether setting 24-hour system success. 2408 * @syscap SystemCapability.Global.I18n 2409 * @since 7 2410 * @deprecated since 9 2411 * @useinstead ohos.i18n/i18n.System#set24HourClock 2412 */ 2413 export function set24HourClock(option: boolean): boolean; 2414 2415 /** 2416 * Add one language to preferred language List. 2417 * 2418 * @permission ohos.permission.UPDATE_CONFIGURATION 2419 * @param { string } language - the language to be added. 2420 * @param { number } [index] - the position of preferred language list to be inserted. 2421 * @returns { boolean } a boolean represent whether language added success. 2422 * @syscap SystemCapability.Global.I18n 2423 * @since 8 2424 * @deprecated since 9 2425 * @useinstead ohos.i18n/i18n.System#addPreferredLanguage 2426 */ 2427 export function addPreferredLanguage(language: string, index?: number): boolean; 2428 2429 /** 2430 * Remove one language from preferred language list. 2431 * 2432 * @permission ohos.permission.UPDATE_CONFIGURATION 2433 * @param { number } index - the position of removed language in preferred language list. 2434 * @returns { boolean } a boolean represent whether removed success. 2435 * @syscap SystemCapability.Global.I18n 2436 * @since 8 2437 * @deprecated since 9 2438 * @useinstead ohos.i18n/i18n.System#removePreferredLanguage 2439 */ 2440 export function removePreferredLanguage(index: number): boolean; 2441 2442 /** 2443 * Access the system preferred language list. 2444 * 2445 * @returns { Array<string> } a string Array represent the preferred language list. 2446 * @syscap SystemCapability.Global.I18n 2447 * @since 8 2448 * @deprecated since 9 2449 * @useinstead ohos.i18n/i18n.System#getPreferredLanguageList 2450 */ 2451 export function getPreferredLanguageList(): Array<string>; 2452 2453 /** 2454 * Get the first preferred language of system. 2455 * 2456 * @returns { string } a string represent the first preferred language of system. 2457 * @syscap SystemCapability.Global.I18n 2458 * @since 8 2459 * @deprecated since 9 2460 * @useinstead ohos.i18n/i18n.System#getFirstPreferredLanguage 2461 */ 2462 export function getFirstPreferredLanguage(): string; 2463 2464 /** 2465 * Get the default TimeZone object or the TimeZone object corresponds to zoneID. 2466 * 2467 * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. 2468 * @returns { TimeZone } a TimeZone object corresponds to zoneID. 2469 * @syscap SystemCapability.Global.I18n 2470 * @since 7 2471 */ 2472 /** 2473 * Get the default TimeZone object or the TimeZone object corresponds to zoneID. 2474 * 2475 * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. 2476 * @returns { TimeZone } a TimeZone object corresponds to zoneID. 2477 * @syscap SystemCapability.Global.I18n 2478 * @crossplatform 2479 * @since 10 2480 */ 2481 /** 2482 * Get the default TimeZone object or the TimeZone object corresponds to zoneID. 2483 * 2484 * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. 2485 * @returns { TimeZone } a TimeZone object corresponds to zoneID. 2486 * @syscap SystemCapability.Global.I18n 2487 * @crossplatform 2488 * @atomicservice 2489 * @since 12 2490 */ 2491 export function getTimeZone(zoneID?: string): TimeZone; 2492 2493 /** 2494 * Provides the API for accessing TimeZone name, rawOffset and offset information. 2495 * 2496 * @syscap SystemCapability.Global.I18n 2497 * @since 7 2498 */ 2499 /** 2500 * Provides the API for accessing TimeZone name, rawOffset and offset information. 2501 * 2502 * @syscap SystemCapability.Global.I18n 2503 * @crossplatform 2504 * @since 10 2505 */ 2506 /** 2507 * Provides the API for accessing TimeZone name, rawOffset and offset information. 2508 * 2509 * @syscap SystemCapability.Global.I18n 2510 * @crossplatform 2511 * @atomicservice 2512 * @since 12 2513 */ 2514 export class TimeZone { 2515 /** 2516 * Get the id of the TimeZone object. 2517 * 2518 * @returns { string } a string represents the timezone id. 2519 * @syscap SystemCapability.Global.I18n 2520 * @since 7 2521 */ 2522 /** 2523 * Get the id of the TimeZone object. 2524 * 2525 * @returns { string } a string represents the timezone id. 2526 * @syscap SystemCapability.Global.I18n 2527 * @crossplatform 2528 * @since 10 2529 */ 2530 /** 2531 * Get the id of the TimeZone object. 2532 * 2533 * @returns { string } a string represents the timezone id. 2534 * @syscap SystemCapability.Global.I18n 2535 * @crossplatform 2536 * @atomicservice 2537 * @since 12 2538 */ 2539 getID(): string; 2540 2541 /** 2542 * Get the displayName of the TimeZone Object under the locale. 2543 * 2544 * @param { string } [locale] - the locale tag use to display timezone object's name. 2545 * @param { boolean } [isDST] - wether consider daylight saving time when display timezone object's name. 2546 * @returns { string } a string represents the display name. 2547 * @syscap SystemCapability.Global.I18n 2548 * @since 7 2549 */ 2550 /** 2551 * Get the displayName of the TimeZone Object under the locale. 2552 * 2553 * @param { string } [locale] - the locale tag use to display timezone object's name. 2554 * @param { boolean } [isDST] - wether consider daylight saving time when display timezone object's name. 2555 * @returns { string } a string represents the display name. 2556 * @syscap SystemCapability.Global.I18n 2557 * @atomicservice 2558 * @since 12 2559 */ 2560 getDisplayName(locale?: string, isDST?: boolean): string; 2561 2562 /** 2563 * Get the raw offset of the TimeZone object. 2564 * 2565 * @returns { number } a number represents the raw offset. 2566 * @syscap SystemCapability.Global.I18n 2567 * @since 7 2568 */ 2569 /** 2570 * Get the raw offset of the TimeZone object. 2571 * 2572 * @returns { number } a number represents the raw offset. 2573 * @syscap SystemCapability.Global.I18n 2574 * @crossplatform 2575 * @since 10 2576 */ 2577 /** 2578 * Get the raw offset of the TimeZone object. 2579 * 2580 * @returns { number } a number represents the raw offset. 2581 * @syscap SystemCapability.Global.I18n 2582 * @crossplatform 2583 * @atomicservice 2584 * @since 12 2585 */ 2586 getRawOffset(): number; 2587 2588 /** 2589 * Get the offset of the TimeZone object. 2590 * 2591 * @param { number } [date] - Indicates a date use to compute offset. 2592 * @returns { number } a number represents the offset with date. 2593 * @syscap SystemCapability.Global.I18n 2594 * @since 7 2595 */ 2596 /** 2597 * Get the offset of the TimeZone object. 2598 * 2599 * @param { number } [date] - Indicates a date use to compute offset. 2600 * @returns { number } a number represents the offset with date. 2601 * @syscap SystemCapability.Global.I18n 2602 * @crossplatform 2603 * @since 10 2604 */ 2605 /** 2606 * Get the offset of the TimeZone object. 2607 * 2608 * @param { number } [date] - Indicates a date use to compute offset. 2609 * @returns { number } a number represents the offset with date. 2610 * @syscap SystemCapability.Global.I18n 2611 * @crossplatform 2612 * @atomicservice 2613 * @since 12 2614 */ 2615 getOffset(date?: number): number; 2616 2617 /** 2618 * Get available TimeZone ID list. 2619 * 2620 * @returns { Array<string> } a string array represents the available TimeZone ID list. 2621 * @syscap SystemCapability.Global.I18n 2622 * @since 9 2623 */ 2624 /** 2625 * Get available TimeZone ID list. 2626 * 2627 * @returns { Array<string> } a string array represents the available TimeZone ID list. 2628 * @syscap SystemCapability.Global.I18n 2629 * @crossplatform 2630 * @since 10 2631 */ 2632 /** 2633 * Get available TimeZone ID list. 2634 * 2635 * @returns { Array<string> } a string array represents the available TimeZone ID list. 2636 * @syscap SystemCapability.Global.I18n 2637 * @crossplatform 2638 * @atomicservice 2639 * @since 12 2640 */ 2641 static getAvailableIDs(): Array<string>; 2642 2643 /** 2644 * Get available Zone City ID list. 2645 * 2646 * @returns { Array<string> } a string array represents the available Zone City ID list. 2647 * @syscap SystemCapability.Global.I18n 2648 * @since 9 2649 */ 2650 /** 2651 * Get available Zone City ID list. 2652 * 2653 * @returns { Array<string> } a string array represents the available Zone City ID list. 2654 * @syscap SystemCapability.Global.I18n 2655 * @atomicservice 2656 * @since 12 2657 */ 2658 static getAvailableZoneCityIDs(): Array<string>; 2659 2660 /** 2661 * Get City display name in a certain locale. 2662 * 2663 * @param { string } cityID - Zone City ID. 2664 * @param { string } locale - locale used to display city name. 2665 * @returns { string } a string represents the display name of City in locale. 2666 * @syscap SystemCapability.Global.I18n 2667 * @since 9 2668 */ 2669 /** 2670 * Get City display name in a certain locale. 2671 * 2672 * @param { string } cityID - Zone City ID. 2673 * @param { string } locale - locale used to display city name. 2674 * @returns { string } a string represents the display name of City in locale. 2675 * @syscap SystemCapability.Global.I18n 2676 * @atomicservice 2677 * @since 12 2678 */ 2679 static getCityDisplayName(cityID: string, locale: string): string; 2680 2681 /** 2682 * Get TimeZone Object from city ID. 2683 * 2684 * @param { string } cityID - Zone City ID. 2685 * @returns { TimeZone } a TimeZone Object from city ID. 2686 * @syscap SystemCapability.Global.I18n 2687 * @since 9 2688 */ 2689 /** 2690 * Get TimeZone Object from city ID. 2691 * 2692 * @param { string } cityID - Zone City ID. 2693 * @returns { TimeZone } a TimeZone Object from city ID. 2694 * @syscap SystemCapability.Global.I18n 2695 * @atomicservice 2696 * @since 12 2697 */ 2698 static getTimezoneFromCity(cityID: string): TimeZone; 2699 2700 /** 2701 * Get the possible time zones from the specified longitude and latitude. 2702 * 2703 * @param { number } longitude value 2704 * @param { number } latitude value 2705 * @returns { Array<TimeZone> } Returns a TimeZone array from the specified longitude and latitude. 2706 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2707 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 2708 * @syscap SystemCapability.Global.I18n 2709 * @since 10 2710 */ 2711 2712 /** 2713 * Get the possible time zones from the specified longitude and latitude. 2714 * 2715 * @param { number } longitude value 2716 * @param { number } latitude value 2717 * @returns { Array<TimeZone> } Returns a TimeZone array from the specified longitude and latitude. 2718 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2719 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 2720 * @syscap SystemCapability.Global.I18n 2721 * @atomicservice 2722 * @since 12 2723 */ 2724 static getTimezonesByLocation(longitude: number, latitude: number): Array<TimeZone>; 2725 } 2726 2727 /** 2728 * Provides the API for transliterate text from one format to another. 2729 * 2730 * @syscap SystemCapability.Global.I18n 2731 * @since 9 2732 */ 2733 /** 2734 * Provides the API for transliterate text from one format to another. 2735 * 2736 * @syscap SystemCapability.Global.I18n 2737 * @atomicservice 2738 * @since 12 2739 */ 2740 export class Transliterator { 2741 /** 2742 * Get a string array of all available transliterator ids. 2743 * 2744 * @returns { string[] } a string array of all available transliterator ids. 2745 * @syscap SystemCapability.Global.I18n 2746 * @since 9 2747 */ 2748 /** 2749 * Get a string array of all available transliterator ids. 2750 * 2751 * @returns { string[] } a string array of all available transliterator ids. 2752 * @syscap SystemCapability.Global.I18n 2753 * @atomicservice 2754 * @since 12 2755 */ 2756 static getAvailableIDs(): string[]; 2757 2758 /** 2759 * Get a Transliterator that is specified by id name. 2760 * 2761 * @param { string } id - specified the type of Transliterator. id is formed by source and dest. Transliterator will transliterate 2762 * the input string from source format to the dest format. For example, a Simplified Chinese to Latn 2763 * Transliterator will transform the text written in Chinese to Latn characters. 2764 * @returns { Transliterator } Transliterator that is specified by id name. 2765 * @syscap SystemCapability.Global.I18n 2766 * @since 9 2767 */ 2768 /** 2769 * Get a Transliterator that is specified by id name. 2770 * 2771 * @param { string } id - specified the type of Transliterator. id is formed by source and dest. Transliterator will transliterate 2772 * the input string from source format to the dest format. For example, a Simplified Chinese to Latn 2773 * Transliterator will transform the text written in Chinese to Latn characters. 2774 * @returns { Transliterator } Transliterator that is specified by id name. 2775 * @syscap SystemCapability.Global.I18n 2776 * @atomicservice 2777 * @since 12 2778 */ 2779 static getInstance(id: string): Transliterator; 2780 2781 /** 2782 * Transform the input text. 2783 * 2784 * @param { string } text - text to be transliterated. 2785 * @returns { string } the output text that is transliterated from source format to the dest format. 2786 * @syscap SystemCapability.Global.I18n 2787 * @since 9 2788 */ 2789 /** 2790 * Transform the input text. 2791 * 2792 * @param { string } text - text to be transliterated. 2793 * @returns { string } the output text that is transliterated from source format to the dest format. 2794 * @syscap SystemCapability.Global.I18n 2795 * @atomicservice 2796 * @since 12 2797 */ 2798 transform(text: string): string; 2799 } 2800 2801 /** 2802 * Enumerates the Normalizer modes. 2803 * 2804 * @enum { number } 2805 * @syscap SystemCapability.Global.I18n 2806 * @since 10 2807 */ 2808 /** 2809 * Enumerates the Normalizer modes. 2810 * 2811 * @enum { number } 2812 * @syscap SystemCapability.Global.I18n 2813 * @atomicservice 2814 * @since 12 2815 */ 2816 export enum NormalizerMode { 2817 /** 2818 * Normalization form C, characters are decomposed and then re-composed by canonical equivalence 2819 * 2820 * @syscap SystemCapability.Global.I18n 2821 * @since 10 2822 */ 2823 /** 2824 * Normalization form C, characters are decomposed and then re-composed by canonical equivalence 2825 * 2826 * @syscap SystemCapability.Global.I18n 2827 * @atomicservice 2828 * @since 12 2829 */ 2830 NFC = 1, 2831 /** 2832 * Normalization form D, characters are decomposed by canonical equivalence 2833 * 2834 * @syscap SystemCapability.Global.I18n 2835 * @since 10 2836 */ 2837 /** 2838 * Normalization form D, characters are decomposed by canonical equivalence 2839 * 2840 * @syscap SystemCapability.Global.I18n 2841 * @atomicservice 2842 * @since 12 2843 */ 2844 NFD = 2, 2845 /** 2846 * Normalization form KC, characters are decomposed by compatibility, then re-composed by canonical equivalence 2847 * 2848 * @syscap SystemCapability.Global.I18n 2849 * @since 10 2850 */ 2851 /** 2852 * Normalization form KC, characters are decomposed by compatibility, then re-composed by canonical equivalence 2853 * 2854 * @syscap SystemCapability.Global.I18n 2855 * @atomicservice 2856 * @since 12 2857 */ 2858 NFKC = 3, 2859 /** 2860 * Normalization form KD, characters are decomposed by compatibility 2861 * 2862 * @syscap SystemCapability.Global.I18n 2863 * @since 10 2864 */ 2865 /** 2866 * Normalization form KD, characters are decomposed by compatibility 2867 * 2868 * @syscap SystemCapability.Global.I18n 2869 * @atomicservice 2870 * @since 12 2871 */ 2872 NFKD = 4 2873 } 2874 2875 /** 2876 * Provides the API for text encoding normalization. 2877 * 2878 * @syscap SystemCapability.Global.I18n 2879 * @since 10 2880 */ 2881 /** 2882 * Provides the API for text encoding normalization. 2883 * 2884 * @syscap SystemCapability.Global.I18n 2885 * @atomicservice 2886 * @since 12 2887 */ 2888 export class Normalizer { 2889 /** 2890 * Get a Normalizer that is specified by normalize mode. 2891 * 2892 * @param { NormalizerMode } mode - specified the mode of Normalizer. It must be a valid mode. 2893 * @returns { Normalizer } Transliterator that is specified by id name. 2894 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2895 * @syscap SystemCapability.Global.I18n 2896 * @since 10 2897 */ 2898 /** 2899 * Get a Normalizer that is specified by normalize mode. 2900 * 2901 * @param { NormalizerMode } mode - specified the mode of Normalizer. It must be a valid mode. 2902 * @returns { Normalizer } Transliterator that is specified by id name. 2903 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2904 * @syscap SystemCapability.Global.I18n 2905 * @atomicservice 2906 * @since 12 2907 */ 2908 static getInstance(mode: NormalizerMode): Normalizer; 2909 2910 /** 2911 * Get a normalized string of specified mode. 2912 * 2913 * @param { string } text - text to normalized. 2914 * @returns { string } a normalized string from source. 2915 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2916 * @syscap SystemCapability.Global.I18n 2917 * @since 10 2918 */ 2919 /** 2920 * Get a normalized string of specified mode. 2921 * 2922 * @param { string } text - text to normalized. 2923 * @returns { string } a normalized string from source. 2924 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2925 * @syscap SystemCapability.Global.I18n 2926 * @atomicservice 2927 * @since 12 2928 */ 2929 normalize(text: string): string; 2930 } 2931 2932 /** 2933 * Enumerates the locale suggestion type modes. 2934 * 2935 * @enum { number } 2936 * @syscap SystemCapability.Global.I18n 2937 * @systemapi Hide this for inner system use. 2938 * @since 10 2939 */ 2940 export enum SuggestionType { 2941 /** 2942 * No correlation between language and region. 2943 * 2944 * @syscap SystemCapability.Global.I18n 2945 * @systemapi Hide this for inner system use. 2946 * @since 10 2947 */ 2948 SUGGESTION_TYPE_NONE = 0, 2949 /** 2950 * The language related to the specified region 2951 * 2952 * @syscap SystemCapability.Global.I18n 2953 * @systemapi Hide this for inner system use. 2954 * @since 10 2955 */ 2956 SUGGESTION_TYPE_RELATED = 1, 2957 /** 2958 * The region is SIM card region. 2959 * 2960 * @syscap SystemCapability.Global.I18n 2961 * @systemapi Hide this for inner system use. 2962 * @since 10 2963 */ 2964 SUGGESTION_TYPE_SIM = 2, 2965 } 2966 2967 /** 2968 * Provides the options which is used to sort the locales. 2969 * 2970 * @interface SortOptions 2971 * @syscap SystemCapability.Global.I18n 2972 * @systemapi Hide this for inner system use. 2973 * @since 10 2974 */ 2975 export interface SortOptions { 2976 /** 2977 * Locale code. 2978 * 2979 * @type { ?string } 2980 * @syscap SystemCapability.Global.I18n 2981 * @systemapi Hide this for inner system use. 2982 * @since 10 2983 */ 2984 locale?: string; 2985 2986 /** 2987 * Whether to use local names for sorting 2988 * 2989 * @type { ?boolean } 2990 * @syscap SystemCapability.Global.I18n 2991 * @systemapi Hide this for inner system use. 2992 * @since 10 2993 */ 2994 isUseLocalName?: boolean; 2995 2996 /** 2997 * Whether to put the suggested item at the top 2998 * 2999 * @type { ?boolean } 3000 * @syscap SystemCapability.Global.I18n 3001 * @systemapi Hide this for inner system use. 3002 * @since 10 3003 */ 3004 isSuggestedFirst?: boolean; 3005 } 3006 3007 /** 3008 * Provide information for a language or region 3009 * 3010 * @interface LocaleItem 3011 * @syscap SystemCapability.Global.I18n 3012 * @systemapi Hide this for inner system use. 3013 * @since 10 3014 */ 3015 export interface LocaleItem { 3016 /** 3017 * language or region id. 3018 * 3019 * @type { string } 3020 * @syscap SystemCapability.Global.I18n 3021 * @systemapi Hide this for inner system use. 3022 * @since 10 3023 */ 3024 id: string; 3025 3026 /** 3027 * The suggestion type of the language or region. 3028 * 3029 * @type { SuggestionType } 3030 * @syscap SystemCapability.Global.I18n 3031 * @systemapi Hide this for inner system use. 3032 * @since 10 3033 */ 3034 suggestionType: SuggestionType; 3035 3036 /** 3037 * The display name of the language or region in specified language 3038 * 3039 * @type { string } 3040 * @syscap SystemCapability.Global.I18n 3041 * @systemapi Hide this for inner system use. 3042 * @since 10 3043 */ 3044 displayName: string; 3045 3046 /** 3047 * The display name of the language or region in local language 3048 * @type { ?string } 3049 * @syscap SystemCapability.Global.I18n 3050 * @systemapi Hide this for inner system use. 3051 * @since 10 3052 */ 3053 localName?: string; 3054 } 3055 3056 /** 3057 * Provides the informations of one time zone city. 3058 * 3059 * @interface TimeZoneCityItem 3060 * @syscap SystemCapability.Global.I18n 3061 * @systemapi Hide this for inner system use. 3062 * @since 10 3063 */ 3064 export interface TimeZoneCityItem { 3065 /** 3066 * Time zone id. 3067 * 3068 * @type { string } 3069 * @syscap SystemCapability.Global.I18n 3070 * @systemapi Hide this for inner system use. 3071 * @since 10 3072 */ 3073 zoneId: string; 3074 3075 /** 3076 * City id. 3077 * 3078 * @type { string } 3079 * @syscap SystemCapability.Global.I18n 3080 * @systemapi Hide this for inner system use. 3081 * @since 10 3082 */ 3083 cityId: string; 3084 3085 /** 3086 * The display name of the city. 3087 * 3088 * @type { string } 3089 * @syscap SystemCapability.Global.I18n 3090 * @systemapi Hide this for inner system use. 3091 * @since 10 3092 */ 3093 cityDisplayName: string; 3094 3095 /** 3096 * The time zone offset for the city. 3097 * @type { number } 3098 * @syscap SystemCapability.Global.I18n 3099 * @systemapi Hide this for inner system use. 3100 * @since 10 3101 */ 3102 offset: number; 3103 3104 /** 3105 * The display name of the time zone for the city. 3106 * 3107 * @type { string } 3108 * @syscap SystemCapability.Global.I18n 3109 * @systemapi Hide this for inner system use. 3110 * @since 10 3111 */ 3112 zoneDisplayName: string; 3113 3114 /** 3115 * The time zone raw offset for the city. 3116 * @type { ?number } 3117 * @syscap SystemCapability.Global.I18n 3118 * @systemapi Hide this for inner system use. 3119 * @since 10 3120 */ 3121 rawOffset?: number; 3122 } 3123 3124 /** 3125 * Provide some functions for settings and startup guide to select language or region. 3126 * 3127 * @syscap SystemCapability.Global.I18n 3128 * @systemapi Hide this for inner system use. 3129 * @since 10 3130 */ 3131 export class SystemLocaleManager { 3132 /** 3133 * A constructor used to create a SystemLocaleManager object. 3134 * 3135 * @syscap SystemCapability.Global.I18n 3136 * @systemapi Hide this for inner system use. 3137 * @since 10 3138 */ 3139 constructor(); 3140 3141 /** 3142 * Obtains sorted language array for setting or startup guide app. 3143 * 3144 * @param { Array<string> } languages - The languages whose name will be sorted and displayed. 3145 * @param { SortOptions } options - Sort options for locale item. 3146 * @returns { Array<LocaleItem> } Locale Informations sorted for specified options. 3147 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3148 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3149 * @syscap SystemCapability.Global.I18n 3150 * @systemapi Hide this for inner system use. 3151 * @since 10 3152 */ 3153 /** 3154 * Obtains sorted language array for setting or startup guide app. 3155 * 3156 * @param { Array<string> } languages - The languages whose name will be sorted and displayed. 3157 * @param { SortOptions } options - Sort options for locale item. 3158 * @returns { Array<LocaleItem> } Locale Informations sorted for specified options. 3159 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 3160 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3161 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3162 * @syscap SystemCapability.Global.I18n 3163 * @systemapi Hide this for inner system use. 3164 * @since 12 3165 */ 3166 getLanguageInfoArray(languages: Array<string>, options?: SortOptions): Array<LocaleItem>; 3167 3168 /** 3169 * Obtains sorted region array for setting or startup guide app. 3170 * 3171 * @param { Array<string> } regions - The regions whose name will be sorted and displayed. 3172 * @param { SortOptions } options - Sort options for locale item. 3173 * @returns { Array<LocaleItem> } Locale Informations sorted for specified options. 3174 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3175 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3176 * @syscap SystemCapability.Global.I18n 3177 * @systemapi Hide this for inner system use. 3178 * @since 10 3179 */ 3180 /** 3181 * Obtains sorted region array for setting or startup guide app. 3182 * 3183 * @param { Array<string> } regions - The regions whose name will be sorted and displayed. 3184 * @param { SortOptions } options - Sort options for locale item. 3185 * @returns { Array<LocaleItem> } Locale Informations sorted for specified options. 3186 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 3187 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3188 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3189 * @syscap SystemCapability.Global.I18n 3190 * @systemapi Hide this for inner system use. 3191 * @since 12 3192 */ 3193 getRegionInfoArray(regions: Array<string>, options?: SortOptions): Array<LocaleItem>; 3194 3195 /** 3196 * Obtains sorted time zone city info array for showing time zone list 3197 * 3198 * @returns { Array<TimeZoneCityItem> } Time zone city information sorted by city name. 3199 * @syscap SystemCapability.Global.I18n 3200 * @systemapi Hide this for inner system use. 3201 * @since 10 3202 */ 3203 /** 3204 * Obtains sorted time zone city info array for showing time zone list 3205 * 3206 * @returns { Array<TimeZoneCityItem> } Time zone city information sorted by city name. 3207 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 3208 * @syscap SystemCapability.Global.I18n 3209 * @systemapi Hide this for inner system use. 3210 * @since 12 3211 */ 3212 static getTimeZoneCityItemArray(): Array<TimeZoneCityItem>; 3213 } 3214 3215 /** 3216 * Provides the informations of one holiday. 3217 * 3218 * @interface HolidayInfoItem 3219 * @syscap SystemCapability.Global.I18n 3220 * @since 11 3221 */ 3222 /** 3223 * Provides the informations of one holiday. 3224 * 3225 * @interface HolidayInfoItem 3226 * @syscap SystemCapability.Global.I18n 3227 * @atomicservice 3228 * @since 12 3229 */ 3230 export interface HolidayInfoItem { 3231 /** 3232 * Holiday base name. 3233 * 3234 * @type { string } 3235 * @syscap SystemCapability.Global.I18n 3236 * @since 11 3237 */ 3238 /** 3239 * Holiday base name. 3240 * 3241 * @type { string } 3242 * @syscap SystemCapability.Global.I18n 3243 * @atomicservice 3244 * @since 12 3245 */ 3246 baseName: string; 3247 3248 /** 3249 * Holiday start year. 3250 * 3251 * @type { number } 3252 * @syscap SystemCapability.Global.I18n 3253 * @since 11 3254 */ 3255 /** 3256 * Holiday start year. 3257 * 3258 * @type { number } 3259 * @syscap SystemCapability.Global.I18n 3260 * @atomicservice 3261 * @since 12 3262 */ 3263 year: number; 3264 3265 /** 3266 * Holiday start month. 3267 * 3268 * @type { number } 3269 * @syscap SystemCapability.Global.I18n 3270 * @since 11 3271 */ 3272 /** 3273 * Holiday start month. 3274 * 3275 * @type { number } 3276 * @syscap SystemCapability.Global.I18n 3277 * @atomicservice 3278 * @since 12 3279 */ 3280 month: number; 3281 3282 /** 3283 * Holiday start day. 3284 * 3285 * @type { number } 3286 * @syscap SystemCapability.Global.I18n 3287 * @since 11 3288 */ 3289 /** 3290 * Holiday start day. 3291 * 3292 * @type { number } 3293 * @syscap SystemCapability.Global.I18n 3294 * @atomicservice 3295 * @since 12 3296 */ 3297 day: number; 3298 3299 /** 3300 * Holiday local name array. 3301 * 3302 * @type { ?Array<HolidayLocalName> } 3303 * @syscap SystemCapability.Global.I18n 3304 * @since 11 3305 */ 3306 /** 3307 * Holiday local name array. 3308 * 3309 * @type { ?Array<HolidayLocalName> } 3310 * @syscap SystemCapability.Global.I18n 3311 * @atomicservice 3312 * @since 12 3313 */ 3314 localNames?: Array<HolidayLocalName>; 3315 } 3316 3317 /** 3318 * Provides the informations holiday locale name. 3319 * 3320 * @interface HolidayLocalName 3321 * @syscap SystemCapability.Global.I18n 3322 * @since 11 3323 */ 3324 /** 3325 * Provides the informations holiday locale name. 3326 * 3327 * @interface HolidayLocalName 3328 * @syscap SystemCapability.Global.I18n 3329 * @atomicservice 3330 * @since 12 3331 */ 3332 export interface HolidayLocalName { 3333 /** 3334 * Holiday locale name language id. 3335 * 3336 * @type { string } 3337 * @syscap SystemCapability.Global.I18n 3338 * @since 11 3339 */ 3340 /** 3341 * Holiday locale name language id. 3342 * 3343 * @type { string } 3344 * @syscap SystemCapability.Global.I18n 3345 * @atomicservice 3346 * @since 12 3347 */ 3348 language: string; 3349 3350 /** 3351 * Holiday local name. 3352 * 3353 * @type { string } 3354 * @syscap SystemCapability.Global.I18n 3355 * @since 11 3356 */ 3357 /** 3358 * Holiday local name. 3359 * 3360 * @type { string } 3361 * @syscap SystemCapability.Global.I18n 3362 * @atomicservice 3363 * @since 12 3364 */ 3365 name: string; 3366 } 3367 3368 /** 3369 * Provide some functions to manage holidays in a country or region. Partly follows the RFC2445 standard. 3370 * 3371 * @syscap SystemCapability.Global.I18n 3372 * @since 11 3373 */ 3374 /** 3375 * Provide some functions to manage holidays in a country or region. Partly follows the RFC2445 standard. 3376 * 3377 * @syscap SystemCapability.Global.I18n 3378 * @atomicservice 3379 * @since 12 3380 */ 3381 export class HolidayManager { 3382 /** 3383 * A constructor used to create a HolidayManager object. 3384 * 3385 * @param { String } icsPath - the path of the iCalendar format file to create HolidayManager object. 3386 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3387 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3388 * @syscap SystemCapability.Global.I18n 3389 * @since 11 3390 */ 3391 /** 3392 * A constructor used to create a HolidayManager object. 3393 * 3394 * @param { String } icsPath - the path of the iCalendar format file to create HolidayManager object. 3395 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3396 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3397 * @syscap SystemCapability.Global.I18n 3398 * @atomicservice 3399 * @since 12 3400 */ 3401 constructor(icsPath: String); 3402 3403 /** 3404 * Returns true if the given date is a holiday. If the date is not given, 3405 * the date object of current time is used. 3406 * 3407 * @param { Date } [date] - Date object whose attribute is desired. 3408 * @returns { boolean } whether the date is a holiday day. 3409 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3410 * @syscap SystemCapability.Global.I18n 3411 * @since 11 3412 */ 3413 /** 3414 * Returns true if the given date is a holiday. If the date is not given, 3415 * the date object of current time is used. 3416 * 3417 * @param { Date } [date] - Date object whose attribute is desired. 3418 * @returns { boolean } whether the date is a holiday day. 3419 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3420 * @syscap SystemCapability.Global.I18n 3421 * @atomicservice 3422 * @since 12 3423 */ 3424 isHoliday(date?: Date): boolean; 3425 3426 /** 3427 * Obtains holiday info array for a specified year 3428 * 3429 * @param { number } [year] - specified holiday year. If the year is not given, 3430 * the current year is used. 3431 * @returns { Array<HolidayInfoItem> } holiday information array for one year. 3432 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3433 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3434 * @syscap SystemCapability.Global.I18n 3435 * @since 11 3436 */ 3437 /** 3438 * Obtains holiday info array for a specified year 3439 * 3440 * @param { number } [year] - specified holiday year. If the year is not given, 3441 * the current year is used. 3442 * @returns { Array<HolidayInfoItem> } holiday information array for one year. 3443 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3444 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3445 * @syscap SystemCapability.Global.I18n 3446 * @atomicservice 3447 * @since 12 3448 */ 3449 getHolidayInfoItemArray(year?: number): Array<HolidayInfoItem>; 3450 } 3451 3452 /** 3453 * Provides the informations of one entity. 3454 * 3455 * @interface EntityInfoItem 3456 * @syscap SystemCapability.Global.I18n 3457 * @since 11 3458 */ 3459 /** 3460 * Provides the informations of one entity. 3461 * 3462 * @interface EntityInfoItem 3463 * @syscap SystemCapability.Global.I18n 3464 * @atomicservice 3465 * @since 12 3466 */ 3467 export interface EntityInfoItem { 3468 /** 3469 * Entity begin position. 3470 * 3471 * @type { number } 3472 * @syscap SystemCapability.Global.I18n 3473 * @since 11 3474 */ 3475 /** 3476 * Entity begin position. 3477 * 3478 * @type { number } 3479 * @syscap SystemCapability.Global.I18n 3480 * @atomicservice 3481 * @since 12 3482 */ 3483 begin: number; 3484 3485 /** 3486 * Entity end position. 3487 * 3488 * @type { number } 3489 * @syscap SystemCapability.Global.I18n 3490 * @since 11 3491 */ 3492 /** 3493 * Entity end position. 3494 * 3495 * @type { number } 3496 * @syscap SystemCapability.Global.I18n 3497 * @atomicservice 3498 * @since 12 3499 */ 3500 end: number; 3501 3502 /** 3503 * Entity type. Field values such as phone_number, date 3504 * 3505 * @type { string } 3506 * @syscap SystemCapability.Global.I18n 3507 * @since 11 3508 */ 3509 /** 3510 * Entity type. Field values such as phone_number, date 3511 * 3512 * @type { string } 3513 * @syscap SystemCapability.Global.I18n 3514 * @atomicservice 3515 * @since 12 3516 */ 3517 type: string; 3518 } 3519 3520 /** 3521 * Provide some functions to find named entity in text. 3522 * 3523 * @syscap SystemCapability.Global.I18n 3524 * @since 11 3525 */ 3526 /** 3527 * Provide some functions to find named entity in text. 3528 * 3529 * @syscap SystemCapability.Global.I18n 3530 * @atomicservice 3531 * @since 12 3532 */ 3533 export class EntityRecognizer { 3534 /** 3535 * A constructor used to create a EntityRecognizer object. 3536 * 3537 * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. 3538 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3539 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3540 * @syscap SystemCapability.Global.I18n 3541 * @since 11 3542 */ 3543 /** 3544 * A constructor used to create a EntityRecognizer object. 3545 * 3546 * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. 3547 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3548 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3549 * @syscap SystemCapability.Global.I18n 3550 * @atomicservice 3551 * @since 12 3552 */ 3553 constructor(locale?: string); 3554 3555 /** 3556 * Obtains holiday info array for a specified text 3557 * 3558 * @param { string } text - the text to find entities. 3559 * @returns { Array<EntityInfoItem> } entity information array found. 3560 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3561 * @syscap SystemCapability.Global.I18n 3562 * @since 11 3563 */ 3564 /** 3565 * Obtains holiday info array for a specified text 3566 * 3567 * @param { string } text - the text to find entities. 3568 * @returns { Array<EntityInfoItem> } entity information array found. 3569 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3570 * @syscap SystemCapability.Global.I18n 3571 * @atomicservice 3572 * @since 12 3573 */ 3574 findEntityInfo(text: string): Array<EntityInfoItem>; 3575 } 3576 3577 /** 3578 * Create a SimpleDateTimeFormat object by pattern and locale. 3579 * The default value of locale is the current system locale. 3580 * 3581 * @param { string } pattern - the pattern used to create SimpleDateTimeFormat object. 3582 * @param [ intl.Locale ] locale - the intl.Locale object used to create intl.DateTimeFormat object. 3583 * @returns { SimpleDateTimeFormat } a SimpleDateTimeFormat object created from pattern. 3584 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3585 * @syscap SystemCapability.Global.I18n 3586 * @atomicservice 3587 * @since 18 3588 */ 3589 export function getSimpleDateTimeFormatByPattern(pattern: string, locale?: intl.Locale): SimpleDateTimeFormat; 3590 3591 /** 3592 * Create a SimpleDateTimeFormat object by skeleton and locale. This method create a pattern by locale and skeleton, the pattern 3593 * includes locale specific separators, and the fields'order will be adjust for that locale. 3594 * The default value of locale is the current system locale. 3595 * 3596 * @param { string } skeleton - the skeleton used to create intl.DateTimeFormat object. 3597 * @param [ intl.Locale ] locale - the intl.Locale object used to create intl.DateTimeFormat object. 3598 * @returns { SimpleDateTimeFormat } a SimpleDateTimeFormat object created from skeleton. 3599 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3600 * @syscap SystemCapability.Global.I18n 3601 * @atomicservice 3602 * @since 18 3603 */ 3604 export function getSimpleDateTimeFormatBySkeleton(skeleton: string, locale?: intl.Locale): SimpleDateTimeFormat; 3605 3606 /** 3607 * Provide a simple date time formatting interface. 3608 * 3609 * @syscap SystemCapability.Global.I18n 3610 * @atomicservice 3611 * @since 18 3612 */ 3613 export class SimpleDateTimeFormat { 3614 /** 3615 * Obtains the formatted date strings. 3616 * 3617 * @param { Date } date - Indicates the Date object to be formatted. 3618 * @returns { string } a date string formatted based on the specified locale. 3619 * @syscap SystemCapability.Global.I18n 3620 * @atomicservice 3621 * @since 18 3622 */ 3623 format(date: Date): string; 3624 } 3625 3626 /** 3627 * Create a SimpleNumberFormat object by pattern and locale. 3628 * The default value of locale is the current system locale. 3629 * 3630 * @param { string } skeleton - the skeleton used to create SimpleNumberFormat object. 3631 * @param [ intl.Locale ] locale - the intl.Locale object used to create SimpleNumberFormat object. 3632 * @returns { SimpleNumberFormat } a SimpleNumberFormat object created from pattern. 3633 * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. 3634 * @syscap SystemCapability.Global.I18n 3635 * @crossplatform 3636 * @atomicservice 3637 * @since 18 3638 */ 3639 export function getSimpleNumberFormatBySkeleton(skeleton: string, locale?: intl.Locale): SimpleNumberFormat; 3640 3641 /** 3642 * Provide a simple number formatting interface. 3643 * 3644 * @syscap SystemCapability.Global.I18n 3645 * @atomicservice 3646 * @since 18 3647 */ 3648 export class SimpleNumberFormat { 3649 /** 3650 * Obtains the formatted number strings. 3651 * 3652 * @param { number } value - Indicates the number to be formatted. 3653 * @returns { string } a number string formatted based on the specified locale. 3654 * @syscap SystemCapability.Global.I18n 3655 * @atomicservice 3656 * @since 18 3657 */ 3658 format(value: number): string; 3659 } 3660 3661 /** 3662 * Provide a number formatting interface which could format number to StyleString. 3663 * 3664 * @syscap SystemCapability.Global.I18n 3665 * @atomicservice 3666 * @since 18 3667 */ 3668 export class StyledNumberFormat { 3669 /** 3670 * A constructor used to create a StyledNumberFormat object. 3671 * 3672 * @param { intl.NumberFormat | SimpleNumberFormat } numberFormat - Indicates the number format object that used to format number. 3673 * @param { StyledNumberFormatOptions } [ options ] - Indicates the options used to format the number. 3674 * @syscap SystemCapability.Global.I18n 3675 * @atomicservice 3676 * @since 18 3677 */ 3678 constructor(numberFormat: intl.NumberFormat | SimpleNumberFormat, options?: StyledNumberFormatOptions); 3679 3680 /** 3681 * Obtains the formatted number strings. 3682 * 3683 * @param { number } value - Indicates the number to be formatted. 3684 * @returns { StyledString } a styled number string formatted based on the specified locale. 3685 * @syscap SystemCapability.Global.I18n 3686 * @atomicservice 3687 * @since 18 3688 */ 3689 format(value: number): StyledString; 3690 } 3691 3692 /** 3693 * Provides the options of StyledNumberFormat. 3694 * 3695 * @interface StyledNumberFormatOptions 3696 * @syscap SystemCapability.Global.I18n 3697 * @atomicservice 3698 * @since 18 3699 */ 3700 export interface StyledNumberFormatOptions { 3701 /** 3702 * Indicates the integer part's style. 3703 * 3704 * @type { ?TextStyle } 3705 * @syscap SystemCapability.Global.I18n 3706 * @atomicservice 3707 * @since 18 3708 */ 3709 integer?: TextStyle; 3710 3711 /** 3712 * Indicates the decimal part's style. 3713 * 3714 * @type { ?TextStyle } 3715 * @syscap SystemCapability.Global.I18n 3716 * @atomicservice 3717 * @since 18 3718 */ 3719 decimal?: TextStyle; 3720 3721 /** 3722 * Indicates the fraction part's style. 3723 * 3724 * @type { ?TextStyle } 3725 * @syscap SystemCapability.Global.I18n 3726 * @atomicservice 3727 * @since 18 3728 */ 3729 fraction?: TextStyle; 3730 3731 /** 3732 * Indicates the unit part's style. 3733 * 3734 * @type { ?TextStyle } 3735 * @syscap SystemCapability.Global.I18n 3736 * @atomicservice 3737 * @since 18 3738 */ 3739 unit?: TextStyle; 3740 } 3741} 3742export default i18n; 3743