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 21/** 22 * Provides internationalization related APIs. 23 * 24 * @namespace intl 25 * @syscap SystemCapability.Global.I18n 26 * @since 6 27 */ 28/** 29 * Provides internationalization related APIs. 30 * 31 * @namespace intl 32 * @syscap SystemCapability.Global.I18n 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * Provides internationalization related APIs. 38 * 39 * @namespace intl 40 * @syscap SystemCapability.Global.I18n 41 * @crossplatform 42 * @form 43 * @since 11 44 */ 45/** 46 * Provides internationalization related APIs. 47 * 48 * @namespace intl 49 * @syscap SystemCapability.Global.I18n 50 * @crossplatform 51 * @form 52 * @atomicservice 53 * @since arkts {'1.1':'12', '1.2':'20'} 54 * @arkts 1.1&1.2 55 */ 56declare namespace intl { 57 /** 58 * Provides the options of Locale. 59 * 60 * @interface LocaleOptions 61 * @syscap SystemCapability.Global.I18n 62 * @since 6 63 */ 64 /** 65 * Provides the options of Locale. 66 * 67 * @interface LocaleOptions 68 * @syscap SystemCapability.Global.I18n 69 * @crossplatform 70 * @since 10 71 */ 72 /** 73 * Provides the options of Locale. 74 * 75 * @interface LocaleOptions 76 * @syscap SystemCapability.Global.I18n 77 * @crossplatform 78 * @form 79 * @since 11 80 */ 81 /** 82 * Provides the options of Locale. 83 * 84 * @interface LocaleOptions 85 * @syscap SystemCapability.Global.I18n 86 * @crossplatform 87 * @form 88 * @atomicservice 89 * @since 12 90 * @deprecated since 20 91 * @useinstead Intl.LocaleOptions 92 */ 93 export interface LocaleOptions { 94 /** 95 * Indicates the calendar. 96 * 97 * @type { string } 98 * @syscap SystemCapability.Global.I18n 99 * @since 6 100 */ 101 /** 102 * Indicates the calendar. 103 * 104 * @type { ?string } 105 * @syscap SystemCapability.Global.I18n 106 * @since 9 107 */ 108 /** 109 * Indicates the calendar. 110 * 111 * @type { ?string } 112 * @syscap SystemCapability.Global.I18n 113 * @crossplatform 114 * @since 10 115 */ 116 /** 117 * Indicates the calendar. 118 * 119 * @type { ?string } 120 * @syscap SystemCapability.Global.I18n 121 * @crossplatform 122 * @form 123 * @since 11 124 */ 125 /** 126 * Calendar parameter. The value can be: "buddhist", "chinese", "coptic", "dangi", "ethioaa", "ethiopic", 127 * "gregory", "hebrew", "indian", "islamic", "islamic-umalqura", "islamic-tbla", "islamic-civil", 128 * "islamic-rgsa", "iso8601", "japanese", "persian", "roc", or "islamicc". 129 * 130 * @type { ?string } 131 * @syscap SystemCapability.Global.I18n 132 * @crossplatform 133 * @form 134 * @atomicservice 135 * @since 12 136 * @deprecated since 20 137 * @useinstead Intl.LocaleOptions.calendar 138 */ 139 calendar?: string; 140 141 /** 142 * Indicates the collation. 143 * 144 * @type { string } 145 * @syscap SystemCapability.Global.I18n 146 * @since 6 147 */ 148 /** 149 * Indicates the collation. 150 * 151 * @type { ?string } 152 * @syscap SystemCapability.Global.I18n 153 * @since 9 154 */ 155 /** 156 * Indicates the collation. 157 * 158 * @type { ?string } 159 * @syscap SystemCapability.Global.I18n 160 * @crossplatform 161 * @since 10 162 */ 163 /** 164 * Indicates the collation. 165 * 166 * @type { ?string } 167 * @syscap SystemCapability.Global.I18n 168 * @crossplatform 169 * @form 170 * @since 11 171 */ 172 /** 173 * Collation parameter. The value can be: "big5han", "compat", "dict", "direct", "ducet", "emoji", "eor", "gb2312", 174 * "phonebk", "phonetic", "pinyin", "reformed, "search", "searchjl", "standard", "stroke", "trad", "unihan", "zhuyin" 175 * 176 * @type { ?string } 177 * @syscap SystemCapability.Global.I18n 178 * @crossplatform 179 * @form 180 * @atomicservice 181 * @since 12 182 * @deprecated since 20 183 * @useinstead Intl.LocaleOptions.collation 184 */ 185 collation?: string; 186 187 /** 188 * Indicates the hourCycle. 189 * 190 * @type { string } 191 * @syscap SystemCapability.Global.I18n 192 * @since 6 193 */ 194 /** 195 * Indicates the hourCycle. 196 * 197 * @type { ?string } 198 * @syscap SystemCapability.Global.I18n 199 * @since 9 200 */ 201 /** 202 * Indicates the hourCycle. 203 * 204 * @type { ?string } 205 * @syscap SystemCapability.Global.I18n 206 * @crossplatform 207 * @since 10 208 */ 209 /** 210 * Indicates the hourCycle. 211 * 212 * @type { ?string } 213 * @syscap SystemCapability.Global.I18n 214 * @crossplatform 215 * @form 216 * @since 11 217 */ 218 /** 219 * Hour cycle. The value can be: "h11", "h12", "h23", or "h24". 220 * 221 * @type { ?string } 222 * @syscap SystemCapability.Global.I18n 223 * @crossplatform 224 * @form 225 * @atomicservice 226 * @since 12 227 * @deprecated since 20 228 * @useinstead Intl.LocaleOptions.hourCycle 229 */ 230 hourCycle?: string; 231 232 /** 233 * Indicates the numberingSystem. 234 * 235 * @type { string } 236 * @syscap SystemCapability.Global.I18n 237 * @since 6 238 */ 239 /** 240 * Indicates the numberingSystem. 241 * 242 * @type { ?string } 243 * @syscap SystemCapability.Global.I18n 244 * @since 9 245 */ 246 /** 247 * Indicates the numberingSystem. 248 * 249 * @type { ?string } 250 * @syscap SystemCapability.Global.I18n 251 * @crossplatform 252 * @since 10 253 */ 254 /** 255 * Indicates the numberingSystem. 256 * 257 * @type { ?string } 258 * @syscap SystemCapability.Global.I18n 259 * @crossplatform 260 * @form 261 * @since 11 262 */ 263 /** 264 * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", "brah", "cakm", 265 * "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", "java", "kali", 266 * "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", "mathmono", 267 * "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", "newa", "nkoo", 268 * "olck", "orya*", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", "takr", "talu", 269 * "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". 270 * 271 * @type { ?string } 272 * @syscap SystemCapability.Global.I18n 273 * @crossplatform 274 * @form 275 * @atomicservice 276 * @since 12 277 * @deprecated since 20 278 * @useinstead Intl.LocaleOptions.numberingSystem 279 */ 280 numberingSystem?: string; 281 282 /** 283 * Indicates the numeric. 284 * 285 * @type { boolean } 286 * @syscap SystemCapability.Global.I18n 287 * @since 6 288 */ 289 /** 290 * Indicates the numeric. 291 * 292 * @type { ?boolean } 293 * @syscap SystemCapability.Global.I18n 294 * @since 9 295 */ 296 /** 297 * Indicates the numeric. 298 * 299 * @type { ?boolean } 300 * @syscap SystemCapability.Global.I18n 301 * @crossplatform 302 * @since 10 303 */ 304 /** 305 * Indicates the numeric. 306 * 307 * @type { ?boolean } 308 * @syscap SystemCapability.Global.I18n 309 * @crossplatform 310 * @form 311 * @since 11 312 */ 313 /** 314 * Wether to use special sorting rules for digits. The value "true" means to use special sorting rules for digits, 315 * and the value "false" means the opposite. The default value is "false". 316 * 317 * @type { ?boolean } 318 * @syscap SystemCapability.Global.I18n 319 * @crossplatform 320 * @form 321 * @atomicservice 322 * @since 12 323 * @deprecated since 20 324 * @useinstead Intl.LocaleOptions.numeric 325 */ 326 numeric?: boolean; 327 328 /** 329 * Indicates the caseFirst. 330 * 331 * @type { string } 332 * @syscap SystemCapability.Global.I18n 333 * @since 6 334 */ 335 /** 336 * Indicates the caseFirst. 337 * 338 * @type { ?string } 339 * @syscap SystemCapability.Global.I18n 340 * @since 9 341 */ 342 /** 343 * Indicates the caseFirst. 344 * 345 * @type { ?string } 346 * @syscap SystemCapability.Global.I18n 347 * @crossplatform 348 * @since 10 349 */ 350 /** 351 * Indicates the caseFirst. 352 * 353 * @type { ?string } 354 * @syscap SystemCapability.Global.I18n 355 * @crossplatform 356 * @form 357 * @since 11 358 */ 359 /** 360 * Whether upper case or lower case is sorted first. The value can be "upper", "lower", or "false". 361 * 362 * @type { ?string } 363 * @syscap SystemCapability.Global.I18n 364 * @crossplatform 365 * @form 366 * @atomicservice 367 * @since 12 368 * @deprecated since 20 369 * @useinstead Intl.LocaleOptions.caseFirst 370 */ 371 caseFirst?: string; 372 } 373 374 /** 375 * Provides APIs for obtaining locale information. 376 * 377 * @syscap SystemCapability.Global.I18n 378 * @since 6 379 */ 380 /** 381 * Provides APIs for obtaining locale information. 382 * 383 * @syscap SystemCapability.Global.I18n 384 * @crossplatform 385 * @since 10 386 */ 387 /** 388 * Provides APIs for obtaining locale information. 389 * 390 * @syscap SystemCapability.Global.I18n 391 * @crossplatform 392 * @form 393 * @since 11 394 */ 395 /** 396 * Provides APIs for obtaining locale information. 397 * 398 * @syscap SystemCapability.Global.I18n 399 * @crossplatform 400 * @form 401 * @atomicservice 402 * @since 12 403 * @deprecated since 20 404 * @useinstead Intl.Locale 405 */ 406 export class Locale { 407 /** 408 * A constructor used to create a Locale object. 409 * 410 * @syscap SystemCapability.Global.I18n 411 * @since 8 412 */ 413 /** 414 * A constructor used to create a Locale object. 415 * 416 * @syscap SystemCapability.Global.I18n 417 * @crossplatform 418 * @since 10 419 */ 420 /** 421 * A constructor used to create a Locale object. 422 * 423 * @syscap SystemCapability.Global.I18n 424 * @crossplatform 425 * @form 426 * @since 11 427 */ 428 /** 429 * Creates a Locale object. 430 * 431 * @syscap SystemCapability.Global.I18n 432 * @crossplatform 433 * @form 434 * @atomicservice 435 * @since 12 436 * @deprecated since 20 437 * @useinstead i18n.System.getSystemLocaleInstance 438 */ 439 constructor(); 440 441 /** 442 * A constructor used to create a Locale object. 443 * 444 * @param { string } locale - Indicates a character string containing the locale information, including 445 * the language and optionally the script and region. 446 * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. 447 * @syscap SystemCapability.Global.I18n 448 * @since 6 449 */ 450 /** 451 * A constructor used to create a Locale object. 452 * 453 * @param { string } locale - Indicates a character string containing the locale information, including 454 * the language and optionally the script and region. 455 * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. 456 * @syscap SystemCapability.Global.I18n 457 * @crossplatform 458 * @since 10 459 */ 460 /** 461 * A constructor used to create a Locale object. 462 * 463 * @param { string } locale - Indicates a character string containing the locale information, including 464 * the language and optionally the script and region. 465 * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. 466 * @syscap SystemCapability.Global.I18n 467 * @crossplatform 468 * @form 469 * @since 11 470 */ 471 /** 472 * Creates a Locale object. 473 * 474 * @param { string } locale - Locale information, which consists of the language, script, and country/region. 475 * @param { LocaleOptions } [options] - Options for creating the Locale object. 476 * @syscap SystemCapability.Global.I18n 477 * @crossplatform 478 * @form 479 * @atomicservice 480 * @since 12 481 * @deprecated since 20 482 * @useinstead Intl.Locale.constructor 483 */ 484 constructor(locale: string, options?: LocaleOptions); 485 486 /** 487 * Indicates the language of the locale. 488 * 489 * @syscap SystemCapability.Global.I18n 490 * @since 6 491 */ 492 /** 493 * Indicates the language of the locale. 494 * 495 * @syscap SystemCapability.Global.I18n 496 * @crossplatform 497 * @since 10 498 */ 499 /** 500 * Indicates the language of the locale. 501 * 502 * @syscap SystemCapability.Global.I18n 503 * @crossplatform 504 * @form 505 * @since 11 506 */ 507 /** 508 * Language associated with the locale, for example, "zh". The value complies with the ISO 639 standard. 509 * 510 * @type { string } 511 * @syscap SystemCapability.Global.I18n 512 * @crossplatform 513 * @form 514 * @atomicservice 515 * @since 12 516 * @deprecated since 20 517 * @useinstead Intl.Locale.language 518 */ 519 language: string; 520 521 /** 522 * Indicates the script of the locale. 523 * 524 * @syscap SystemCapability.Global.I18n 525 * @since 6 526 */ 527 /** 528 * Indicates the script of the locale. 529 * 530 * @syscap SystemCapability.Global.I18n 531 * @crossplatform 532 * @since 10 533 */ 534 /** 535 * Indicates the script of the locale. 536 * 537 * @syscap SystemCapability.Global.I18n 538 * @crossplatform 539 * @form 540 * @since 11 541 */ 542 /** 543 * Script type of the language, for example, "Hans". The value complies with the Unicode ISO 15924 standard. 544 * 545 * @type { string } 546 * @syscap SystemCapability.Global.I18n 547 * @crossplatform 548 * @form 549 * @atomicservice 550 * @since 12 551 * @deprecated since 20 552 * @useinstead Intl.Locale.script 553 */ 554 script: string; 555 556 /** 557 * Indicates the region of the locale. 558 * 559 * @syscap SystemCapability.Global.I18n 560 * @since 6 561 */ 562 /** 563 * Indicates the region of the locale. 564 * 565 * @syscap SystemCapability.Global.I18n 566 * @crossplatform 567 * @since 10 568 */ 569 /** 570 * Indicates the region of the locale. 571 * 572 * @syscap SystemCapability.Global.I18n 573 * @crossplatform 574 * @form 575 * @since 11 576 */ 577 /** 578 * Country/region associated with the locale, for example, "CN". The value complies with the ISO 3166 standard. 579 * 580 * @type { string } 581 * @syscap SystemCapability.Global.I18n 582 * @crossplatform 583 * @form 584 * @atomicservice 585 * @since 12 586 * @deprecated since 20 587 * @useinstead Intl.Locale.region 588 */ 589 region: string; 590 591 /** 592 * Indicates the basic locale information, which is returned as a substring of 593 * a complete locale string. 594 * 595 * @syscap SystemCapability.Global.I18n 596 * @since 6 597 */ 598 /** 599 * Indicates the basic locale information, which is returned as a substring of 600 * a complete locale string. 601 * 602 * @syscap SystemCapability.Global.I18n 603 * @crossplatform 604 * @since 10 605 */ 606 /** 607 * Indicates the basic locale information, which is returned as a substring of 608 * a complete locale string. 609 * 610 * @syscap SystemCapability.Global.I18n 611 * @crossplatform 612 * @form 613 * @since 11 614 */ 615 /** 616 * Locale information, which consists of the language, script, and country/region, for example, "zh-Hans-CN". 617 * 618 * @type { string } 619 * @syscap SystemCapability.Global.I18n 620 * @crossplatform 621 * @form 622 * @atomicservice 623 * @since 12 624 * @deprecated since 20 625 * @useinstead Intl.Locale.baseName 626 */ 627 baseName: string; 628 629 /** 630 * Indicates the case first style of the locale. 631 * 632 * @syscap SystemCapability.Global.I18n 633 * @since 6 634 */ 635 /** 636 * Indicates the case first style of the locale. 637 * 638 * @syscap SystemCapability.Global.I18n 639 * @crossplatform 640 * @since 10 641 */ 642 /** 643 * Indicates the case first style of the locale. 644 * 645 * @syscap SystemCapability.Global.I18n 646 * @crossplatform 647 * @form 648 * @since 11 649 */ 650 /** 651 * Whether case is taken into account for the locale's collation rules. The value can be: "upper", "lower", or 652 * "false". 653 * 654 * @type { string } 655 * @syscap SystemCapability.Global.I18n 656 * @crossplatform 657 * @form 658 * @atomicservice 659 * @since 12 660 * @deprecated since 20 661 * @useinstead Intl.Locale.caseFirst 662 */ 663 caseFirst: string; 664 665 /** 666 * Indicates the calendar. 667 * 668 * @syscap SystemCapability.Global.I18n 669 * @since 6 670 */ 671 /** 672 * Indicates the calendar. 673 * 674 * @syscap SystemCapability.Global.I18n 675 * @crossplatform 676 * @since 10 677 */ 678 /** 679 * Indicates the calendar. 680 * 681 * @syscap SystemCapability.Global.I18n 682 * @crossplatform 683 * @form 684 * @since 11 685 */ 686 /** 687 * Calendar for the locale. The value can be: "buddhist", "chinese", "coptic", "dangi", "ethioaa", "ethiopic", 688 * "gregory", "hebrew", "indian", "islamic", "islamic-umalqura", "islamic-tbla", "islamic-civil", "islamic-rgsa", 689 * "iso8601", "japanese", "persian", "roc", or "islamicc". 690 * 691 * @type { string } 692 * @syscap SystemCapability.Global.I18n 693 * @crossplatform 694 * @form 695 * @atomicservice 696 * @since 12 697 * @deprecated since 20 698 * @useinstead Intl.Locale.calendar 699 */ 700 calendar: string; 701 702 /** 703 * Indicates the collation. 704 * 705 * @syscap SystemCapability.Global.I18n 706 * @since 6 707 */ 708 /** 709 * Indicates the collation. 710 * 711 * @syscap SystemCapability.Global.I18n 712 * @crossplatform 713 * @since 10 714 */ 715 /** 716 * Indicates the collation. 717 * 718 * @syscap SystemCapability.Global.I18n 719 * @crossplatform 720 * @form 721 * @since 11 722 */ 723 /** 724 * Collation rules for the locale. The value can be: "big5han", "compat", "dict", "direct", "ducet", "eor", 725 * "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "searchjl", "stroke", "trad", "unihan", or "zhuyin". 726 * 727 * @type { string } 728 * @syscap SystemCapability.Global.I18n 729 * @crossplatform 730 * @form 731 * @atomicservice 732 * @since 12 733 * @deprecated since 20 734 * @useinstead Intl.Locale.collation 735 */ 736 collation: string; 737 738 /** 739 * Indicates the hour cycle. 740 * 741 * @syscap SystemCapability.Global.I18n 742 * @since 6 743 */ 744 /** 745 * Indicates the hour cycle. 746 * 747 * @syscap SystemCapability.Global.I18n 748 * @crossplatform 749 * @since 10 750 */ 751 /** 752 * Indicates the hour cycle. 753 * 754 * @syscap SystemCapability.Global.I18n 755 * @crossplatform 756 * @form 757 * @since 11 758 */ 759 /** 760 * Time system for the locale. The value can be: "h11", "h12", "h23", or "h24". 761 * 762 * @type { string } 763 * @syscap SystemCapability.Global.I18n 764 * @crossplatform 765 * @form 766 * @atomicservice 767 * @since 12 768 * @deprecated since 20 769 * @useinstead Intl.Locale.hourCycle 770 */ 771 hourCycle: string; 772 773 /** 774 * Indicates the numbering system. 775 * 776 * @syscap SystemCapability.Global.I18n 777 * @since 6 778 */ 779 /** 780 * Indicates the numbering system. 781 * 782 * @syscap SystemCapability.Global.I18n 783 * @crossplatform 784 * @since 10 785 */ 786 /** 787 * Indicates the numbering system. 788 * 789 * @syscap SystemCapability.Global.I18n 790 * @crossplatform 791 * @form 792 * @since 11 793 */ 794 /** 795 * Numbering system for the locale. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", 796 * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", 797 * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", 798 * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", 799 * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", 800 * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". 801 * 802 * @type { string } 803 * @syscap SystemCapability.Global.I18n 804 * @crossplatform 805 * @form 806 * @atomicservice 807 * @since 12 808 * @deprecated since 20 809 * @useinstead Intl.Locale.numberingSystem 810 */ 811 numberingSystem: string; 812 813 /** 814 * Indicates whether it is numeric. 815 * 816 * @syscap SystemCapability.Global.I18n 817 * @since 6 818 */ 819 /** 820 * Indicates whether it is numeric. 821 * 822 * @syscap SystemCapability.Global.I18n 823 * @crossplatform 824 * @since 10 825 */ 826 /** 827 * Indicates whether it is numeric. 828 * 829 * @syscap SystemCapability.Global.I18n 830 * @crossplatform 831 * @form 832 * @since 11 833 */ 834 /** 835 * Wether to use special sorting rules for digits. The value "true" means to use special sorting rules for digits, 836 * and the value "false" means the opposite. The default value is "false". 837 * 838 * @type { boolean } 839 * @syscap SystemCapability.Global.I18n 840 * @crossplatform 841 * @form 842 * @atomicservice 843 * @since 12 844 * @deprecated since 20 845 * @useinstead Intl.Locale.numeric 846 */ 847 numeric: boolean; 848 849 /** 850 * Convert the locale information to string. 851 * 852 * @returns { string } locale information in string form. 853 * @syscap SystemCapability.Global.I18n 854 * @since 6 855 */ 856 /** 857 * Convert the locale information to string. 858 * 859 * @returns { string } locale information in string form. 860 * @syscap SystemCapability.Global.I18n 861 * @crossplatform 862 * @since 10 863 */ 864 /** 865 * Convert the locale information to string. 866 * 867 * @returns { string } locale information in string form. 868 * @syscap SystemCapability.Global.I18n 869 * @crossplatform 870 * @form 871 * @since 11 872 */ 873 /** 874 * Obtains the string that represents a Locale object. 875 * 876 * @returns { string } String that represents the Locale object. 877 * @syscap SystemCapability.Global.I18n 878 * @crossplatform 879 * @form 880 * @atomicservice 881 * @since 12 882 * @deprecated since 20 883 * @useinstead Intl.Locale.toString 884 */ 885 toString(): string; 886 887 /** 888 * Maximize the locale's base information. 889 * 890 * @returns { Locale } maximized locale. 891 * @syscap SystemCapability.Global.I18n 892 * @since 6 893 */ 894 /** 895 * Maximize the locale's base information. 896 * 897 * @returns { Locale } maximized locale. 898 * @syscap SystemCapability.Global.I18n 899 * @crossplatform 900 * @since 10 901 */ 902 /** 903 * Maximize the locale's base information. 904 * 905 * @returns { Locale } maximized locale. 906 * @syscap SystemCapability.Global.I18n 907 * @crossplatform 908 * @form 909 * @since 11 910 */ 911 /** 912 * Maximizes locale information by supplementing the missing script and country/region information. 913 * 914 * @returns { Locale } Locale object with the script and country/region information. 915 * @syscap SystemCapability.Global.I18n 916 * @crossplatform 917 * @form 918 * @atomicservice 919 * @since 12 920 * @deprecated since 20 921 * @useinstead Intl.Locale.maximize 922 */ 923 maximize(): Locale; 924 925 /** 926 * Minimize the locale's base information. 927 * 928 * @returns { Locale } minimized locale. 929 * @syscap SystemCapability.Global.I18n 930 * @since 6 931 */ 932 /** 933 * Minimize the locale's base information. 934 * 935 * @returns { Locale } minimized locale. 936 * @syscap SystemCapability.Global.I18n 937 * @crossplatform 938 * @since 10 939 */ 940 /** 941 * Minimize the locale's base information. 942 * 943 * @returns { Locale } minimized locale. 944 * @syscap SystemCapability.Global.I18n 945 * @crossplatform 946 * @form 947 * @since 11 948 */ 949 /** 950 * Minimizes locale information by removing the script and country/region information. 951 * 952 * @returns { Locale } Locale object without the script and country/region information. 953 * @syscap SystemCapability.Global.I18n 954 * @crossplatform 955 * @form 956 * @atomicservice 957 * @since 12 958 * @deprecated since 20 959 * @useinstead Intl.Locale.minimize 960 */ 961 minimize(): Locale; 962 } 963 964 /** 965 * Provides the options of date time format. 966 * 967 * @interface DateTimeOptions 968 * @syscap SystemCapability.Global.I18n 969 * @since 6 970 */ 971 /** 972 * Provides the options of date time format. 973 * 974 * @interface DateTimeOptions 975 * @syscap SystemCapability.Global.I18n 976 * @crossplatform 977 * @since 10 978 */ 979 /** 980 * Provides the options of date time format. 981 * 982 * @interface DateTimeOptions 983 * @syscap SystemCapability.Global.I18n 984 * @crossplatform 985 * @form 986 * @since 11 987 */ 988 /** 989 * Defines the options for a DateTimeOptions object. Since API version 9, the DateTimeOptions attribute is changed 990 * from mandatory to optional. 991 * 992 * @interface DateTimeOptions 993 * @syscap SystemCapability.Global.I18n 994 * @crossplatform 995 * @form 996 * @atomicservice 997 * @since arkts {'1.1':'12', '1.2':'20'} 998 * @deprecated since 20 999 * @useinstead Intl.DateTimeFormatOptions 1000 * @arkts 1.1&1.2 1001 */ 1002 export interface DateTimeOptions { 1003 /** 1004 * Indicates the locale. 1005 * 1006 * @type { string } 1007 * @syscap SystemCapability.Global.I18n 1008 * @since 6 1009 */ 1010 /** 1011 * Indicates the locale. 1012 * 1013 * @type { ?string } 1014 * @syscap SystemCapability.Global.I18n 1015 * @since 9 1016 */ 1017 /** 1018 * Indicates the locale. 1019 * 1020 * @type { ?string } 1021 * @syscap SystemCapability.Global.I18n 1022 * @crossplatform 1023 * @since 10 1024 */ 1025 /** 1026 * Indicates the locale. 1027 * 1028 * @type { ?string } 1029 * @syscap SystemCapability.Global.I18n 1030 * @crossplatform 1031 * @form 1032 * @since 11 1033 */ 1034 /** 1035 * Valid locale ID, for example, "zh-Hans-CN". The default value is the current system locale. 1036 * 1037 * @type { ?string } 1038 * @syscap SystemCapability.Global.I18n 1039 * @crossplatform 1040 * @form 1041 * @atomicservice 1042 * @since arkts {'1.1':'12', '1.2':'20'} 1043 * @deprecated since 20 1044 * @arkts 1.1&1.2 1045 */ 1046 locale?: string; 1047 1048 /** 1049 * Indicates the dateStyle. 1050 * 1051 * @type { string } 1052 * @syscap SystemCapability.Global.I18n 1053 * @since 6 1054 */ 1055 /** 1056 * Indicates the dateStyle. 1057 * 1058 * @type { ?string } 1059 * @syscap SystemCapability.Global.I18n 1060 * @since 9 1061 */ 1062 /** 1063 * Indicates the dateStyle. 1064 * 1065 * @type { ?string } 1066 * @syscap SystemCapability.Global.I18n 1067 * @crossplatform 1068 * @since 10 1069 */ 1070 /** 1071 * Indicates the dateStyle. 1072 * 1073 * @type { ?string } 1074 * @syscap SystemCapability.Global.I18n 1075 * @crossplatform 1076 * @form 1077 * @since 11 1078 */ 1079 /** 1080 * Date display format. The value can be: "long", "short", "medium", "full", or "auto". 1081 * 1082 * @type { ?string } 1083 * @syscap SystemCapability.Global.I18n 1084 * @crossplatform 1085 * @form 1086 * @atomicservice 1087 * @since arkts {'1.1':'12', '1.2':'20'} 1088 * @deprecated since 20 1089 * @useinstead Intl.DateTimeFormatOptions.dateStyle 1090 * @arkts 1.1&1.2 1091 */ 1092 dateStyle?: string; 1093 1094 /** 1095 * Indicates the timeStyle. 1096 * 1097 * @type { string } 1098 * @syscap SystemCapability.Global.I18n 1099 * @since 6 1100 */ 1101 /** 1102 * Indicates the timeStyle. 1103 * 1104 * @type { ?string } 1105 * @syscap SystemCapability.Global.I18n 1106 * @since 9 1107 */ 1108 /** 1109 * Indicates the timeStyle. 1110 * 1111 * @type { ?string } 1112 * @syscap SystemCapability.Global.I18n 1113 * @crossplatform 1114 * @since 10 1115 */ 1116 /** 1117 * Indicates the timeStyle. 1118 * 1119 * @type { ?string } 1120 * @syscap SystemCapability.Global.I18n 1121 * @crossplatform 1122 * @form 1123 * @since 11 1124 */ 1125 /** 1126 * Time display format. The value can be: "long", "short", "medium", "full", or "auto". 1127 * 1128 * @type { ?string } 1129 * @syscap SystemCapability.Global.I18n 1130 * @crossplatform 1131 * @form 1132 * @atomicservice 1133 * @since arkts {'1.1':'12', '1.2':'20'} 1134 * @deprecated since 20 1135 * @useinstead Intl.DateTimeFormatOptions.timeStyle 1136 * @arkts 1.1&1.2 1137 */ 1138 timeStyle?: string; 1139 1140 /** 1141 * Indicates the hourCycle. 1142 * 1143 * @type { string } 1144 * @syscap SystemCapability.Global.I18n 1145 * @since 6 1146 */ 1147 /** 1148 * Indicates the hourCycle. 1149 * 1150 * @type { ?string } 1151 * @syscap SystemCapability.Global.I18n 1152 * @since 9 1153 */ 1154 /** 1155 * Indicates the hourCycle. 1156 * 1157 * @type { ?string } 1158 * @syscap SystemCapability.Global.I18n 1159 * @crossplatform 1160 * @since 10 1161 */ 1162 /** 1163 * Indicates the hourCycle. 1164 * 1165 * @type { ?string } 1166 * @syscap SystemCapability.Global.I18n 1167 * @crossplatform 1168 * @form 1169 * @since 11 1170 */ 1171 /** 1172 * Hour cycle. The value can be: "h11", "h12", "h23", or "h24". 1173 * 1174 * @type { ?string } 1175 * @syscap SystemCapability.Global.I18n 1176 * @crossplatform 1177 * @form 1178 * @atomicservice 1179 * @since arkts {'1.1':'12', '1.2':'20'} 1180 * @deprecated since 20 1181 * @useinstead Intl.DateTimeFormatOptions.hourCycle 1182 * @arkts 1.1&1.2 1183 */ 1184 hourCycle?: string; 1185 1186 /** 1187 * Indicates the timeZone. 1188 * 1189 * @type { string } 1190 * @syscap SystemCapability.Global.I18n 1191 * @since 6 1192 */ 1193 /** 1194 * Indicates the timeZone. 1195 * 1196 * @type { ?string } 1197 * @syscap SystemCapability.Global.I18n 1198 * @since 9 1199 */ 1200 /** 1201 * Indicates the timeZone. 1202 * 1203 * @type { ?string } 1204 * @syscap SystemCapability.Global.I18n 1205 * @crossplatform 1206 * @since 10 1207 */ 1208 /** 1209 * Indicates the timeZone. 1210 * 1211 * @type { ?string } 1212 * @syscap SystemCapability.Global.I18n 1213 * @crossplatform 1214 * @form 1215 * @since 11 1216 */ 1217 /** 1218 * Time zone in use. The value is a valid IANA time zone ID. 1219 * 1220 * @type { ?string } 1221 * @syscap SystemCapability.Global.I18n 1222 * @crossplatform 1223 * @form 1224 * @atomicservice 1225 * @since arkts {'1.1':'12', '1.2':'20'} 1226 * @deprecated since 20 1227 * @useinstead Intl.DateTimeFormatOptions.timeZone 1228 * @arkts 1.1&1.2 1229 */ 1230 timeZone?: string; 1231 1232 /** 1233 * Indicates the numberingSystem. 1234 * 1235 * @type { string } 1236 * @syscap SystemCapability.Global.I18n 1237 * @since 6 1238 */ 1239 /** 1240 * Indicates the numberingSystem. 1241 * 1242 * @type { ?string } 1243 * @syscap SystemCapability.Global.I18n 1244 * @since 9 1245 */ 1246 /** 1247 * Indicates the numberingSystem. 1248 * 1249 * @type { ?string } 1250 * @syscap SystemCapability.Global.I18n 1251 * @crossplatform 1252 * @since 10 1253 */ 1254 /** 1255 * Indicates the numberingSystem. 1256 * 1257 * @type { ?string } 1258 * @syscap SystemCapability.Global.I18n 1259 * @crossplatform 1260 * @form 1261 * @since 11 1262 */ 1263 /** 1264 * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", 1265 * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", 1266 * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", 1267 * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", 1268 * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", 1269 * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". 1270 * 1271 * @type { ?string } 1272 * @syscap SystemCapability.Global.I18n 1273 * @crossplatform 1274 * @form 1275 * @atomicservice 1276 * @since arkts {'1.1':'12', '1.2':'20'} 1277 * @deprecated since 20 1278 * @useinstead Intl.DateTimeFormatOptions.numberingSystem 1279 * @arkts 1.1&1.2 1280 */ 1281 numberingSystem?: string; 1282 1283 /** 1284 * Indicates the hour12. 1285 * 1286 * @type { boolean } 1287 * @syscap SystemCapability.Global.I18n 1288 * @since 6 1289 */ 1290 /** 1291 * Indicates the hour12. 1292 * 1293 * @type { ?boolean } 1294 * @syscap SystemCapability.Global.I18n 1295 * @since 9 1296 */ 1297 /** 1298 * Indicates the hour12. 1299 * 1300 * @type { ?boolean } 1301 * @syscap SystemCapability.Global.I18n 1302 * @crossplatform 1303 * @since 10 1304 */ 1305 /** 1306 * Indicates the hour12. 1307 * 1308 * @type { ?boolean } 1309 * @syscap SystemCapability.Global.I18n 1310 * @crossplatform 1311 * @form 1312 * @since 11 1313 */ 1314 /** 1315 * Whether to use the 12-hour clock. The value true means to use the 12-hour clock, and the value false means the 1316 * opposite. If both hour12 and hourCycle are set, hourCycle does not take effect. If hour12 and hourCycle are not 1317 * set and the 24-hour clock is turned on, the default value of hour12 is false. 1318 * 1319 * @type { ?boolean } 1320 * @syscap SystemCapability.Global.I18n 1321 * @crossplatform 1322 * @form 1323 * @atomicservice 1324 * @since arkts {'1.1':'12', '1.2':'20'} 1325 * @deprecated since 20 1326 * @useinstead Intl.DateTimeFormatOptions.hour12 1327 * @arkts 1.1&1.2 1328 */ 1329 hour12?: boolean; 1330 1331 /** 1332 * Indicates the weekday. 1333 * 1334 * @type { string } 1335 * @syscap SystemCapability.Global.I18n 1336 * @since 6 1337 */ 1338 /** 1339 * Indicates the weekday. 1340 * 1341 * @type { ?string } 1342 * @syscap SystemCapability.Global.I18n 1343 * @since 9 1344 */ 1345 /** 1346 * Indicates the weekday. 1347 * 1348 * @type { ?string } 1349 * @syscap SystemCapability.Global.I18n 1350 * @crossplatform 1351 * @since 10 1352 */ 1353 /** 1354 * Indicates the weekday. 1355 * 1356 * @type { ?string } 1357 * @syscap SystemCapability.Global.I18n 1358 * @crossplatform 1359 * @form 1360 * @since 11 1361 */ 1362 /** 1363 * Week display format. The value can be: "long", "short", "narrow", or "auto". 1364 * 1365 * @type { ?string } 1366 * @syscap SystemCapability.Global.I18n 1367 * @crossplatform 1368 * @form 1369 * @atomicservice 1370 * @since arkts {'1.1':'12', '1.2':'20'} 1371 * @deprecated since 20 1372 * @useinstead Intl.DateTimeFormatOptions.weekday 1373 * @arkts 1.1&1.2 1374 */ 1375 weekday?: string; 1376 1377 /** 1378 * Indicates the era. 1379 * 1380 * @type { string } 1381 * @syscap SystemCapability.Global.I18n 1382 * @since 6 1383 */ 1384 /** 1385 * Indicates the era. 1386 * 1387 * @type { ?string } 1388 * @syscap SystemCapability.Global.I18n 1389 * @since 9 1390 */ 1391 /** 1392 * Indicates the era. 1393 * 1394 * @type { ?string } 1395 * @syscap SystemCapability.Global.I18n 1396 * @crossplatform 1397 * @since 10 1398 */ 1399 /** 1400 * Indicates the era. 1401 * 1402 * @type { ?string } 1403 * @syscap SystemCapability.Global.I18n 1404 * @crossplatform 1405 * @form 1406 * @since 11 1407 */ 1408 /** 1409 * Epoch display format. The value can be: "long", "short", "narrow", or "auto". 1410 * 1411 * @type { ?string } 1412 * @syscap SystemCapability.Global.I18n 1413 * @crossplatform 1414 * @form 1415 * @atomicservice 1416 * @since arkts {'1.1':'12', '1.2':'20'} 1417 * @deprecated since 20 1418 * @useinstead Intl.DateTimeFormatOptions.era 1419 * @arkts 1.1&1.2 1420 */ 1421 era?: string; 1422 1423 /** 1424 * Indicates the year. 1425 * 1426 * @type { string } 1427 * @syscap SystemCapability.Global.I18n 1428 * @since 6 1429 */ 1430 /** 1431 * Indicates the year. 1432 * 1433 * @type { ?string } 1434 * @syscap SystemCapability.Global.I18n 1435 * @since 9 1436 */ 1437 /** 1438 * Indicates the year. 1439 * 1440 * @type { ?string } 1441 * @syscap SystemCapability.Global.I18n 1442 * @crossplatform 1443 * @since 10 1444 */ 1445 /** 1446 * Indicates the year. 1447 * 1448 * @type { ?string } 1449 * @syscap SystemCapability.Global.I18n 1450 * @crossplatform 1451 * @form 1452 * @since 11 1453 */ 1454 /** 1455 * Year display format. The value can be: "numeric" or "2-digit". 1456 * 1457 * @type { ?string } 1458 * @syscap SystemCapability.Global.I18n 1459 * @crossplatform 1460 * @form 1461 * @atomicservice 1462 * @since arkts {'1.1':'12', '1.2':'20'} 1463 * @deprecated since 20 1464 * @useinstead Intl.DateTimeFormatOptions.year 1465 * @arkts 1.1&1.2 1466 */ 1467 year?: string; 1468 1469 /** 1470 * Indicates the month. 1471 * 1472 * @type { string } 1473 * @syscap SystemCapability.Global.I18n 1474 * @since 6 1475 */ 1476 /** 1477 * Indicates the month. 1478 * 1479 * @type { ?string } 1480 * @syscap SystemCapability.Global.I18n 1481 * @since 9 1482 */ 1483 /** 1484 * Indicates the month. 1485 * 1486 * @type { ?string } 1487 * @syscap SystemCapability.Global.I18n 1488 * @crossplatform 1489 * @since 10 1490 */ 1491 /** 1492 * Indicates the month. 1493 * 1494 * @type { ?string } 1495 * @syscap SystemCapability.Global.I18n 1496 * @crossplatform 1497 * @form 1498 * @since 11 1499 */ 1500 /** 1501 * Month display format. The value can be: "numeric", "2-digit", "long", "short", "narrow", or "auto". 1502 * 1503 * @type { ?string } 1504 * @syscap SystemCapability.Global.I18n 1505 * @crossplatform 1506 * @form 1507 * @atomicservice 1508 * @since arkts {'1.1':'12', '1.2':'20'} 1509 * @deprecated since 20 1510 * @useinstead Intl.DateTimeFormatOptions.month 1511 * @arkts 1.1&1.2 1512 */ 1513 month?: string; 1514 1515 /** 1516 * Indicates the day. 1517 * 1518 * @type { string } 1519 * @syscap SystemCapability.Global.I18n 1520 * @since 6 1521 */ 1522 /** 1523 * Indicates the day. 1524 * 1525 * @type { ?string } 1526 * @syscap SystemCapability.Global.I18n 1527 * @since 9 1528 */ 1529 /** 1530 * Indicates the day. 1531 * 1532 * @type { ?string } 1533 * @syscap SystemCapability.Global.I18n 1534 * @crossplatform 1535 * @since 10 1536 */ 1537 /** 1538 * Indicates the day. 1539 * 1540 * @type { ?string } 1541 * @syscap SystemCapability.Global.I18n 1542 * @crossplatform 1543 * @form 1544 * @since 11 1545 */ 1546 /** 1547 * Day display format. The value can be: "numeric" or "2-digit". 1548 * 1549 * @type { ?string } 1550 * @syscap SystemCapability.Global.I18n 1551 * @crossplatform 1552 * @form 1553 * @atomicservice 1554 * @since arkts {'1.1':'12', '1.2':'20'} 1555 * @deprecated since 20 1556 * @useinstead Intl.DateTimeFormatOptions.day 1557 * @arkts 1.1&1.2 1558 */ 1559 day?: string; 1560 1561 /** 1562 * Indicates the hour. 1563 * 1564 * @type { string } 1565 * @syscap SystemCapability.Global.I18n 1566 * @since 6 1567 */ 1568 /** 1569 * Indicates the hour. 1570 * 1571 * @type { ?string } 1572 * @syscap SystemCapability.Global.I18n 1573 * @since 9 1574 */ 1575 /** 1576 * Indicates the hour. 1577 * 1578 * @type { ?string } 1579 * @syscap SystemCapability.Global.I18n 1580 * @crossplatform 1581 * @since 10 1582 */ 1583 /** 1584 * Indicates the hour. 1585 * 1586 * @type { ?string } 1587 * @syscap SystemCapability.Global.I18n 1588 * @crossplatform 1589 * @form 1590 * @since 11 1591 */ 1592 /** 1593 * Hour display format. The value can be: "numeric" or "2-digit". 1594 * 1595 * @type { ?string } 1596 * @syscap SystemCapability.Global.I18n 1597 * @crossplatform 1598 * @form 1599 * @atomicservice 1600 * @since arkts {'1.1':'12', '1.2':'20'} 1601 * @deprecated since 20 1602 * @useinstead Intl.DateTimeFormatOptions.hour 1603 * @arkts 1.1&1.2 1604 */ 1605 hour?: string; 1606 1607 /** 1608 * Indicates the minute. 1609 * 1610 * @type { string } 1611 * @syscap SystemCapability.Global.I18n 1612 * @since 6 1613 */ 1614 /** 1615 * Indicates the minute. 1616 * 1617 * @type { ?string } 1618 * @syscap SystemCapability.Global.I18n 1619 * @since 9 1620 */ 1621 /** 1622 * Indicates the minute. 1623 * 1624 * @type { ?string } 1625 * @syscap SystemCapability.Global.I18n 1626 * @crossplatform 1627 * @since 10 1628 */ 1629 /** 1630 * Indicates the minute. 1631 * 1632 * @type { ?string } 1633 * @syscap SystemCapability.Global.I18n 1634 * @crossplatform 1635 * @form 1636 * @since 11 1637 */ 1638 /** 1639 * Minute display format. The value can be: "numeric" or "2-digit". 1640 * 1641 * @type { ?string } 1642 * @syscap SystemCapability.Global.I18n 1643 * @crossplatform 1644 * @form 1645 * @atomicservice 1646 * @since arkts {'1.1':'12', '1.2':'20'} 1647 * @deprecated since 20 1648 * @useinstead Intl.DateTimeFormatOptions.minute 1649 * @arkts 1.1&1.2 1650 */ 1651 minute?: string; 1652 1653 /** 1654 * Indicates the second. 1655 * 1656 * @type { string } 1657 * @syscap SystemCapability.Global.I18n 1658 * @since 6 1659 */ 1660 /** 1661 * Indicates the second. 1662 * 1663 * @type { ?string } 1664 * @syscap SystemCapability.Global.I18n 1665 * @since 9 1666 */ 1667 /** 1668 * Indicates the second. 1669 * 1670 * @type { ?string } 1671 * @syscap SystemCapability.Global.I18n 1672 * @crossplatform 1673 * @since 10 1674 */ 1675 /** 1676 * Indicates the second. 1677 * 1678 * @type { ?string } 1679 * @syscap SystemCapability.Global.I18n 1680 * @crossplatform 1681 * @form 1682 * @since 11 1683 */ 1684 /** 1685 * Second display format. The value can be: "numeric" or "2-digit". 1686 * 1687 * @type { ?string } 1688 * @syscap SystemCapability.Global.I18n 1689 * @crossplatform 1690 * @form 1691 * @atomicservice 1692 * @since arkts {'1.1':'12', '1.2':'20'} 1693 * @deprecated since 20 1694 * @useinstead Intl.DateTimeFormatOptions.second 1695 * @arkts 1.1&1.2 1696 */ 1697 second?: string; 1698 1699 /** 1700 * Indicates the timeZoneName. 1701 * 1702 * @type { string } 1703 * @syscap SystemCapability.Global.I18n 1704 * @since 6 1705 */ 1706 /** 1707 * Indicates the timeZoneName. 1708 * 1709 * @type { ?string } 1710 * @syscap SystemCapability.Global.I18n 1711 * @since 9 1712 */ 1713 /** 1714 * Indicates the timeZoneName. 1715 * 1716 * @type { ?string } 1717 * @syscap SystemCapability.Global.I18n 1718 * @crossplatform 1719 * @since 10 1720 */ 1721 /** 1722 * Indicates the timeZoneName. 1723 * 1724 * @type { ?string } 1725 * @syscap SystemCapability.Global.I18n 1726 * @crossplatform 1727 * @form 1728 * @since 11 1729 */ 1730 /** 1731 * Localized representation of a time zone name. The value can be: "long", "short", or "auto". 1732 * 1733 * @type { ?string } 1734 * @syscap SystemCapability.Global.I18n 1735 * @crossplatform 1736 * @form 1737 * @atomicservice 1738 * @since arkts {'1.1':'12', '1.2':'20'} 1739 * @deprecated since 20 1740 * @useinstead Intl.DateTimeFormatOptions.timeZoneName 1741 * @arkts 1.1&1.2 1742 */ 1743 timeZoneName?: string; 1744 1745 /** 1746 * Indicates the dayPeriod. 1747 * 1748 * @type { string } 1749 * @syscap SystemCapability.Global.I18n 1750 * @since 6 1751 */ 1752 /** 1753 * Indicates the dayPeriod. 1754 * 1755 * @type { ?string } 1756 * @syscap SystemCapability.Global.I18n 1757 * @since 9 1758 */ 1759 /** 1760 * Indicates the dayPeriod. 1761 * 1762 * @type { ?string } 1763 * @syscap SystemCapability.Global.I18n 1764 * @crossplatform 1765 * @since 10 1766 */ 1767 /** 1768 * Indicates the dayPeriod. 1769 * 1770 * @type { ?string } 1771 * @syscap SystemCapability.Global.I18n 1772 * @crossplatform 1773 * @form 1774 * @since 11 1775 */ 1776 /** 1777 * Time period display format. The value can be: "long", "short", "narrow", or "auto". 1778 * 1779 * @type { ?string } 1780 * @syscap SystemCapability.Global.I18n 1781 * @crossplatform 1782 * @form 1783 * @atomicservice 1784 * @since arkts {'1.1':'12', '1.2':'20'} 1785 * @deprecated since 20 1786 * @useinstead Intl.DateTimeFormatOptions.dayPeriod 1787 * @arkts 1.1&1.2 1788 */ 1789 dayPeriod?: string; 1790 1791 /** 1792 * Indicates the localeMatcher. 1793 * 1794 * @type { string } 1795 * @syscap SystemCapability.Global.I18n 1796 * @since 6 1797 */ 1798 /** 1799 * Indicates the localeMatcher. 1800 * 1801 * @type { ?string } 1802 * @syscap SystemCapability.Global.I18n 1803 * @since 9 1804 */ 1805 /** 1806 * Indicates the localeMatcher. 1807 * 1808 * @type { ?string } 1809 * @syscap SystemCapability.Global.I18n 1810 * @crossplatform 1811 * @since 10 1812 */ 1813 /** 1814 * Indicates the localeMatcher. 1815 * 1816 * @type { ?string } 1817 * @syscap SystemCapability.Global.I18n 1818 * @crossplatform 1819 * @form 1820 * @since 11 1821 */ 1822 /** 1823 * Locale matching algorithm. The value can be: 1824 * "lookup": exact match. 1825 * "best fit": best match. 1826 * 1827 * @type { ?string } 1828 * @syscap SystemCapability.Global.I18n 1829 * @crossplatform 1830 * @form 1831 * @atomicservice 1832 * @since arkts {'1.1':'12', '1.2':'20'} 1833 * @deprecated since 20 1834 * @useinstead Intl.DateTimeFormatOptions.localeMatcher 1835 * @arkts 1.1&1.2 1836 */ 1837 localeMatcher?: string; 1838 1839 /** 1840 * Indicates the formatMatcher. 1841 * 1842 * @type { string } 1843 * @syscap SystemCapability.Global.I18n 1844 * @since 6 1845 */ 1846 /** 1847 * Indicates the formatMatcher. 1848 * 1849 * @type { ?string } 1850 * @syscap SystemCapability.Global.I18n 1851 * @since 9 1852 */ 1853 /** 1854 * Indicates the formatMatcher. 1855 * 1856 * @type { ?string } 1857 * @syscap SystemCapability.Global.I18n 1858 * @crossplatform 1859 * @since 10 1860 */ 1861 /** 1862 * Indicates the formatMatcher. 1863 * 1864 * @type { ?string } 1865 * @syscap SystemCapability.Global.I18n 1866 * @crossplatform 1867 * @form 1868 * @since 11 1869 */ 1870 /** 1871 * Format matching algorithm. The value can be: 1872 * "basic": exact match. 1873 * "best fit": best match. 1874 * 1875 * @type { ?string } 1876 * @syscap SystemCapability.Global.I18n 1877 * @crossplatform 1878 * @form 1879 * @atomicservice 1880 * @since arkts {'1.1':'12', '1.2':'20'} 1881 * @deprecated since 20 1882 * @useinstead Intl.DateTimeFormatOptions.formatMatcher 1883 * @arkts 1.1&1.2 1884 */ 1885 formatMatcher?: string; 1886 } 1887 1888 /** 1889 * Provides the API for formatting date strings. 1890 * 1891 * @syscap SystemCapability.Global.I18n 1892 * @since 6 1893 */ 1894 /** 1895 * Provides the API for formatting date strings. 1896 * 1897 * @syscap SystemCapability.Global.I18n 1898 * @crossplatform 1899 * @since 10 1900 */ 1901 /** 1902 * Provides the API for formatting date strings. 1903 * 1904 * @syscap SystemCapability.Global.I18n 1905 * @crossplatform 1906 * @form 1907 * @since 11 1908 */ 1909 /** 1910 * Provides the API for formatting date strings. 1911 * 1912 * @syscap SystemCapability.Global.I18n 1913 * @crossplatform 1914 * @form 1915 * @atomicservice 1916 * @since arkts {'1.1':'12', '1.2':'20'} 1917 * @deprecated since 20 1918 * @useinstead Intl.DateTimeFormat 1919 * @arkts 1.1&1.2 1920 */ 1921 export class DateTimeFormat { 1922 /** 1923 * A constructor used to create a DateTimeFormat object. 1924 * 1925 * @syscap SystemCapability.Global.I18n 1926 * @since 8 1927 */ 1928 /** 1929 * A constructor used to create a DateTimeFormat object. 1930 * 1931 * @syscap SystemCapability.Global.I18n 1932 * @crossplatform 1933 * @since 10 1934 */ 1935 /** 1936 * A constructor used to create a DateTimeFormat object. 1937 * 1938 * @syscap SystemCapability.Global.I18n 1939 * @crossplatform 1940 * @form 1941 * @since 11 1942 */ 1943 /** 1944 * Creates a DateTimeOptions object for the specified locale. 1945 * 1946 * @syscap SystemCapability.Global.I18n 1947 * @crossplatform 1948 * @form 1949 * @atomicservice 1950 * @since arkts {'1.1':'12', '1.2':'20'} 1951 * @deprecated since 20 1952 * @useinstead Intl.DateTimeFormat.constructor 1953 * @arkts 1.1&1.2 1954 */ 1955 constructor(); 1956 1957 /** 1958 * A constructor used to create a DateTimeFormat object. 1959 * 1960 * @param { string | Array<string> } locale - Indicates character string containing the locale information, including 1961 * the language and optionally the script and region, for the DateTimeFormat object. 1962 * @param { DateTimeOptions } [options] - Indicates the options used to format the date. 1963 * @syscap SystemCapability.Global.I18n 1964 * @since 6 1965 */ 1966 /** 1967 * A constructor used to create a DateTimeFormat object. 1968 * 1969 * @param { string | Array<string> } locale - Indicates character string containing the locale information, including 1970 * the language and optionally the script and region, for the DateTimeFormat object. 1971 * @param { DateTimeOptions } [options] - Indicates the options used to format the date. 1972 * @syscap SystemCapability.Global.I18n 1973 * @crossplatform 1974 * @since 10 1975 */ 1976 /** 1977 * A constructor used to create a DateTimeFormat object. 1978 * 1979 * @param { string | Array<string> } locale - Indicates character string containing the locale information, including 1980 * the language and optionally the script and region, for the DateTimeFormat object. 1981 * @param { DateTimeOptions } [options] - Indicates the options used to format the date. 1982 * @syscap SystemCapability.Global.I18n 1983 * @crossplatform 1984 * @form 1985 * @since 11 1986 */ 1987 /** 1988 * Creates a DateTimeOptions object for the specified locale. 1989 * 1990 * @param { string | Array<string> } locale - Locale ID or locale ID array. If the input is a locale ID array, the 1991 * first valid locale ID is used. 1992 * @param { DateTimeOptions } [options] - Options for creating the DateTimeOptions object.<br>If no options are 1993 * set, the default values of year, month, and day are numeric. 1994 * @syscap SystemCapability.Global.I18n 1995 * @crossplatform 1996 * @form 1997 * @atomicservice 1998 * @since arkts {'1.1':'12', '1.2':'20'} 1999 * @deprecated since 20 2000 * @useinstead Intl.DateTimeFormat.constructor 2001 * @arkts 1.1&1.2 2002 */ 2003 constructor(locale: string | Array<string>, options?: DateTimeOptions); 2004 2005 /** 2006 * Obtains the formatted date strings. 2007 * 2008 * @param { Date } date - Indicates the Date object to be formatted. 2009 * @returns { string } a date string formatted based on the specified locale. 2010 * @syscap SystemCapability.Global.I18n 2011 * @since 6 2012 */ 2013 /** 2014 * Obtains the formatted date strings. 2015 * 2016 * @param { Date } date - Indicates the Date object to be formatted. 2017 * @returns { string } a date string formatted based on the specified locale. 2018 * @syscap SystemCapability.Global.I18n 2019 * @crossplatform 2020 * @since 10 2021 */ 2022 /** 2023 * Obtains the formatted date strings. 2024 * 2025 * @param { Date } date - Indicates the Date object to be formatted. 2026 * @returns { string } a date string formatted based on the specified locale. 2027 * @syscap SystemCapability.Global.I18n 2028 * @crossplatform 2029 * @form 2030 * @since 11 2031 */ 2032 /** 2033 * Formats the date and time. 2034 * 2035 * @param { Date } date - Date and time. Note: The month starts from 0. For example, 0 indicates January. 2036 * @returns { string } A string containing the formatted date and time. 2037 * @syscap SystemCapability.Global.I18n 2038 * @crossplatform 2039 * @form 2040 * @atomicservice 2041 * @since arkts {'1.1':'12', '1.2':'20'} 2042 * @deprecated since 20 2043 * @useinstead Intl.DateTimeFormat.format 2044 * @arkts 1.1&1.2 2045 */ 2046 format(date: Date): string; 2047 2048 /** 2049 * Obtains the formatted date strings of a date range. 2050 * 2051 * @param { Date } startDate - Indicates the start date of the date range. 2052 * @param { Date } endDate - Indicates the end date of the date range. 2053 * @returns { string } a date string formatted based on the specified locale. 2054 * @syscap SystemCapability.Global.I18n 2055 * @since 6 2056 */ 2057 /** 2058 * Obtains the formatted date strings of a date range. 2059 * 2060 * @param { Date } startDate - Indicates the start date of the date range. 2061 * @param { Date } endDate - Indicates the end date of the date range. 2062 * @returns { string } a date string formatted based on the specified locale. 2063 * @syscap SystemCapability.Global.I18n 2064 * @crossplatform 2065 * @since 10 2066 */ 2067 /** 2068 * Obtains the formatted date strings of a date range. 2069 * 2070 * @param { Date } startDate - Indicates the start date of the date range. 2071 * @param { Date } endDate - Indicates the end date of the date range. 2072 * @returns { string } a date string formatted based on the specified locale. 2073 * @syscap SystemCapability.Global.I18n 2074 * @crossplatform 2075 * @form 2076 * @since 11 2077 */ 2078 /** 2079 * Formats date and time ranges. 2080 * 2081 * @param { Date } startDate - Start date and time. Note: The month starts from 0. For example, 0 indicates 2082 * January. 2083 * @param { Date } endDate - End date and time. Note: The month starts from 0. For example, 0 indicates January. 2084 * @returns { string } a date string formatted based on the specified locale. 2085 * @syscap SystemCapability.Global.I18n 2086 * @crossplatform 2087 * @form 2088 * @atomicservice 2089 * @since arkts {'1.1':'12', '1.2':'20'} 2090 * @deprecated since 20 2091 * @useinstead Intl.DateTimeFormat.formatRange 2092 * @arkts 1.1&1.2 2093 */ 2094 formatRange(startDate: Date, endDate: Date): string; 2095 2096 /** 2097 * Obtains the options of the DateTimeFormat object. 2098 * 2099 * @returns { DateTimeOptions } the options of the DateTimeFormat object. 2100 * @syscap SystemCapability.Global.I18n 2101 * @since 6 2102 */ 2103 /** 2104 * Obtains the options of the DateTimeFormat object. 2105 * 2106 * @returns { DateTimeOptions } the options of the DateTimeFormat object. 2107 * @syscap SystemCapability.Global.I18n 2108 * @crossplatform 2109 * @since 10 2110 */ 2111 /** 2112 * Obtains the options of the DateTimeFormat object. 2113 * 2114 * @returns { DateTimeOptions } the options of the DateTimeFormat object. 2115 * @syscap SystemCapability.Global.I18n 2116 * @crossplatform 2117 * @form 2118 * @since 11 2119 */ 2120 /** 2121 * Obtains the options for creating a DateTimeOptions object. 2122 * 2123 * @returns { DateTimeOptions } Options for the DateTimeOptions object. 2124 * @syscap SystemCapability.Global.I18n 2125 * @crossplatform 2126 * @form 2127 * @atomicservice 2128 * @since arkts {'1.1':'12', '1.2':'20'} 2129 * @deprecated since 20 2130 * @useinstead Intl.DateTimeFormat.resolvedOptions 2131 * @arkts 1.1&1.2 2132 */ 2133 resolvedOptions(): DateTimeOptions; 2134 } 2135 2136 /** 2137 * Provides the options of number format. 2138 * 2139 * @interface NumberOptions 2140 * @syscap SystemCapability.Global.I18n 2141 * @since 6 2142 */ 2143 /** 2144 * Provides the options of number format. 2145 * 2146 * @interface NumberOptions 2147 * @syscap SystemCapability.Global.I18n 2148 * @crossplatform 2149 * @since 10 2150 */ 2151 /** 2152 * Options for creating the NumberFormat object. Since API version 9, the NumberOptions attribute is changed from 2153 * mandatory to optional. 2154 * 2155 * @interface NumberOptions 2156 * @syscap SystemCapability.Global.I18n 2157 * @crossplatform 2158 * @atomicservice 2159 * @since arkts {'1.1':'12', '1.2':'20'} 2160 * @arkts 1.1&1.2 2161 */ 2162 export interface NumberOptions { 2163 /** 2164 * Indicates the locale. 2165 * 2166 * @type { string } 2167 * @syscap SystemCapability.Global.I18n 2168 * @since 6 2169 */ 2170 /** 2171 * Indicates the locale. 2172 * 2173 * @type { ?string } 2174 * @syscap SystemCapability.Global.I18n 2175 * @since 9 2176 */ 2177 /** 2178 * Indicates the locale. 2179 * 2180 * @type { ?string } 2181 * @syscap SystemCapability.Global.I18n 2182 * @crossplatform 2183 * @since 10 2184 */ 2185 /** 2186 * Valid locale ID, for example, "zh-Hans-CN". The default value is the current system locale. 2187 * 2188 * @type { ?string } 2189 * @syscap SystemCapability.Global.I18n 2190 * @crossplatform 2191 * @atomicservice 2192 * @since arkts {'1.1':'12', '1.2':'20'} 2193 * @arkts 1.1&1.2 2194 */ 2195 locale?: string; 2196 2197 /** 2198 * Indicates the currency. 2199 * 2200 * @type { string } 2201 * @syscap SystemCapability.Global.I18n 2202 * @since 6 2203 */ 2204 /** 2205 * Indicates the currency. 2206 * 2207 * @type { ?string } 2208 * @syscap SystemCapability.Global.I18n 2209 * @since 9 2210 */ 2211 /** 2212 * Indicates the currency. 2213 * 2214 * @type { ?string } 2215 * @syscap SystemCapability.Global.I18n 2216 * @crossplatform 2217 * @since 10 2218 */ 2219 /** 2220 * Currency unit. The value must comply with the [ISO-4217 standard](https://www.iso.org/iso-4217-currency-codes.html), 2221 * for example, "EUR", "CNY", and "USD". From API version 12, a three-digit number is supported, for example, "978", 2222 * "156", or "840". 2223 * 2224 * @type { ?string } 2225 * @syscap SystemCapability.Global.I18n 2226 * @crossplatform 2227 * @atomicservice 2228 * @since arkts {'1.1':'12', '1.2':'20'} 2229 * @arkts 1.1&1.2 2230 */ 2231 currency?: string; 2232 2233 /** 2234 * Indicates the currencySign. 2235 * 2236 * @type { string } 2237 * @syscap SystemCapability.Global.I18n 2238 * @since 6 2239 */ 2240 /** 2241 * Indicates the currencySign. 2242 * 2243 * @type { ?string } 2244 * @syscap SystemCapability.Global.I18n 2245 * @since 9 2246 */ 2247 /** 2248 * Indicates the currencySign. 2249 * 2250 * @type { ?string } 2251 * @syscap SystemCapability.Global.I18n 2252 * @crossplatform 2253 * @since 10 2254 */ 2255 /** 2256 * urrency unit symbol. The value can be "standard" or "accounting". The default value is "standard". 2257 * 2258 * @type { ?string } 2259 * @syscap SystemCapability.Global.I18n 2260 * @crossplatform 2261 * @atomicservice 2262 * @since arkts {'1.1':'12', '1.2':'20'} 2263 * @arkts 1.1&1.2 2264 */ 2265 currencySign?: string; 2266 2267 /** 2268 * Indicates the currencyDisplay. 2269 * 2270 * @type { string } 2271 * @syscap SystemCapability.Global.I18n 2272 * @since 6 2273 */ 2274 /** 2275 * Indicates the currencyDisplay. 2276 * 2277 * @type { ?string } 2278 * @syscap SystemCapability.Global.I18n 2279 * @since 9 2280 */ 2281 /** 2282 * Indicates the currencyDisplay. 2283 * 2284 * @type { ?string } 2285 * @syscap SystemCapability.Global.I18n 2286 * @crossplatform 2287 * @since 10 2288 */ 2289 /** 2290 * Currency display mode. The value can be "symbol", "narrowSymbol", "code", or "name". 2291 * The default value is "symbol". 2292 * 2293 * @type { ?string } 2294 * @syscap SystemCapability.Global.I18n 2295 * @crossplatform 2296 * @atomicservice 2297 * @since arkts {'1.1':'12', '1.2':'20'} 2298 * @arkts 1.1&1.2 2299 */ 2300 currencyDisplay?: string; 2301 2302 /** 2303 * Indicates the unit. 2304 * 2305 * @type { string } 2306 * @syscap SystemCapability.Global.I18n 2307 * @since 6 2308 */ 2309 /** 2310 * Indicates the unit. 2311 * 2312 * @type { ?string } 2313 * @syscap SystemCapability.Global.I18n 2314 * @since 9 2315 */ 2316 /** 2317 * Indicates the unit. 2318 * 2319 * @type { ?string } 2320 * @syscap SystemCapability.Global.I18n 2321 * @crossplatform 2322 * @since 10 2323 */ 2324 /** 2325 * Unit name, for example, "meter", "inch", or "hectare". The combination units supported since API version 18 are 2326 * as follows: "beat-per-minute", "body-weight-per-second", "breath-per-minute", "foot-per-hour", 2327 * "jump-rope-per-minute", "meter-per-hour", "milliliter-per-minute-per-kilogram", "rotation-per-minute", 2328 * "step-per-minute", and "stroke-per-minute". 2329 * 2330 * @type { ?string } 2331 * @syscap SystemCapability.Global.I18n 2332 * @crossplatform 2333 * @atomicservice 2334 * @since arkts {'1.1':'12', '1.2':'20'} 2335 * @arkts 1.1&1.2 2336 */ 2337 unit?: string; 2338 2339 /** 2340 * Indicates the unitDisplay. 2341 * 2342 * @type { string } 2343 * @syscap SystemCapability.Global.I18n 2344 * @since 6 2345 */ 2346 /** 2347 * Indicates the unitDisplay. 2348 * 2349 * @type { ?string } 2350 * @syscap SystemCapability.Global.I18n 2351 * @since 9 2352 */ 2353 /** 2354 * Indicates the unitDisplay. 2355 * 2356 * @type { ?string } 2357 * @syscap SystemCapability.Global.I18n 2358 * @crossplatform 2359 * @since 10 2360 */ 2361 /** 2362 * Display format of units. The value can be "long", "short", or "narrow". The default value is "short". 2363 * 2364 * @type { ?string } 2365 * @syscap SystemCapability.Global.I18n 2366 * @crossplatform 2367 * @atomicservice 2368 * @since arkts {'1.1':'12', '1.2':'20'} 2369 * @arkts 1.1&1.2 2370 */ 2371 unitDisplay?: string; 2372 2373 /** 2374 * Indicates the unitUsage. 2375 * 2376 * @type { string } 2377 * @syscap SystemCapability.Global.I18n 2378 * @since 8 2379 */ 2380 /** 2381 * Indicates the unitUsage. 2382 * 2383 * @type { ?string } 2384 * @syscap SystemCapability.Global.I18n 2385 * @since 9 2386 */ 2387 /** 2388 * Indicates the unitUsage. 2389 * 2390 * @type { ?string } 2391 * @syscap SystemCapability.Global.I18n 2392 * @crossplatform 2393 * @since 10 2394 */ 2395 /** 2396 * Application scenario of units. The value can be any of the following: "default", "area-land-agricult", 2397 * "area-land-commercl", "area-land-residntl", "length-person", "length-person-small", "length-rainfall", 2398 * "length-road", "length-road-small", "length-snowfall", "length-vehicle", "length-visiblty", 2399 * "length-visiblty-small", "length-person-informal", "length-person-small-informal", "length-road-informal", 2400 * "speed-road-travel", "speed-wind", "temperature-person", "temperature-weather", "volume-vehicle-fuel", 2401 * "elapsed-time-second", "size-file-byte", or "size-shortfile-byte". The default value is "default". 2402 * 2403 * @type { ?string } 2404 * @syscap SystemCapability.Global.I18n 2405 * @crossplatform 2406 * @atomicservice 2407 * @since arkts {'1.1':'12', '1.2':'20'} 2408 * @arkts 1.1&1.2 2409 */ 2410 unitUsage?: string; 2411 2412 /** 2413 * Indicates the signDisplay. 2414 * 2415 * @type { string } 2416 * @syscap SystemCapability.Global.I18n 2417 * @since 6 2418 */ 2419 /** 2420 * Indicates the signDisplay. 2421 * 2422 * @type { ?string } 2423 * @syscap SystemCapability.Global.I18n 2424 * @since 9 2425 */ 2426 /** 2427 * Indicates the signDisplay. 2428 * 2429 * @type { ?string } 2430 * @syscap SystemCapability.Global.I18n 2431 * @crossplatform 2432 * @since 10 2433 */ 2434 /** 2435 * Number sign display format. The value can be: 2436 * "auto": automatically determines whether to display the plus or minus sign. 2437 * "never": do not display the plus or minus sign. 2438 * "always": always displays the plus or minus sign. 2439 * "exceptZero": displays the plus or minus sign for all values except 0. 2440 * Default value: "auto". 2441 * 2442 * @type { ?string } 2443 * @syscap SystemCapability.Global.I18n 2444 * @crossplatform 2445 * @atomicservice 2446 * @since arkts {'1.1':'12', '1.2':'20'} 2447 * @arkts 1.1&1.2 2448 */ 2449 signDisplay?: string; 2450 2451 /** 2452 * Indicates the compactDisplay. 2453 * 2454 * @type { string } 2455 * @syscap SystemCapability.Global.I18n 2456 * @since 6 2457 */ 2458 /** 2459 * Indicates the compactDisplay. 2460 * 2461 * @type { ?string } 2462 * @syscap SystemCapability.Global.I18n 2463 * @since 9 2464 */ 2465 /** 2466 * Indicates the compactDisplay. 2467 * 2468 * @type { ?string } 2469 * @syscap SystemCapability.Global.I18n 2470 * @crossplatform 2471 * @since 10 2472 */ 2473 /** 2474 * Compact display format. The value can be "long" or "short". The default value is "short". 2475 * 2476 * @type { ?string } 2477 * @syscap SystemCapability.Global.I18n 2478 * @crossplatform 2479 * @atomicservice 2480 * @since arkts {'1.1':'12', '1.2':'20'} 2481 * @arkts 1.1&1.2 2482 */ 2483 compactDisplay?: string; 2484 2485 /** 2486 * Indicates the notation. 2487 * 2488 * @type { string } 2489 * @syscap SystemCapability.Global.I18n 2490 * @since 6 2491 */ 2492 /** 2493 * Indicates the notation. 2494 * 2495 * @type { ?string } 2496 * @syscap SystemCapability.Global.I18n 2497 * @since 9 2498 */ 2499 /** 2500 * Indicates the notation. 2501 * 2502 * @type { ?string } 2503 * @syscap SystemCapability.Global.I18n 2504 * @crossplatform 2505 * @since 10 2506 */ 2507 /** 2508 * Number notation. The value can be: "standard", "scientific", "engineering", or "compact". 2509 * The default value is "standard". 2510 * 2511 * @type { ?string } 2512 * @syscap SystemCapability.Global.I18n 2513 * @crossplatform 2514 * @atomicservice 2515 * @since arkts {'1.1':'12', '1.2':'20'} 2516 * @arkts 1.1&1.2 2517 */ 2518 notation?: string; 2519 2520 /** 2521 * Indicates the localeMatcher. 2522 * 2523 * @type { string } 2524 * @syscap SystemCapability.Global.I18n 2525 * @since 6 2526 */ 2527 /** 2528 * Indicates the localeMatcher. 2529 * 2530 * @type { ?string } 2531 * @syscap SystemCapability.Global.I18n 2532 * @since 9 2533 */ 2534 /** 2535 * Indicates the localeMatcher. 2536 * 2537 * @type { ?string } 2538 * @syscap SystemCapability.Global.I18n 2539 * @crossplatform 2540 * @since 10 2541 */ 2542 /** 2543 * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". 2544 * 2545 * @type { ?string } 2546 * @syscap SystemCapability.Global.I18n 2547 * @crossplatform 2548 * @atomicservice 2549 * @since arkts {'1.1':'12', '1.2':'20'} 2550 * @arkts 1.1&1.2 2551 */ 2552 localeMatcher?: string; 2553 2554 /** 2555 * Indicates the style. 2556 * 2557 * @type { string } 2558 * @syscap SystemCapability.Global.I18n 2559 * @since 6 2560 */ 2561 /** 2562 * Indicates the style. 2563 * 2564 * @type { ?string } 2565 * @syscap SystemCapability.Global.I18n 2566 * @since 9 2567 */ 2568 /** 2569 * Indicates the style. 2570 * 2571 * @type { ?string } 2572 * @syscap SystemCapability.Global.I18n 2573 * @crossplatform 2574 * @since 10 2575 */ 2576 /** 2577 * Number display format. The value can be "decimal", "currency", "percent", or "unit". 2578 * The default value is "decimal". 2579 * 2580 * @type { ?string } 2581 * @syscap SystemCapability.Global.I18n 2582 * @crossplatform 2583 * @atomicservice 2584 * @since arkts {'1.1':'12', '1.2':'20'} 2585 * @arkts 1.1&1.2 2586 */ 2587 style?: string; 2588 2589 /** 2590 * Indicates the numberingSystem. 2591 * 2592 * @type { string } 2593 * @syscap SystemCapability.Global.I18n 2594 * @since 6 2595 */ 2596 /** 2597 * Indicates the numberingSystem. 2598 * 2599 * @type { ?string } 2600 * @syscap SystemCapability.Global.I18n 2601 * @since 9 2602 */ 2603 /** 2604 * Indicates the numberingSystem. 2605 * 2606 * @type { ?string } 2607 * @syscap SystemCapability.Global.I18n 2608 * @crossplatform 2609 * @since 10 2610 */ 2611 /** 2612 * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", 2613 * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", 2614 * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", 2615 * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", 2616 * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", 2617 * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". 2618 * 2619 * @type { ?string } 2620 * @syscap SystemCapability.Global.I18n 2621 * @crossplatform 2622 * @atomicservice 2623 * @since arkts {'1.1':'12', '1.2':'20'} 2624 * @arkts 1.1&1.2 2625 */ 2626 numberingSystem?: string; 2627 2628 /** 2629 * Indicates the useGrouping. 2630 * 2631 * @type { boolean } 2632 * @syscap SystemCapability.Global.I18n 2633 * @since 6 2634 */ 2635 /** 2636 * Indicates the useGrouping. 2637 * 2638 * @type { ?boolean } 2639 * @syscap SystemCapability.Global.I18n 2640 * @since 9 2641 */ 2642 /** 2643 * Indicates the useGrouping. 2644 * 2645 * @type { ?boolean } 2646 * @syscap SystemCapability.Global.I18n 2647 * @crossplatform 2648 * @since 10 2649 */ 2650 /** 2651 * Whether to enable grouping for display. The value "true" means to enable grouping for display, and the value 2652 * "false" means the opposite. The default value is "true". 2653 * 2654 * @type { ?boolean } 2655 * @syscap SystemCapability.Global.I18n 2656 * @crossplatform 2657 * @atomicservice 2658 * @since arkts {'1.1':'12', '1.2':'20'} 2659 * @arkts 1.1&1.2 2660 */ 2661 useGrouping?: boolean; 2662 2663 /** 2664 * Indicates the minimumIntegerDigits. 2665 * 2666 * @type { number } 2667 * @syscap SystemCapability.Global.I18n 2668 * @since 6 2669 */ 2670 /** 2671 * Indicates the minimumIntegerDigits. 2672 * 2673 * @type { ?number } 2674 * @syscap SystemCapability.Global.I18n 2675 * @since 9 2676 */ 2677 /** 2678 * Indicates the minimumIntegerDigits. 2679 * 2680 * @type { ?number } 2681 * @syscap SystemCapability.Global.I18n 2682 * @crossplatform 2683 * @since 10 2684 */ 2685 /** 2686 * Minimum number of digits allowed in the integer part of a number. The value ranges from 1 to 21. 2687 * The default value is 1. 2688 * 2689 * @type { ?number } 2690 * @syscap SystemCapability.Global.I18n 2691 * @crossplatform 2692 * @atomicservice 2693 * @since arkts {'1.1':'12', '1.2':'20'} 2694 * @arkts 1.1&1.2 2695 */ 2696 minimumIntegerDigits?: number; 2697 2698 /** 2699 * Indicates the minimumFractionDigits. 2700 * 2701 * @type { number } 2702 * @syscap SystemCapability.Global.I18n 2703 * @since 6 2704 */ 2705 /** 2706 * Indicates the minimumFractionDigits. 2707 * 2708 * @type { ?number } 2709 * @syscap SystemCapability.Global.I18n 2710 * @since 9 2711 */ 2712 /** 2713 * Indicates the minimumFractionDigits. 2714 * 2715 * @type { ?number } 2716 * @syscap SystemCapability.Global.I18n 2717 * @crossplatform 2718 * @since 10 2719 */ 2720 /** 2721 * Minimum number of digits in the fraction part of a number. The value ranges from 0 to 20. 2722 * The default value is 0. 2723 * 2724 * @type { ?number } 2725 * @syscap SystemCapability.Global.I18n 2726 * @crossplatform 2727 * @atomicservice 2728 * @since arkts {'1.1':'12', '1.2':'20'} 2729 * @arkts 1.1&1.2 2730 */ 2731 minimumFractionDigits?: number; 2732 2733 /** 2734 * Indicates the maximumFractionDigits. 2735 * 2736 * @type { number } 2737 * @syscap SystemCapability.Global.I18n 2738 * @since 6 2739 */ 2740 /** 2741 * Indicates the maximumFractionDigits. 2742 * 2743 * @type { ?number } 2744 * @syscap SystemCapability.Global.I18n 2745 * @since 9 2746 */ 2747 /** 2748 * Indicates the maximumFractionDigits. 2749 * 2750 * @type { ?number } 2751 * @syscap SystemCapability.Global.I18n 2752 * @crossplatform 2753 * @since 10 2754 */ 2755 /** 2756 * Maximum number of digits in the fraction part of a number. The value ranges from 1 to 21. 2757 * The default value is 3. 2758 * 2759 * @type { ?number } 2760 * @syscap SystemCapability.Global.I18n 2761 * @crossplatform 2762 * @atomicservice 2763 * @since arkts {'1.1':'12', '1.2':'20'} 2764 * @arkts 1.1&1.2 2765 */ 2766 maximumFractionDigits?: number; 2767 2768 /** 2769 * Indicates the minimumSignificantDigits. 2770 * 2771 * @type { number } 2772 * @syscap SystemCapability.Global.I18n 2773 * @since 6 2774 */ 2775 /** 2776 * Indicates the minimumSignificantDigits. 2777 * 2778 * @type { ?number } 2779 * @syscap SystemCapability.Global.I18n 2780 * @since 9 2781 */ 2782 /** 2783 * Indicates the minimumSignificantDigits. 2784 * 2785 * @type { ?number } 2786 * @syscap SystemCapability.Global.I18n 2787 * @crossplatform 2788 * @since 10 2789 */ 2790 /** 2791 * Minimum number of the least significant digits. The value ranges from 1 to 21. The default value is 1. 2792 * 2793 * @type { ?number } 2794 * @syscap SystemCapability.Global.I18n 2795 * @crossplatform 2796 * @atomicservice 2797 * @since arkts {'1.1':'12', '1.2':'20'} 2798 * @arkts 1.1&1.2 2799 */ 2800 minimumSignificantDigits?: number; 2801 2802 /** 2803 * Indicates the maximumSignificantDigits. 2804 * 2805 * @type { number } 2806 * @syscap SystemCapability.Global.I18n 2807 * @since 6 2808 */ 2809 /** 2810 * Indicates the maximumSignificantDigits. 2811 * 2812 * @type { ?number } 2813 * @syscap SystemCapability.Global.I18n 2814 * @since 9 2815 */ 2816 /** 2817 * Indicates the maximumSignificantDigits. 2818 * 2819 * @type { ?number } 2820 * @syscap SystemCapability.Global.I18n 2821 * @crossplatform 2822 * @since 10 2823 */ 2824 /** 2825 * Maximum number of the least significant digits. The value ranges from 1 to 21. The default value is 21. 2826 * 2827 * @type { ?number } 2828 * @syscap SystemCapability.Global.I18n 2829 * @crossplatform 2830 * @atomicservice 2831 * @since arkts {'1.1':'12', '1.2':'20'} 2832 * @arkts 1.1&1.2 2833 */ 2834 maximumSignificantDigits?: number; 2835 2836 /** 2837 * Rounding priority used when both the maximum number of fraction digits and the maximum number of valid digits 2838 * are set. The value can be: "auto", "morePrecision", or "lessPrecision". The value "morePrecision" indicates that 2839 * the maximum number of fraction digits is used. The value "lessPrecision" indicates that the maximum number of 2840 * valid digits is used. The default value is "auto". 2841 * 2842 * @type { ?string } 2843 * @syscap SystemCapability.Global.I18n 2844 * @atomicservice 2845 * @since arkts {'1.1':'18', '1.2':'20'} 2846 * @arkts 1.1&1.2 2847 */ 2848 roundingPriority?: string; 2849 2850 /** 2851 * Rounding increment. The value can be: 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, or 5000. 2852 * The default value is 1. 2853 * 2854 * @type { ?number } 2855 * @syscap SystemCapability.Global.I18n 2856 * @atomicservice 2857 * @since arkts {'1.1':'18', '1.2':'20'} 2858 * @arkts 1.1&1.2 2859 */ 2860 roundingIncrement?: number; 2861 2862 /** 2863 * Rounding mode. The value can be: 2864 * "ceil": rounding up. 2865 * "floor": rounding down. 2866 * "expand": rounding away from 0. 2867 * "trunc": rounding toward 0. 2868 * "halfCeil": half-rounding up; that is, rounding up when the decimal number is greater than or equal to half of 2869 * the increment, and rounding down otherwise. 2870 * "halfFloor": half-rounding down; that is, rounding up when the decimal number is greater than half of the 2871 * increment, and rounding down otherwise. 2872 * "halfExpand": half-rounding away from 0; that is, rounding away from 0 when the decimal number is greater than 2873 * or equal to half of the increment, and rounding toward 0 otherwise. 2874 * "halfTrunc": half-rounding toward 0; that is, rounding away from 0 when the decimal number is greater than half 2875 * of the increment, and rounding toward 0 otherwise. 2876 * "halfEven": half-rounding to the nearest even number; that is, rounding away from 0 when the decimal number is 2877 * greater than half of the increment, rounding toward 0 when the decimal number is less than half of 2878 * the increment, and rounding to the nearest even number when the decimal number is exactly half of 2879 * the increment. 2880 * The default value is "halfExpand". 2881 * 2882 * @type { ?string } 2883 * @syscap SystemCapability.Global.I18n 2884 * @atomicservice 2885 * @since arkts {'1.1':'18', '1.2':'20'} 2886 * @arkts 1.1&1.2 2887 */ 2888 roundingMode?: string; 2889 } 2890 2891 /** 2892 * Provides the API for formatting number strings. 2893 * 2894 * @syscap SystemCapability.Global.I18n 2895 * @since 6 2896 */ 2897 /** 2898 * Provides the API for formatting number strings. 2899 * 2900 * @syscap SystemCapability.Global.I18n 2901 * @crossplatform 2902 * @since 10 2903 */ 2904 /** 2905 * Provides the API for formatting number strings. 2906 * 2907 * @syscap SystemCapability.Global.I18n 2908 * @crossplatform 2909 * @atomicservice 2910 * @since arkts {'1.1':'12', '1.2':'20'} 2911 * @arkts 1.1&1.2 2912 */ 2913 export class NumberFormat { 2914 /** 2915 * A constructor used to create a NumberFormat object. 2916 * 2917 * @syscap SystemCapability.Global.I18n 2918 * @since 8 2919 */ 2920 /** 2921 * A constructor used to create a NumberFormat object. 2922 * 2923 * @syscap SystemCapability.Global.I18n 2924 * @crossplatform 2925 * @since 10 2926 */ 2927 /** 2928 * Creates a NumberFormat object for the specified locale. 2929 * 2930 * @syscap SystemCapability.Global.I18n 2931 * @crossplatform 2932 * @atomicservice 2933 * @since arkts {'1.1':'12', '1.2':'20'} 2934 * @arkts 1.1&1.2 2935 */ 2936 constructor(); 2937 2938 /** 2939 * A constructor used to create a NumberFormat object. 2940 * 2941 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 2942 * the language and optionally the script and region, for the NumberFormat object. 2943 * @param { NumberOptions } [options] - Indicates the options used to format the number. 2944 * @syscap SystemCapability.Global.I18n 2945 * @since 6 2946 */ 2947 /** 2948 * A constructor used to create a NumberFormat object. 2949 * 2950 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 2951 * the language and optionally the script and region, for the NumberFormat object. 2952 * @param { NumberOptions } [options] - Indicates the options used to format the number. 2953 * @syscap SystemCapability.Global.I18n 2954 * @crossplatform 2955 * @since 10 2956 */ 2957 /** 2958 * Creates a NumberFormat object for the specified locale. 2959 * 2960 * @param { string | Array<string> } locale - Locale ID or locale ID array. If the input is a locale ID array, 2961 * the first valid locale ID is used. 2962 * @param { NumberOptions } [options] - Options for creating the NumberFormat object. 2963 * @syscap SystemCapability.Global.I18n 2964 * @crossplatform 2965 * @atomicservice 2966 * @since arkts {'1.1':'12', '1.2':'20'} 2967 * @arkts 1.1&1.2 2968 */ 2969 constructor(locale: string | Array<string>, options?: NumberOptions); 2970 2971 /** 2972 * Obtains the formatted number string. 2973 * 2974 * @param { number } number Indicates the number to be formatted. 2975 * @returns { string } a number string formatted based on the specified locale. 2976 * @syscap SystemCapability.Global.I18n 2977 * @since 6 2978 */ 2979 /** 2980 * Obtains the formatted number string. 2981 * 2982 * @param { number } number Indicates the number to be formatted. 2983 * @returns { string } a number string formatted based on the specified locale. 2984 * @syscap SystemCapability.Global.I18n 2985 * @crossplatform 2986 * @since 10 2987 */ 2988 /** 2989 * Formats a number. 2990 * 2991 * @param { number } num - Number to be formatted. 2992 * @returns { string } Formatted number. 2993 * @syscap SystemCapability.Global.I18n 2994 * @crossplatform 2995 * @atomicservice 2996 * @since arkts {'1.1':'12', '1.2':'20'} 2997 * @arkts 1.1&1.2 2998 */ 2999 format(num: number): string; 3000 3001 /** 3002 * Formats a number range. 3003 * 3004 * @param { number } startRange - Start number. 3005 * @param { number } endRange - End number. 3006 * @returns { string } Formatted number range. 3007 * @syscap SystemCapability.Global.I18n 3008 * @atomicservice 3009 * @since arkts {'1.1':'18', '1.2':'20'} 3010 * @arkts 1.1&1.2 3011 */ 3012 formatRange(startRange: number, endRange: number): string; 3013 3014 /** 3015 * Obtains the options of the NumberFormat object. 3016 * 3017 * @returns { NumberOptions } the options of the NumberFormat object. 3018 * @syscap SystemCapability.Global.I18n 3019 * @since 6 3020 */ 3021 /** 3022 * Obtains the options of the NumberFormat object. 3023 * 3024 * @returns { NumberOptions } the options of the NumberFormat object. 3025 * @syscap SystemCapability.Global.I18n 3026 * @crossplatform 3027 * @since 10 3028 */ 3029 /** 3030 * Obtains the options for creating a NumberFormat object. 3031 * 3032 * @returns { NumberOptions } Options for creating the NumberFormat object. 3033 * @syscap SystemCapability.Global.I18n 3034 * @crossplatform 3035 * @atomicservice 3036 * @since arkts {'1.1':'12', '1.2':'20'} 3037 * @arkts 1.1&1.2 3038 */ 3039 resolvedOptions(): NumberOptions; 3040 } 3041 3042 /** 3043 * Provides the options of Collator 3044 * 3045 * @interface CollatorOptions 3046 * @syscap SystemCapability.Global.I18n 3047 * @since 8 3048 */ 3049 /** 3050 * Provides the options of Collator 3051 * 3052 * @interface CollatorOptions 3053 * @syscap SystemCapability.Global.I18n 3054 * @crossplatform 3055 * @since 10 3056 */ 3057 /** 3058 * Defines the options for creating a Collator object. 3059 * 3060 * @interface CollatorOptions 3061 * @syscap SystemCapability.Global.I18n 3062 * @crossplatform 3063 * @atomicservice 3064 * @since arkts {'1.1':'12', '1.2':'20'} 3065 * @arkts 1.1&1.2 3066 */ 3067 export interface CollatorOptions { 3068 /** 3069 * The locale matching algorithm to use. 3070 * Possible values are "lookup" and "best fit"; the default is "best fit". 3071 * 3072 * @type { string } 3073 * @syscap SystemCapability.Global.I18n 3074 * @since 8 3075 */ 3076 /** 3077 * The locale matching algorithm to use. 3078 * Possible values are "lookup" and "best fit"; the default is "best fit". 3079 * 3080 * @type { ?string } 3081 * @syscap SystemCapability.Global.I18n 3082 * @since 9 3083 */ 3084 /** 3085 * The locale matching algorithm to use. 3086 * Possible values are "lookup" and "best fit"; the default is "best fit". 3087 * 3088 * @type { ?string } 3089 * @syscap SystemCapability.Global.I18n 3090 * @crossplatform 3091 * @since 10 3092 */ 3093 /** 3094 * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". 3095 * 3096 * @type { ?string } 3097 * @syscap SystemCapability.Global.I18n 3098 * @crossplatform 3099 * @atomicservice 3100 * @since arkts {'1.1':'12', '1.2':'20'} 3101 * @arkts 1.1&1.2 3102 */ 3103 localeMatcher?: string; 3104 3105 /** 3106 * Whether the comparison is for sorting or for searching for matching strings. 3107 * Possible values are "sort" and "search"; the default is "sort". 3108 * 3109 * @type { string } 3110 * @syscap SystemCapability.Global.I18n 3111 * @since 8 3112 */ 3113 /** 3114 * Whether the comparison is for sorting or for searching for matching strings. 3115 * Possible values are "sort" and "search"; the default is "sort". 3116 * 3117 * @type { ?string } 3118 * @syscap SystemCapability.Global.I18n 3119 * @since 9 3120 */ 3121 /** 3122 * Whether the comparison is for sorting or for searching for matching strings. 3123 * Possible values are "sort" and "search"; the default is "sort". 3124 * 3125 * @type { ?string } 3126 * @syscap SystemCapability.Global.I18n 3127 * @crossplatform 3128 * @since 10 3129 */ 3130 /** 3131 * Whether the comparison is for sorting or for searching. The value can be "sort" or "search". 3132 * The default value is "sort". 3133 * 3134 * @type { ?string } 3135 * @syscap SystemCapability.Global.I18n 3136 * @crossplatform 3137 * @atomicservice 3138 * @since arkts {'1.1':'12', '1.2':'20'} 3139 * @arkts 1.1&1.2 3140 */ 3141 usage?: string; 3142 3143 /** 3144 * Which differences in the strings should lead to non-zero result values. 3145 * Possible values are "base", "accent", "case", "variant". 3146 * "base" are used when only strings that differ in base letters compare as unequal. 3147 * "accent" are used when only strings that differ in base letters or accents and 3148 * other diacritic marks compare as unequal. 3149 * "case" are used when only strings that differ in base letters or case compare as unequal. 3150 * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, 3151 * or case compare as unequal. 3152 * 3153 * @type { string } 3154 * @syscap SystemCapability.Global.I18n 3155 * @since 8 3156 */ 3157 /** 3158 * Which differences in the strings should lead to non-zero result values. 3159 * Possible values are "base", "accent", "case", "variant". 3160 * "base" are used when only strings that differ in base letters compare as unequal. 3161 * "accent" are used when only strings that differ in base letters or accents and 3162 * other diacritic marks compare as unequal. 3163 * "case" are used when only strings that differ in base letters or case compare as unequal. 3164 * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, 3165 * or case compare as unequal. 3166 * 3167 * @type { ?string } 3168 * @syscap SystemCapability.Global.I18n 3169 * @since 9 3170 */ 3171 /** 3172 * Which differences in the strings should lead to non-zero result values. 3173 * Possible values are "base", "accent", "case", "variant". 3174 * "base" are used when only strings that differ in base letters compare as unequal. 3175 * "accent" are used when only strings that differ in base letters or accents and 3176 * other diacritic marks compare as unequal. 3177 * "case" are used when only strings that differ in base letters or case compare as unequal. 3178 * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, 3179 * or case compare as unequal. 3180 * 3181 * @type { ?string } 3182 * @syscap SystemCapability.Global.I18n 3183 * @crossplatform 3184 * @since 10 3185 */ 3186 /** 3187 * Differences in the strings that lead to non-zero return values. The value can be "base", "accent", "case", or 3188 * "letiant". The default value is "variant". 3189 * 3190 * @type { ?string } 3191 * @syscap SystemCapability.Global.I18n 3192 * @crossplatform 3193 * @atomicservice 3194 * @since arkts {'1.1':'12', '1.2':'20'} 3195 * @arkts 1.1&1.2 3196 */ 3197 sensitivity?: string; 3198 3199 /** 3200 * Whether punctuation should be ignored. default value is false. 3201 * 3202 * @type { boolean } 3203 * @syscap SystemCapability.Global.I18n 3204 * @since 8 3205 */ 3206 /** 3207 * Whether punctuation should be ignored. Default value is false. 3208 * 3209 * @type { ?boolean } 3210 * @syscap SystemCapability.Global.I18n 3211 * @since 9 3212 */ 3213 /** 3214 * Whether punctuation should be ignored. Default value is false. 3215 * 3216 * @type { ?boolean } 3217 * @syscap SystemCapability.Global.I18n 3218 * @crossplatform 3219 * @since 10 3220 */ 3221 /** 3222 * Whether to ignore punctuation. The value "true" means to ignore punctuation, and the value "false" means the 3223 * opposite. The default value is "false". 3224 * 3225 * @type { ?boolean } 3226 * @syscap SystemCapability.Global.I18n 3227 * @crossplatform 3228 * @atomicservice 3229 * @since arkts {'1.1':'12', '1.2':'20'} 3230 * @arkts 1.1&1.2 3231 */ 3232 ignorePunctuation?: boolean; 3233 /** 3234 * Variant collations for certain locales. 3235 * 3236 * @type { string } 3237 * @syscap SystemCapability.Global.I18n 3238 * @since 8 3239 */ 3240 /** 3241 * Variant collations for certain locales. 3242 * 3243 * @type { ?string } 3244 * @syscap SystemCapability.Global.I18n 3245 * @since 9 3246 */ 3247 /** 3248 * Variant collations for certain locales. 3249 * 3250 * @type { ?string } 3251 * @syscap SystemCapability.Global.I18n 3252 * @crossplatform 3253 * @since 10 3254 */ 3255 /** 3256 * Collation rule. The value can be any of the following: "big5han", "compat", "dict", "direct", "ducet", "eor", 3257 * "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "searchjl", "stroke", "trad", "unihan", or "zhuyin". 3258 * The default value is "default". 3259 * 3260 * @type { ?string } 3261 * @syscap SystemCapability.Global.I18n 3262 * @crossplatform 3263 * @atomicservice 3264 * @since arkts {'1.1':'12', '1.2':'20'} 3265 * @arkts 1.1&1.2 3266 */ 3267 collation?: string; 3268 3269 /** 3270 * Whether numeric collation should be used. Default value is false. 3271 * 3272 * @type { boolean } 3273 * @syscap SystemCapability.Global.I18n 3274 * @since 8 3275 */ 3276 /** 3277 * Whether numeric collation should be used. Default value is false. 3278 * 3279 * @type { ?boolean } 3280 * @syscap SystemCapability.Global.I18n 3281 * @since 9 3282 */ 3283 /** 3284 * Whether numeric collation should be used. Default value is false. 3285 * 3286 * @type { ?boolean } 3287 * @syscap SystemCapability.Global.I18n 3288 * @crossplatform 3289 * @since 10 3290 */ 3291 /** 3292 * Whether to use numeric collation. The value "true" means to use numeric collation, and the value "false" means 3293 * the opposite. The default value is "false". 3294 * 3295 * @type { ?boolean } 3296 * @syscap SystemCapability.Global.I18n 3297 * @crossplatform 3298 * @atomicservice 3299 * @since arkts {'1.1':'12', '1.2':'20'} 3300 * @arkts 1.1&1.2 3301 */ 3302 numeric?: boolean; 3303 3304 /** 3305 * Whether upper case or lower case should sort first. 3306 * Possible values are "upper", "lower", or "false" (use the locale's default). 3307 * 3308 * @type { string } 3309 * @syscap SystemCapability.Global.I18n 3310 * @since 8 3311 */ 3312 /** 3313 * Whether upper case or lower case should sort first. 3314 * Possible values are "upper", "lower", or "false" (use the locale's default). 3315 * 3316 * @type { ?string } 3317 * @syscap SystemCapability.Global.I18n 3318 * @since 9 3319 */ 3320 /** 3321 * Whether upper case or lower case should sort first. 3322 * Possible values are "upper", "lower", or "false" (use the locale's default). 3323 * 3324 * @type { ?string } 3325 * @syscap SystemCapability.Global.I18n 3326 * @crossplatform 3327 * @since 10 3328 */ 3329 /** 3330 * Whether upper case or lower case is sorted first. The value can be "upper", "lower", or "false". 3331 * The default value is "false". 3332 * 3333 * @type { ?string } 3334 * @syscap SystemCapability.Global.I18n 3335 * @crossplatform 3336 * @atomicservice 3337 * @since arkts {'1.1':'12', '1.2':'20'} 3338 * @arkts 1.1&1.2 3339 */ 3340 caseFirst?: string; 3341 } 3342 3343 /** 3344 * Enable language-sensitive string comparison. 3345 * 3346 * @syscap SystemCapability.Global.I18n 3347 * @since 8 3348 */ 3349 /** 3350 * Enable language-sensitive string comparison. 3351 * 3352 * @syscap SystemCapability.Global.I18n 3353 * @crossplatform 3354 * @since 10 3355 */ 3356 /** 3357 * Enable language-sensitive string comparison. 3358 * 3359 * @syscap SystemCapability.Global.I18n 3360 * @crossplatform 3361 * @atomicservice 3362 * @since arkts {'1.1':'12', '1.2':'20'} 3363 * @arkts 1.1&1.2 3364 */ 3365 export class Collator { 3366 /** 3367 * A constructor used to create Collator object. 3368 * 3369 * @syscap SystemCapability.Global.I18n 3370 * @since 8 3371 */ 3372 /** 3373 * A constructor used to create Collator object. 3374 * 3375 * @syscap SystemCapability.Global.I18n 3376 * @crossplatform 3377 * @since 10 3378 */ 3379 /** 3380 * Creates a Collator object. 3381 * 3382 * @syscap SystemCapability.Global.I18n 3383 * @crossplatform 3384 * @atomicservice 3385 * @since arkts {'1.1':'12', '1.2':'20'} 3386 * @arkts 1.1&1.2 3387 */ 3388 constructor(); 3389 /** 3390 * A constructor used to create Collator Object; 3391 * 3392 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3393 * the language and optionally the script and region, for the Collator object. 3394 * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. 3395 * @syscap SystemCapability.Global.I18n 3396 * @since 8 3397 */ 3398 /** 3399 * A constructor used to create Collator Object; 3400 * 3401 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3402 * the language and optionally the script and region, for the Collator object. 3403 * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. 3404 * @syscap SystemCapability.Global.I18n 3405 * @crossplatform 3406 * @since 10 3407 */ 3408 /** 3409 * Creates a Collator object. 3410 * 3411 * @param { string | Array<string> } locale - Locale ID or locale ID array. If the input is a locale ID array, 3412 * the first valid locale ID is used. 3413 * @param { CollatorOptions } [options] - Options for creating a Collator object. 3414 * @syscap SystemCapability.Global.I18n 3415 * @crossplatform 3416 * @atomicservice 3417 * @since arkts {'1.1':'12', '1.2':'20'} 3418 * @arkts 1.1&1.2 3419 */ 3420 constructor(locale: string | Array<string>, options?: CollatorOptions); 3421 3422 /** 3423 * compares two strings according to the sort order of this Collator object 3424 * 3425 * @param { string } first - The first string to compare. 3426 * @param { string } second - The second string to compare. 3427 * @returns { number } a number indicating how first compare to second: 3428 * a negative value if string1 comes before string2; 3429 * a positive value if string1 comes after string2; 3430 * 0 if they are considered equal. 3431 * @syscap SystemCapability.Global.I18n 3432 * @since 8 3433 */ 3434 /** 3435 * compares two strings according to the sort order of this Collator object 3436 * 3437 * @param { string } first - The first string to compare. 3438 * @param { string } second - The second string to compare. 3439 * @returns { number } a number indicating how first compare to second: 3440 * a negative value if string1 comes before string2; 3441 * a positive value if string1 comes after string2; 3442 * 0 if they are considered equal. 3443 * @syscap SystemCapability.Global.I18n 3444 * @crossplatform 3445 * @since 10 3446 */ 3447 /** 3448 * Compares two strings based on the specified collation rules. 3449 * 3450 * @param { string } first - First string to compare. 3451 * @param { string } second - Second string to compare. 3452 * @returns { number } Comparison result. If the value is a negative number, the first string comes before the 3453 * second string. If the value is 0, the first and second strings are in the same sequence. 3454 * If the value is a positive number, the first string is comes after the second string. 3455 * @syscap SystemCapability.Global.I18n 3456 * @crossplatform 3457 * @atomicservice 3458 * @since arkts {'1.1':'12', '1.2':'20'} 3459 * @arkts 1.1&1.2 3460 */ 3461 compare(first: string, second: string): number; 3462 3463 /** 3464 * Returns a new object with properties that reflect the locale and collation options computed 3465 * during initialization of the object. 3466 * 3467 * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. 3468 * @syscap SystemCapability.Global.I18n 3469 * @since 8 3470 */ 3471 /** 3472 * Returns a new object with properties that reflect the locale and collation options computed 3473 * during initialization of the object. 3474 * 3475 * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. 3476 * @syscap SystemCapability.Global.I18n 3477 * @crossplatform 3478 * @since 10 3479 */ 3480 /** 3481 * Obtains the options for creating a Collator object. 3482 * 3483 * @returns { CollatorOptions } Options for creating a Collator object. 3484 * @syscap SystemCapability.Global.I18n 3485 * @crossplatform 3486 * @atomicservice 3487 * @since arkts {'1.1':'12', '1.2':'20'} 3488 * @arkts 1.1&1.2 3489 */ 3490 resolvedOptions(): CollatorOptions; 3491 } 3492 3493 /** 3494 * Provides the options of PluralRules 3495 * 3496 * @interface PluralRulesOptions 3497 * @syscap SystemCapability.Global.I18n 3498 * @since 8 3499 */ 3500 /** 3501 * Provides the options of PluralRules 3502 * 3503 * @interface PluralRulesOptions 3504 * @syscap SystemCapability.Global.I18n 3505 * @crossplatform 3506 * @since 10 3507 */ 3508 /** 3509 * Provides the options of PluralRules 3510 * 3511 * @interface PluralRulesOptions 3512 * @syscap SystemCapability.Global.I18n 3513 * @crossplatform 3514 * @atomicservice 3515 * @since 12 3516 * @deprecated since 20 3517 * @useinstead Intl.PluralRulesOptions 3518 */ 3519 export interface PluralRulesOptions { 3520 /** 3521 * The locale matching algorithm to use. 3522 * Possible values are "lookup" and "best fit"; the default is "best fit". 3523 * 3524 * @type { string } 3525 * @syscap SystemCapability.Global.I18n 3526 * @since 8 3527 */ 3528 /** 3529 * The locale matching algorithm to use. 3530 * Possible values are "lookup" and "best fit"; the default is "best fit". 3531 * 3532 * @type { ?string } 3533 * @syscap SystemCapability.Global.I18n 3534 * @since 9 3535 */ 3536 /** 3537 * The locale matching algorithm to use. 3538 * Possible values are "lookup" and "best fit"; the default is "best fit". 3539 * 3540 * @type { ?string } 3541 * @syscap SystemCapability.Global.I18n 3542 * @crossplatform 3543 * @since 10 3544 */ 3545 /** 3546 * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". 3547 * 3548 * @type { ?string } 3549 * @syscap SystemCapability.Global.I18n 3550 * @crossplatform 3551 * @atomicservice 3552 * @since 12 3553 * @deprecated since 20 3554 * @useinstead Intl.PluralRulesOptions.localeMatcher 3555 */ 3556 localeMatcher?: string; 3557 3558 /** 3559 * The type to use. Possible values are: "cardinal", "ordinal" 3560 * 3561 * @type { string } 3562 * @syscap SystemCapability.Global.I18n 3563 * @since 8 3564 */ 3565 /** 3566 * The type to use. Possible values are: "cardinal", "ordinal" 3567 * 3568 * @type { ?string } 3569 * @syscap SystemCapability.Global.I18n 3570 * @since 9 3571 */ 3572 /** 3573 * The type to use. Possible values are: "cardinal", "ordinal" 3574 * 3575 * @type { ?string } 3576 * @syscap SystemCapability.Global.I18n 3577 * @crossplatform 3578 * @since 10 3579 */ 3580 /** 3581 * Collation type. The value can be "cardinal" or "ordinal". The default value is "cardinal". The value "cardinal" 3582 * indicates a cardinal number and the value "ordinal" indicates an ordinal number. 3583 * 3584 * @type { ?string } 3585 * @syscap SystemCapability.Global.I18n 3586 * @crossplatform 3587 * @atomicservice 3588 * @since 12 3589 * @deprecated since 20 3590 * @useinstead Intl.PluralRulesOptions.type 3591 */ 3592 type?: string; 3593 3594 /** 3595 * The minimum number of integer digits to use. 3596 * Possible values are from 1 to 21; the default is 1. 3597 * 3598 * @type { number } 3599 * @syscap SystemCapability.Global.I18n 3600 * @since 8 3601 */ 3602 /** 3603 * The minimum number of integer digits to use. 3604 * Possible values are from 1 to 21; the default is 1. 3605 * 3606 * @type { ?number } 3607 * @syscap SystemCapability.Global.I18n 3608 * @since 9 3609 */ 3610 /** 3611 * The minimum number of integer digits to use. 3612 * Possible values are from 1 to 21; the default is 1. 3613 * 3614 * @type { ?number } 3615 * @syscap SystemCapability.Global.I18n 3616 * @crossplatform 3617 * @since 10 3618 */ 3619 /** 3620 * Minimum number of digits allowed in the integer part of a number. The value ranges from 1 to 21. 3621 * The default value is 1. 3622 * 3623 * @type { ?number } 3624 * @syscap SystemCapability.Global.I18n 3625 * @crossplatform 3626 * @atomicservice 3627 * @since 12 3628 * @deprecated since 20 3629 * @useinstead Intl.PluralRulesOptions.minimumIntegerDigits 3630 */ 3631 minimumIntegerDigits?: number; 3632 3633 /** 3634 * The minimum number of fraction digits to use. 3635 * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; 3636 * 3637 * @type { number } 3638 * @syscap SystemCapability.Global.I18n 3639 * @since 8 3640 */ 3641 /** 3642 * The minimum number of fraction digits to use. 3643 * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; 3644 * 3645 * @type { ?number } 3646 * @syscap SystemCapability.Global.I18n 3647 * @since 9 3648 */ 3649 /** 3650 * The minimum number of fraction digits to use. 3651 * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; 3652 * 3653 * @type { ?number } 3654 * @syscap SystemCapability.Global.I18n 3655 * @crossplatform 3656 * @since 10 3657 */ 3658 /** 3659 * Minimum number of digits in the fraction part of a number. The value ranges from 0 to 20. 3660 * The default value is 0. 3661 * 3662 * @type { ?number } 3663 * @syscap SystemCapability.Global.I18n 3664 * @crossplatform 3665 * @atomicservice 3666 * @since 12 3667 * @deprecated since 20 3668 * @useinstead Intl.PluralRulesOptions.minimumFractionDigits 3669 */ 3670 minimumFractionDigits?: number; 3671 3672 /** 3673 * The maximum number of fraction digits to use. 3674 * Possible values are from 0 to 20; 3675 * the default for plain number formatting is the larger of minimumFractionDigits and 3; 3676 * 3677 * @type { number } 3678 * @syscap SystemCapability.Global.I18n 3679 * @since 8 3680 */ 3681 /** 3682 * The maximum number of fraction digits to use. 3683 * Possible values are from 0 to 20; 3684 * the default for plain number formatting is the larger of minimumFractionDigits and 3; 3685 * 3686 * @type { ?number } 3687 * @syscap SystemCapability.Global.I18n 3688 * @since 9 3689 */ 3690 /** 3691 * The maximum number of fraction digits to use. 3692 * Possible values are from 0 to 20; 3693 * the default for plain number formatting is the larger of minimumFractionDigits and 3; 3694 * 3695 * @type { ?number } 3696 * @syscap SystemCapability.Global.I18n 3697 * @crossplatform 3698 * @since 10 3699 */ 3700 /** 3701 * Maximum number of digits in the fraction part of a number. The value ranges from 1 to 21. 3702 * The default value is 3. 3703 * 3704 * @type { ?number } 3705 * @syscap SystemCapability.Global.I18n 3706 * @crossplatform 3707 * @atomicservice 3708 * @since 12 3709 * @deprecated since 20 3710 * @useinstead Intl.PluralRulesOptions.maximumFractionDigits 3711 */ 3712 maximumFractionDigits?: number; 3713 3714 /** 3715 * The minimum number of significant digits to use. 3716 * Possible values are from 1 to 21; the default is 1. 3717 * 3718 * @type { number } 3719 * @syscap SystemCapability.Global.I18n 3720 * @since 8 3721 */ 3722 /** 3723 * The minimum number of significant digits to use. 3724 * Possible values are from 1 to 21; the default is 1. 3725 * 3726 * @type { ?number } 3727 * @syscap SystemCapability.Global.I18n 3728 * @since 9 3729 */ 3730 /** 3731 * The minimum number of significant digits to use. 3732 * Possible values are from 1 to 21; the default is 1. 3733 * 3734 * @type { ?number } 3735 * @syscap SystemCapability.Global.I18n 3736 * @crossplatform 3737 * @since 10 3738 */ 3739 /** 3740 * Minimum number of the least significant digits. The value ranges from 1 to 21. The default value is 1. 3741 * 3742 * @type { ?number } 3743 * @syscap SystemCapability.Global.I18n 3744 * @crossplatform 3745 * @atomicservice 3746 * @since 12 3747 * @deprecated since 20 3748 * @useinstead Intl.PluralRulesOptions.minimumSignificantDigits 3749 */ 3750 minimumSignificantDigits?: number; 3751 3752 /** 3753 * The maximum number of significant digits to use. 3754 * Possible values are from 1 to 21; the default is 21. 3755 * 3756 * @type { number } 3757 * @syscap SystemCapability.Global.I18n 3758 * @since 8 3759 */ 3760 /** 3761 * The maximum number of significant digits to use. 3762 * Possible values are from 1 to 21; the default is 21. 3763 * 3764 * @type { ?number } 3765 * @syscap SystemCapability.Global.I18n 3766 * @since 9 3767 */ 3768 /** 3769 * The maximum number of significant digits to use. 3770 * Possible values are from 1 to 21; the default is 21. 3771 * 3772 * @type { ?number } 3773 * @syscap SystemCapability.Global.I18n 3774 * @crossplatform 3775 * @since 10 3776 */ 3777 /** 3778 * Maximum number of the least significant digits. The value ranges from 1 to 21. The default value is 21. 3779 * 3780 * @type { ?number } 3781 * @syscap SystemCapability.Global.I18n 3782 * @crossplatform 3783 * @atomicservice 3784 * @since 12 3785 * @deprecated since 20 3786 * @useinstead Intl.PluralRulesOptions.maximumSignificantDigits 3787 */ 3788 maximumSignificantDigits?: number; 3789 } 3790 3791 /** 3792 * Enables plural-sensitive formatting and plural-related language rules. 3793 * 3794 * @syscap SystemCapability.Global.I18n 3795 * @since 8 3796 */ 3797 /** 3798 * Enables plural-sensitive formatting and plural-related language rules. 3799 * 3800 * @syscap SystemCapability.Global.I18n 3801 * @crossplatform 3802 * @since 10 3803 */ 3804 /** 3805 * Enables plural-sensitive formatting and plural-related language rules. 3806 * 3807 * @syscap SystemCapability.Global.I18n 3808 * @crossplatform 3809 * @atomicservice 3810 * @since 12 3811 * @deprecated since 20 3812 * @useinstead Intl.PluralRules 3813 */ 3814 export class PluralRules { 3815 /** 3816 * A constructor used to create PluralRules object. 3817 * 3818 * @syscap SystemCapability.Global.I18n 3819 * @since 8 3820 */ 3821 /** 3822 * A constructor used to create PluralRules object. 3823 * 3824 * @syscap SystemCapability.Global.I18n 3825 * @crossplatform 3826 * @since 10 3827 */ 3828 /** 3829 * Creates a PluralRules object to obtain the singular-plural type of numbers. 3830 * 3831 * @syscap SystemCapability.Global.I18n 3832 * @crossplatform 3833 * @atomicservice 3834 * @since 12 3835 * @deprecated since 20 3836 * @useinstead Intl.PluralRules.constructor 3837 */ 3838 constructor(); 3839 3840 /** 3841 * A constructor used to create PluralRules object. 3842 * 3843 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3844 * the language and optionally the script and region, for the PluralRules object. 3845 * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. 3846 * @syscap SystemCapability.Global.I18n 3847 * @since 8 3848 */ 3849 /** 3850 * A constructor used to create PluralRules object. 3851 * 3852 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3853 * the language and optionally the script and region, for the PluralRules object. 3854 * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. 3855 * @syscap SystemCapability.Global.I18n 3856 * @crossplatform 3857 * @since 10 3858 */ 3859 /** 3860 * Creates a PluralRules object to obtain the singular-plural type of numbers. 3861 * 3862 * @param { string | Array<string> } locale - Locale ID or locale ID array. If the input is a locale ID array, 3863 * the first valid locale ID is used. 3864 * @param { PluralRulesOptions } [options] - Options for creating a PluralRules object. 3865 * @syscap SystemCapability.Global.I18n 3866 * @crossplatform 3867 * @atomicservice 3868 * @since 12 3869 * @deprecated since 20 3870 * @useinstead Intl.PluralRules.constructor 3871 */ 3872 constructor(locale: string | Array<string>, options?: PluralRulesOptions); 3873 3874 /** 3875 * Returns a string indicating which plural rule to use for locale-aware formatting. 3876 * 3877 * @param { number } n - The number to get a plural rule for. 3878 * @returns { string } A string representing the pluralization category of the number, 3879 * can be one of zero, one, two, few, many or other. 3880 * @syscap SystemCapability.Global.I18n 3881 * @since 8 3882 */ 3883 /** 3884 * Returns a string indicating which plural rule to use for locale-aware formatting. 3885 * 3886 * @param { number } n - The number to get a plural rule for. 3887 * @returns { string } A string representing the pluralization category of the number, 3888 * can be one of zero, one, two, few, many or other. 3889 * @syscap SystemCapability.Global.I18n 3890 * @crossplatform 3891 * @since 10 3892 */ 3893 /** 3894 * Obtains the singular-plural type of the specified number. 3895 * 3896 * @param { number } n - Number for which the singular-plural type is to be obtained. 3897 * @returns { string } Singular-plural type. The value can be any of the following: "zero", "one", "two", "few", 3898 * "many", "others". For details about the meanings of different values, see 3899 * [Language Plural Rules](https://www.unicode.org/cldr/charts/45/supplemental/language_plural_rules.html). 3900 * @syscap SystemCapability.Global.I18n 3901 * @crossplatform 3902 * @atomicservice 3903 * @since 12 3904 * @deprecated since 20 3905 * @useinstead Intl.PluralRules.select 3906 */ 3907 select(n: number): string; 3908 } 3909 3910 /** 3911 * Provides the input options of RelativeTimeFormat. 3912 * 3913 * @interface RelativeTimeFormatInputOptions 3914 * @syscap SystemCapability.Global.I18n 3915 * @since 8 3916 */ 3917 /** 3918 * Provides the input options of RelativeTimeFormat. 3919 * 3920 * @interface RelativeTimeFormatInputOptions 3921 * @syscap SystemCapability.Global.I18n 3922 * @crossplatform 3923 * @since 10 3924 */ 3925 /** 3926 * Provides the input options of RelativeTimeFormat. 3927 * 3928 * @interface RelativeTimeFormatInputOptions 3929 * @syscap SystemCapability.Global.I18n 3930 * @crossplatform 3931 * @atomicservice 3932 * @since 12 3933 * @deprecated since 20 3934 * @useinstead Intl.RelativeTimeFormatOptions 3935 */ 3936 export interface RelativeTimeFormatInputOptions { 3937 /** 3938 * The locale matching algorithm to use. 3939 * Possible values are: lookup, best fit 3940 * 3941 * @type { string } 3942 * @syscap SystemCapability.Global.I18n 3943 * @since 8 3944 */ 3945 /** 3946 * The locale matching algorithm to use. 3947 * Possible values are: lookup, best fit 3948 * 3949 * @type { ?string } 3950 * @syscap SystemCapability.Global.I18n 3951 * @since 9 3952 */ 3953 /** 3954 * The locale matching algorithm to use. 3955 * Possible values are: lookup, best fit 3956 * 3957 * @type { ?string } 3958 * @syscap SystemCapability.Global.I18n 3959 * @crossplatform 3960 * @since 10 3961 */ 3962 /** 3963 * Locale matching algorithm. The value can be "lookup" or "best fit". The default value is "best fit". 3964 * 3965 * @type { ?string } 3966 * @syscap SystemCapability.Global.I18n 3967 * @crossplatform 3968 * @atomicservice 3969 * @since 12 3970 * @deprecated since 20 3971 * @useinstead Intl.RelativeTimeFormatOptions.localeMatcher 3972 */ 3973 localeMatcher?: string; 3974 3975 /** 3976 * The format of output message. 3977 * Possible values are: always, auto 3978 * 3979 * @type { string } 3980 * @syscap SystemCapability.Global.I18n 3981 * @since 8 3982 */ 3983 /** 3984 * The format of output message. 3985 * Possible values are: always, auto 3986 * 3987 * @type { ?string } 3988 * @syscap SystemCapability.Global.I18n 3989 * @since 9 3990 */ 3991 /** 3992 * The format of output message. 3993 * Possible values are: always, auto 3994 * 3995 * @type { ?string } 3996 * @syscap SystemCapability.Global.I18n 3997 * @crossplatform 3998 * @since 10 3999 */ 4000 /** 4001 * Format of the output message. The value can be "always" or "auto". The default value is "always". 4002 * 4003 * @type { ?string } 4004 * @syscap SystemCapability.Global.I18n 4005 * @crossplatform 4006 * @atomicservice 4007 * @since 12 4008 * @deprecated since 20 4009 * @useinstead Intl.RelativeTimeFormatOptions.numeric 4010 */ 4011 numeric?: string; 4012 4013 /** 4014 * The length of the internationalized message. 4015 * Possible values are: long, short, narrow 4016 * 4017 * @type { string } 4018 * @syscap SystemCapability.Global.I18n 4019 * @since 8 4020 */ 4021 /** 4022 * The length of the internationalized message. 4023 * Possible values are: long, short, narrow 4024 * 4025 * @type { ?string } 4026 * @syscap SystemCapability.Global.I18n 4027 * @since 9 4028 */ 4029 /** 4030 * The length of the internationalized message. 4031 * Possible values are: long, short, narrow 4032 * 4033 * @type { ?string } 4034 * @syscap SystemCapability.Global.I18n 4035 * @crossplatform 4036 * @since 10 4037 */ 4038 /** 4039 * Length of an internationalized message. The value can be "long", "short", or "narrow". 4040 * The default value is "long". 4041 * 4042 * @type { ?string } 4043 * @syscap SystemCapability.Global.I18n 4044 * @crossplatform 4045 * @atomicservice 4046 * @since 12 4047 * @deprecated since 20 4048 * @useinstead Intl.RelativeTimeFormatOptions.style 4049 */ 4050 style?: string; 4051 } 4052 4053 /** 4054 * Provides the resolved options of RelativeTimeFormat. 4055 * 4056 * @interface RelativeTimeFormatResolvedOptions 4057 * @syscap SystemCapability.Global.I18n 4058 * @since 8 4059 */ 4060 /** 4061 * Provides the resolved options of RelativeTimeFormat. 4062 * 4063 * @interface RelativeTimeFormatResolvedOptions 4064 * @syscap SystemCapability.Global.I18n 4065 * @crossplatform 4066 * @since 10 4067 */ 4068 /** 4069 * Provides the resolved options of RelativeTimeFormat. 4070 * 4071 * @interface RelativeTimeFormatResolvedOptions 4072 * @syscap SystemCapability.Global.I18n 4073 * @crossplatform 4074 * @atomicservice 4075 * @since 12 4076 * @deprecated since 20 4077 * @useinstead Intl.ResolvedRelativeTimeFormatOptions 4078 */ 4079 export interface RelativeTimeFormatResolvedOptions { 4080 /** 4081 * The BCP 47 language tag for the locale actually used. 4082 * 4083 * @syscap SystemCapability.Global.I18n 4084 * @since 8 4085 */ 4086 /** 4087 * The BCP 47 language tag for the locale actually used. 4088 * 4089 * @syscap SystemCapability.Global.I18n 4090 * @crossplatform 4091 * @since 10 4092 */ 4093 /** 4094 * Locale ID, including the language, script, and region. 4095 * 4096 * @type { string } 4097 * @syscap SystemCapability.Global.I18n 4098 * @crossplatform 4099 * @atomicservice 4100 * @since 12 4101 * @deprecated since 20 4102 * @useinstead Intl.ResolvedRelativeTimeFormatOptions.locale 4103 */ 4104 locale: string; 4105 4106 /** 4107 * The length of the internationalized message. 4108 * Possible values are: long, short, narrow 4109 * 4110 * @syscap SystemCapability.Global.I18n 4111 * @since 8 4112 */ 4113 /** 4114 * The length of the internationalized message. 4115 * Possible values are: long, short, narrow 4116 * 4117 * @syscap SystemCapability.Global.I18n 4118 * @crossplatform 4119 * @since 10 4120 */ 4121 /** 4122 * Length of an internationalized message. The value can be "long", "short", or "narrow". 4123 * 4124 * @type { string } 4125 * @syscap SystemCapability.Global.I18n 4126 * @crossplatform 4127 * @atomicservice 4128 * @since 12 4129 * @deprecated since 20 4130 * @useinstead Intl.ResolvedRelativeTimeFormatOptions.style 4131 */ 4132 style: string; 4133 4134 /** 4135 * The format of output message. 4136 * Possible values are: always, auto 4137 * 4138 * @syscap SystemCapability.Global.I18n 4139 * @since 8 4140 */ 4141 /** 4142 * The format of output message. 4143 * Possible values are: always, auto 4144 * 4145 * @syscap SystemCapability.Global.I18n 4146 * @crossplatform 4147 * @since 10 4148 */ 4149 /** 4150 * Format of the output message. The value can be "always" or "auto". 4151 * 4152 * @type { string } 4153 * @syscap SystemCapability.Global.I18n 4154 * @crossplatform 4155 * @atomicservice 4156 * @since 12 4157 * @deprecated since 20 4158 * @useinstead Intl.ResolvedRelativeTimeFormatOptions.numeric 4159 */ 4160 numeric: string; 4161 4162 /** 4163 * The value requested using the Unicode extension key "nu" or filled in as a default. 4164 * 4165 * @syscap SystemCapability.Global.I18n 4166 * @since 8 4167 */ 4168 /** 4169 * The value requested using the Unicode extension key "nu" or filled in as a default. 4170 * 4171 * @syscap SystemCapability.Global.I18n 4172 * @crossplatform 4173 * @since 10 4174 */ 4175 /** 4176 * Numbering system. The value can be: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", 4177 * "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "gonm", "gujr", "guru", "hanidec", "hmng", "hmnp", 4178 * "java", "kali", "khmr", "knda", "lana", "lanatham", "laoo", "latn", "lepc", "limb", "mathbold", "mathdbl", 4179 * "mathmono", "mathsanb", "mathsans", "mlym", "modi", "mong", "mroo", "mtei", "mymr", "mymrshan", "mymrtlng", 4180 * "newa", "nkoo", "olck", "orya", "osma", "rohg", "saur", "segment", "shrd", "sind", "sinh", "sora", "sund", 4181 * "takr", "talu", "tamldec", "telu", "thai", "tibt", "tirh", "vaii", "wara", or "wcho". 4182 * 4183 * @type { string } 4184 * @syscap SystemCapability.Global.I18n 4185 * @crossplatform 4186 * @atomicservice 4187 * @since 12 4188 * @deprecated since 20 4189 * @useinstead Intl.ResolvedRelativeTimeFormatOptions.numberingSystem 4190 */ 4191 numberingSystem: string; 4192 } 4193 4194 /** 4195 * Given a Time period length value and a unit, RelativeTimeFormat object enables 4196 * language-sensitive relative time formatting. 4197 * 4198 * @syscap SystemCapability.Global.I18n 4199 * @since 8 4200 */ 4201 /** 4202 * Given a Time period length value and a unit, RelativeTimeFormat object enables 4203 * language-sensitive relative time formatting. 4204 * 4205 * @syscap SystemCapability.Global.I18n 4206 * @crossplatform 4207 * @since 10 4208 */ 4209 /** 4210 * Given a Time period length value and a unit, RelativeTimeFormat object enables 4211 * language-sensitive relative time formatting. 4212 * 4213 * @syscap SystemCapability.Global.I18n 4214 * @crossplatform 4215 * @atomicservice 4216 * @since 12 4217 * @deprecated since 20 4218 * @useinstead Intl.RelativeTimeFormat 4219 */ 4220 export class RelativeTimeFormat { 4221 /** 4222 * A constructor used to create RelativeTimeFormat object. 4223 * 4224 * @syscap SystemCapability.Global.I18n 4225 * @since 8 4226 */ 4227 /** 4228 * A constructor used to create RelativeTimeFormat object. 4229 * 4230 * @syscap SystemCapability.Global.I18n 4231 * @crossplatform 4232 * @since 10 4233 */ 4234 /** 4235 * Creates a RelativeTimeFormat object. 4236 * 4237 * @syscap SystemCapability.Global.I18n 4238 * @crossplatform 4239 * @atomicservice 4240 * @since 12 4241 * @deprecated since 20 4242 * @useinstead Intl.RelativeTimeFormat.constructor 4243 */ 4244 constructor(); 4245 4246 /** 4247 * A constructor used to create RelativeTimeFormat object. 4248 * 4249 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 4250 * the language and optionally the script and region, for the RelativeTimeFormat object. 4251 * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. 4252 * @syscap SystemCapability.Global.I18n 4253 * @since 8 4254 */ 4255 /** 4256 * A constructor used to create RelativeTimeFormat object. 4257 * 4258 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 4259 * the language and optionally the script and region, for the RelativeTimeFormat object. 4260 * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. 4261 * @syscap SystemCapability.Global.I18n 4262 * @crossplatform 4263 * @since 10 4264 */ 4265 /** 4266 * Creates a RelativeTimeFormat object. 4267 * 4268 * @param { string | Array<string> } locale - Locale ID or locale ID array. If the input is a locale ID array, 4269 * the first valid locale ID is used. 4270 * @param { RelativeTimeFormatInputOptions } [options] - Options for creating a RelativeTimeFormat object. 4271 * @syscap SystemCapability.Global.I18n 4272 * @crossplatform 4273 * @atomicservice 4274 * @since 12 4275 * @deprecated since 20 4276 * @useinstead Intl.RelativeTimeFormat.constructor 4277 */ 4278 constructor(locale: string | Array<string>, options?: RelativeTimeFormatInputOptions); 4279 4280 /** 4281 * formats a value and unit according to the locale and formatting options of this object. 4282 * 4283 * @param { number } value - Numeric value to use in the internationalized relative time message. 4284 * @param { string } unit - Unit to use in the relative time internationalized message. 4285 * Possible values are: year, quarter, month, week, day, hour, minute, second. 4286 * @returns { string } formatted language-sensitive relative time. 4287 * @syscap SystemCapability.Global.I18n 4288 * @since 8 4289 */ 4290 /** 4291 * formats a value and unit according to the locale and formatting options of this object. 4292 * 4293 * @param { number } value - Numeric value to use in the internationalized relative time message. 4294 * @param { string } unit - Unit to use in the relative time internationalized message. 4295 * Possible values are: year, quarter, month, week, day, hour, minute, second. 4296 * @returns { string } formatted language-sensitive relative time. 4297 * @syscap SystemCapability.Global.I18n 4298 * @crossplatform 4299 * @since 10 4300 */ 4301 /** 4302 * Formats a relative time. 4303 * 4304 * @param { number } value - Value to format. 4305 * @param { string } unit - Unit of the relative time.<br>The value can be any of the following: "year", "quarter", 4306 * "month", "week", "day", "hour", "minute", or "second". 4307 * @returns { string } Relative time after formatting. 4308 * @syscap SystemCapability.Global.I18n 4309 * @crossplatform 4310 * @atomicservice 4311 * @since 12 4312 * @deprecated since 20 4313 * @useinstead Intl.RelativeTimeFormat.format 4314 */ 4315 format(value: number, unit: string): string; 4316 4317 /** 4318 * returns an Array of objects representing the relative time format in parts that can be used for 4319 * custom locale-aware formatting 4320 * 4321 * @param { number } value - Numeric value to use in the internationalized relative time message. 4322 * @param { string } unit - to use in the relative time internationalized message. 4323 * Possible values are: year, quarter, month, week, day, hour, minute, second. 4324 * @returns { Array<object> } an Array of objects representing the relative time format in parts 4325 * @syscap SystemCapability.Global.I18n 4326 * @since 8 4327 */ 4328 /** 4329 * returns an Array of objects representing the relative time format in parts that can be used for 4330 * custom locale-aware formatting 4331 * 4332 * @param { number } value - Numeric value to use in the internationalized relative time message. 4333 * @param { string } unit - to use in the relative time internationalized message. 4334 * Possible values are: year, quarter, month, week, day, hour, minute, second. 4335 * @returns { Array<object> } an Array of objects representing the relative time format in parts 4336 * @syscap SystemCapability.Global.I18n 4337 * @crossplatform 4338 * @since 10 4339 */ 4340 /** 4341 * Formats the relative time. 4342 * 4343 * @param { number } value - Value to format. 4344 * @param { string } unit - Unit of the relative time.<br>The value can be any of the following: "year", "quarter", 4345 * "month", "week", "day", "hour", "minute", or "second". 4346 * @returns { Array<object> } to parts. 4347 * @syscap SystemCapability.Global.I18n 4348 * @crossplatform 4349 * @atomicservice 4350 * @since 12 4351 * @deprecated since 20 4352 * @useinstead Intl.RelativeTimeFormat.formatToParts 4353 */ 4354 formatToParts(value: number, unit: string): Array<object>; 4355 4356 /** 4357 * Returns a new object with properties that reflect the locale and formatting options computed during 4358 * initialization of the object. 4359 * 4360 * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. 4361 * @syscap SystemCapability.Global.I18n 4362 * @since 8 4363 */ 4364 /** 4365 * Returns a new object with properties that reflect the locale and formatting options computed during 4366 * initialization of the object. 4367 * 4368 * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. 4369 * @syscap SystemCapability.Global.I18n 4370 * @crossplatform 4371 * @since 10 4372 */ 4373 /** 4374 * Defines the formatting options for a RelativeTimeFormat object. 4375 * 4376 * @returns { RelativeTimeFormatResolvedOptions } Options for the RelativeTimeFormat object. 4377 * @syscap SystemCapability.Global.I18n 4378 * @crossplatform 4379 * @atomicservice 4380 * @since 12 4381 * @deprecated since 20 4382 * @useinstead Intl.RelativeTimeFormat.resolvedOptions 4383 */ 4384 resolvedOptions(): RelativeTimeFormatResolvedOptions; 4385 } 4386} 4387export default intl; 4388