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