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 /** 2635 * Provides the API for formatting number strings. 2636 * 2637 * @syscap SystemCapability.Global.I18n 2638 * @since 6 2639 */ 2640 /** 2641 * Provides the API for formatting number strings. 2642 * 2643 * @syscap SystemCapability.Global.I18n 2644 * @crossplatform 2645 * @since 10 2646 */ 2647 /** 2648 * Provides the API for formatting number strings. 2649 * 2650 * @syscap SystemCapability.Global.I18n 2651 * @crossplatform 2652 * @atomicservice 2653 * @since 12 2654 */ 2655 export class NumberFormat { 2656 /** 2657 * A constructor used to create a NumberFormat object. 2658 * 2659 * @syscap SystemCapability.Global.I18n 2660 * @since 8 2661 */ 2662 /** 2663 * A constructor used to create a NumberFormat object. 2664 * 2665 * @syscap SystemCapability.Global.I18n 2666 * @crossplatform 2667 * @since 10 2668 */ 2669 /** 2670 * A constructor used to create a NumberFormat object. 2671 * 2672 * @syscap SystemCapability.Global.I18n 2673 * @crossplatform 2674 * @atomicservice 2675 * @since 12 2676 */ 2677 constructor(); 2678 2679 /** 2680 * A constructor used to create a NumberFormat object. 2681 * 2682 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 2683 * the language and optionally the script and region, for the NumberFormat object. 2684 * @param { NumberOptions } [options] - Indicates the options used to format the number. 2685 * @syscap SystemCapability.Global.I18n 2686 * @since 6 2687 */ 2688 /** 2689 * A constructor used to create a NumberFormat object. 2690 * 2691 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 2692 * the language and optionally the script and region, for the NumberFormat object. 2693 * @param { NumberOptions } [options] - Indicates the options used to format the number. 2694 * @syscap SystemCapability.Global.I18n 2695 * @crossplatform 2696 * @since 10 2697 */ 2698 /** 2699 * A constructor used to create a NumberFormat object. 2700 * 2701 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 2702 * the language and optionally the script and region, for the NumberFormat object. 2703 * @param { NumberOptions } [options] - Indicates the options used to format the number. 2704 * @syscap SystemCapability.Global.I18n 2705 * @crossplatform 2706 * @atomicservice 2707 * @since 12 2708 */ 2709 constructor(locale: string | Array<string>, options?: NumberOptions); 2710 2711 /** 2712 * Obtains the formatted number string. 2713 * 2714 * @param { number } number Indicates the number to be formatted. 2715 * @returns { string } a number string formatted based on the specified locale. 2716 * @syscap SystemCapability.Global.I18n 2717 * @since 6 2718 */ 2719 /** 2720 * Obtains the formatted number string. 2721 * 2722 * @param { number } number Indicates the number to be formatted. 2723 * @returns { string } a number string formatted based on the specified locale. 2724 * @syscap SystemCapability.Global.I18n 2725 * @crossplatform 2726 * @since 10 2727 */ 2728 /** 2729 * Obtains the formatted number string. 2730 * 2731 * @param { number } number Indicates the number to be formatted. 2732 * @returns { string } a number string formatted based on the specified locale. 2733 * @syscap SystemCapability.Global.I18n 2734 * @crossplatform 2735 * @atomicservice 2736 * @since 12 2737 */ 2738 format(number: number): string; 2739 2740 /** 2741 * Obtains the options of the NumberFormat object. 2742 * 2743 * @returns { NumberOptions } the options of the NumberFormat object. 2744 * @syscap SystemCapability.Global.I18n 2745 * @since 6 2746 */ 2747 /** 2748 * Obtains the options of the NumberFormat object. 2749 * 2750 * @returns { NumberOptions } the options of the NumberFormat object. 2751 * @syscap SystemCapability.Global.I18n 2752 * @crossplatform 2753 * @since 10 2754 */ 2755 /** 2756 * Obtains the options of the NumberFormat object. 2757 * 2758 * @returns { NumberOptions } the options of the NumberFormat object. 2759 * @syscap SystemCapability.Global.I18n 2760 * @crossplatform 2761 * @atomicservice 2762 * @since 12 2763 */ 2764 resolvedOptions(): NumberOptions; 2765 } 2766 2767 /** 2768 * Provides the options of Collator 2769 * 2770 * @interface CollatorOptions 2771 * @syscap SystemCapability.Global.I18n 2772 * @since 8 2773 */ 2774 /** 2775 * Provides the options of Collator 2776 * 2777 * @interface CollatorOptions 2778 * @syscap SystemCapability.Global.I18n 2779 * @crossplatform 2780 * @since 10 2781 */ 2782 /** 2783 * Provides the options of Collator 2784 * 2785 * @interface CollatorOptions 2786 * @syscap SystemCapability.Global.I18n 2787 * @crossplatform 2788 * @atomicservice 2789 * @since 12 2790 */ 2791 export interface CollatorOptions { 2792 /** 2793 * The locale matching algorithm to use. 2794 * Possible values are "lookup" and "best fit"; the default is "best fit". 2795 * 2796 * @type { string } 2797 * @syscap SystemCapability.Global.I18n 2798 * @since 8 2799 */ 2800 /** 2801 * The locale matching algorithm to use. 2802 * Possible values are "lookup" and "best fit"; the default is "best fit". 2803 * 2804 * @type { ?string } 2805 * @syscap SystemCapability.Global.I18n 2806 * @since 9 2807 */ 2808 /** 2809 * The locale matching algorithm to use. 2810 * Possible values are "lookup" and "best fit"; the default is "best fit". 2811 * 2812 * @type { ?string } 2813 * @syscap SystemCapability.Global.I18n 2814 * @crossplatform 2815 * @since 10 2816 */ 2817 /** 2818 * The locale matching algorithm to use. 2819 * Possible values are "lookup" and "best fit"; the default is "best fit". 2820 * 2821 * @type { ?string } 2822 * @syscap SystemCapability.Global.I18n 2823 * @crossplatform 2824 * @atomicservice 2825 * @since 12 2826 */ 2827 localeMatcher?: string; 2828 2829 /** 2830 * Whether the comparison is for sorting or for searching for matching strings. 2831 * Possible values are "sort" and "search"; the default is "sort". 2832 * 2833 * @type { string } 2834 * @syscap SystemCapability.Global.I18n 2835 * @since 8 2836 */ 2837 /** 2838 * Whether the comparison is for sorting or for searching for matching strings. 2839 * Possible values are "sort" and "search"; the default is "sort". 2840 * 2841 * @type { ?string } 2842 * @syscap SystemCapability.Global.I18n 2843 * @since 9 2844 */ 2845 /** 2846 * Whether the comparison is for sorting or for searching for matching strings. 2847 * Possible values are "sort" and "search"; the default is "sort". 2848 * 2849 * @type { ?string } 2850 * @syscap SystemCapability.Global.I18n 2851 * @crossplatform 2852 * @since 10 2853 */ 2854 /** 2855 * Whether the comparison is for sorting or for searching for matching strings. 2856 * Possible values are "sort" and "search"; the default is "sort". 2857 * 2858 * @type { ?string } 2859 * @syscap SystemCapability.Global.I18n 2860 * @crossplatform 2861 * @atomicservice 2862 * @since 12 2863 */ 2864 usage?: string; 2865 2866 /** 2867 * Which differences in the strings should lead to non-zero result values. 2868 * Possible values are "base", "accent", "case", "variant". 2869 * "base" are used when only strings that differ in base letters compare as unequal. 2870 * "accent" are used when only strings that differ in base letters or accents and 2871 * other diacritic marks compare as unequal. 2872 * "case" are used when only strings that differ in base letters or case compare as unequal. 2873 * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, 2874 * or case compare as unequal. 2875 * 2876 * @type { string } 2877 * @syscap SystemCapability.Global.I18n 2878 * @since 8 2879 */ 2880 /** 2881 * Which differences in the strings should lead to non-zero result values. 2882 * Possible values are "base", "accent", "case", "variant". 2883 * "base" are used when only strings that differ in base letters compare as unequal. 2884 * "accent" are used when only strings that differ in base letters or accents and 2885 * other diacritic marks compare as unequal. 2886 * "case" are used when only strings that differ in base letters or case compare as unequal. 2887 * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, 2888 * or case compare as unequal. 2889 * 2890 * @type { ?string } 2891 * @syscap SystemCapability.Global.I18n 2892 * @since 9 2893 */ 2894 /** 2895 * Which differences in the strings should lead to non-zero result values. 2896 * Possible values are "base", "accent", "case", "variant". 2897 * "base" are used when only strings that differ in base letters compare as unequal. 2898 * "accent" are used when only strings that differ in base letters or accents and 2899 * other diacritic marks compare as unequal. 2900 * "case" are used when only strings that differ in base letters or case compare as unequal. 2901 * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, 2902 * or case compare as unequal. 2903 * 2904 * @type { ?string } 2905 * @syscap SystemCapability.Global.I18n 2906 * @crossplatform 2907 * @since 10 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 * @crossplatform 2922 * @atomicservice 2923 * @since 12 2924 */ 2925 sensitivity?: string; 2926 2927 /** 2928 * Whether punctuation should be ignored. default value is false. 2929 * 2930 * @type { boolean } 2931 * @syscap SystemCapability.Global.I18n 2932 * @since 8 2933 */ 2934 /** 2935 * Whether punctuation should be ignored. Default value is false. 2936 * 2937 * @type { ?boolean } 2938 * @syscap SystemCapability.Global.I18n 2939 * @since 9 2940 */ 2941 /** 2942 * Whether punctuation should be ignored. Default value is false. 2943 * 2944 * @type { ?boolean } 2945 * @syscap SystemCapability.Global.I18n 2946 * @crossplatform 2947 * @since 10 2948 */ 2949 /** 2950 * Whether punctuation should be ignored. Default value is false. 2951 * 2952 * @type { ?boolean } 2953 * @syscap SystemCapability.Global.I18n 2954 * @crossplatform 2955 * @atomicservice 2956 * @since 12 2957 */ 2958 ignorePunctuation?: boolean; 2959 2960 /** 2961 * Variant collations for certain locales. 2962 * 2963 * @type { string } 2964 * @syscap SystemCapability.Global.I18n 2965 * @since 8 2966 */ 2967 /** 2968 * Variant collations for certain locales. 2969 * 2970 * @type { ?string } 2971 * @syscap SystemCapability.Global.I18n 2972 * @since 9 2973 */ 2974 /** 2975 * Variant collations for certain locales. 2976 * 2977 * @type { ?string } 2978 * @syscap SystemCapability.Global.I18n 2979 * @crossplatform 2980 * @since 10 2981 */ 2982 /** 2983 * Variant collations for certain locales. 2984 * 2985 * @type { ?string } 2986 * @syscap SystemCapability.Global.I18n 2987 * @crossplatform 2988 * @atomicservice 2989 * @since 12 2990 */ 2991 collation?: string; 2992 2993 /** 2994 * Whether numeric collation should be used. Default value is false. 2995 * 2996 * @type { boolean } 2997 * @syscap SystemCapability.Global.I18n 2998 * @since 8 2999 */ 3000 /** 3001 * Whether numeric collation should be used. Default value is false. 3002 * 3003 * @type { ?boolean } 3004 * @syscap SystemCapability.Global.I18n 3005 * @since 9 3006 */ 3007 /** 3008 * Whether numeric collation should be used. Default value is false. 3009 * 3010 * @type { ?boolean } 3011 * @syscap SystemCapability.Global.I18n 3012 * @crossplatform 3013 * @since 10 3014 */ 3015 /** 3016 * Whether numeric collation should be used. Default value is false. 3017 * 3018 * @type { ?boolean } 3019 * @syscap SystemCapability.Global.I18n 3020 * @crossplatform 3021 * @atomicservice 3022 * @since 12 3023 */ 3024 numeric?: boolean; 3025 3026 /** 3027 * Whether upper case or lower case should sort first. 3028 * Possible values are "upper", "lower", or "false" (use the locale's default). 3029 * 3030 * @type { string } 3031 * @syscap SystemCapability.Global.I18n 3032 * @since 8 3033 */ 3034 /** 3035 * Whether upper case or lower case should sort first. 3036 * Possible values are "upper", "lower", or "false" (use the locale's default). 3037 * 3038 * @type { ?string } 3039 * @syscap SystemCapability.Global.I18n 3040 * @since 9 3041 */ 3042 /** 3043 * Whether upper case or lower case should sort first. 3044 * Possible values are "upper", "lower", or "false" (use the locale's default). 3045 * 3046 * @type { ?string } 3047 * @syscap SystemCapability.Global.I18n 3048 * @crossplatform 3049 * @since 10 3050 */ 3051 /** 3052 * Whether upper case or lower case should sort first. 3053 * Possible values are "upper", "lower", or "false" (use the locale's default). 3054 * 3055 * @type { ?string } 3056 * @syscap SystemCapability.Global.I18n 3057 * @crossplatform 3058 * @atomicservice 3059 * @since 12 3060 */ 3061 caseFirst?: string; 3062 } 3063 3064 /** 3065 * Enable language-sensitive string comparison. 3066 * 3067 * @syscap SystemCapability.Global.I18n 3068 * @since 8 3069 */ 3070 /** 3071 * Enable language-sensitive string comparison. 3072 * 3073 * @syscap SystemCapability.Global.I18n 3074 * @crossplatform 3075 * @since 10 3076 */ 3077 /** 3078 * Enable language-sensitive string comparison. 3079 * 3080 * @syscap SystemCapability.Global.I18n 3081 * @crossplatform 3082 * @atomicservice 3083 * @since 12 3084 */ 3085 export class Collator { 3086 /** 3087 * A constructor used to create Collator object. 3088 * 3089 * @syscap SystemCapability.Global.I18n 3090 * @since 8 3091 */ 3092 /** 3093 * A constructor used to create Collator object. 3094 * 3095 * @syscap SystemCapability.Global.I18n 3096 * @crossplatform 3097 * @since 10 3098 */ 3099 /** 3100 * A constructor used to create Collator object. 3101 * 3102 * @syscap SystemCapability.Global.I18n 3103 * @crossplatform 3104 * @atomicservice 3105 * @since 12 3106 */ 3107 constructor(); 3108 /** 3109 * A constructor used to create Collator Object; 3110 * 3111 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3112 * the language and optionally the script and region, for the Collator object. 3113 * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. 3114 * @syscap SystemCapability.Global.I18n 3115 * @since 8 3116 */ 3117 /** 3118 * A constructor used to create Collator Object; 3119 * 3120 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3121 * the language and optionally the script and region, for the Collator object. 3122 * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. 3123 * @syscap SystemCapability.Global.I18n 3124 * @crossplatform 3125 * @since 10 3126 */ 3127 /** 3128 * A constructor used to create Collator Object; 3129 * 3130 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3131 * the language and optionally the script and region, for the Collator object. 3132 * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. 3133 * @syscap SystemCapability.Global.I18n 3134 * @crossplatform 3135 * @atomicservice 3136 * @since 12 3137 */ 3138 constructor(locale: string | Array<string>, options?: CollatorOptions); 3139 3140 /** 3141 * compares two strings according to the sort order of this Collator object 3142 * 3143 * @param { string } first - The first string to compare. 3144 * @param { string } second - The second string to compare. 3145 * @returns { number } a number indicating how first compare to second: 3146 * a negative value if string1 comes before string2; 3147 * a positive value if string1 comes after string2; 3148 * 0 if they are considered equal. 3149 * @syscap SystemCapability.Global.I18n 3150 * @since 8 3151 */ 3152 /** 3153 * compares two strings according to the sort order of this Collator object 3154 * 3155 * @param { string } first - The first string to compare. 3156 * @param { string } second - The second string to compare. 3157 * @returns { number } a number indicating how first compare to second: 3158 * a negative value if string1 comes before string2; 3159 * a positive value if string1 comes after string2; 3160 * 0 if they are considered equal. 3161 * @syscap SystemCapability.Global.I18n 3162 * @crossplatform 3163 * @since 10 3164 */ 3165 /** 3166 * compares two strings according to the sort order of this Collator object 3167 * 3168 * @param { string } first - The first string to compare. 3169 * @param { string } second - The second string to compare. 3170 * @returns { number } a number indicating how first compare to second: 3171 * a negative value if string1 comes before string2; 3172 * a positive value if string1 comes after string2; 3173 * 0 if they are considered equal. 3174 * @syscap SystemCapability.Global.I18n 3175 * @crossplatform 3176 * @atomicservice 3177 * @since 12 3178 */ 3179 compare(first: string, second: string): number; 3180 3181 /** 3182 * Returns a new object with properties that reflect the locale and collation options computed 3183 * during initialization of the object. 3184 * 3185 * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. 3186 * @syscap SystemCapability.Global.I18n 3187 * @since 8 3188 */ 3189 /** 3190 * Returns a new object with properties that reflect the locale and collation options computed 3191 * during initialization of the object. 3192 * 3193 * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. 3194 * @syscap SystemCapability.Global.I18n 3195 * @crossplatform 3196 * @since 10 3197 */ 3198 /** 3199 * Returns a new object with properties that reflect the locale and collation options computed 3200 * during initialization of the object. 3201 * 3202 * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. 3203 * @syscap SystemCapability.Global.I18n 3204 * @crossplatform 3205 * @atomicservice 3206 * @since 12 3207 */ 3208 resolvedOptions(): CollatorOptions; 3209 } 3210 3211 /** 3212 * Provides the options of PluralRules 3213 * 3214 * @interface PluralRulesOptions 3215 * @syscap SystemCapability.Global.I18n 3216 * @since 8 3217 */ 3218 /** 3219 * Provides the options of PluralRules 3220 * 3221 * @interface PluralRulesOptions 3222 * @syscap SystemCapability.Global.I18n 3223 * @crossplatform 3224 * @since 10 3225 */ 3226 /** 3227 * Provides the options of PluralRules 3228 * 3229 * @interface PluralRulesOptions 3230 * @syscap SystemCapability.Global.I18n 3231 * @crossplatform 3232 * @atomicservice 3233 * @since 12 3234 */ 3235 export interface PluralRulesOptions { 3236 /** 3237 * The locale matching algorithm to use. 3238 * Possible values are "lookup" and "best fit"; the default is "best fit". 3239 * 3240 * @type { string } 3241 * @syscap SystemCapability.Global.I18n 3242 * @since 8 3243 */ 3244 /** 3245 * The locale matching algorithm to use. 3246 * Possible values are "lookup" and "best fit"; the default is "best fit". 3247 * 3248 * @type { ?string } 3249 * @syscap SystemCapability.Global.I18n 3250 * @since 9 3251 */ 3252 /** 3253 * The locale matching algorithm to use. 3254 * Possible values are "lookup" and "best fit"; the default is "best fit". 3255 * 3256 * @type { ?string } 3257 * @syscap SystemCapability.Global.I18n 3258 * @crossplatform 3259 * @since 10 3260 */ 3261 /** 3262 * The locale matching algorithm to use. 3263 * Possible values are "lookup" and "best fit"; the default is "best fit". 3264 * 3265 * @type { ?string } 3266 * @syscap SystemCapability.Global.I18n 3267 * @crossplatform 3268 * @atomicservice 3269 * @since 12 3270 */ 3271 localeMatcher?: string; 3272 3273 /** 3274 * The type to use. Possible values are: "cardinal", "ordinal" 3275 * 3276 * @type { string } 3277 * @syscap SystemCapability.Global.I18n 3278 * @since 8 3279 */ 3280 /** 3281 * The type to use. Possible values are: "cardinal", "ordinal" 3282 * 3283 * @type { ?string } 3284 * @syscap SystemCapability.Global.I18n 3285 * @since 9 3286 */ 3287 /** 3288 * The type to use. Possible values are: "cardinal", "ordinal" 3289 * 3290 * @type { ?string } 3291 * @syscap SystemCapability.Global.I18n 3292 * @crossplatform 3293 * @since 10 3294 */ 3295 /** 3296 * The type to use. Possible values are: "cardinal", "ordinal" 3297 * 3298 * @type { ?string } 3299 * @syscap SystemCapability.Global.I18n 3300 * @crossplatform 3301 * @atomicservice 3302 * @since 12 3303 */ 3304 type?: string; 3305 3306 /** 3307 * The minimum number of integer digits to use. 3308 * Possible values are from 1 to 21; the default is 1. 3309 * 3310 * @type { number } 3311 * @syscap SystemCapability.Global.I18n 3312 * @since 8 3313 */ 3314 /** 3315 * The minimum number of integer digits to use. 3316 * Possible values are from 1 to 21; the default is 1. 3317 * 3318 * @type { ?number } 3319 * @syscap SystemCapability.Global.I18n 3320 * @since 9 3321 */ 3322 /** 3323 * The minimum number of integer digits to use. 3324 * Possible values are from 1 to 21; the default is 1. 3325 * 3326 * @type { ?number } 3327 * @syscap SystemCapability.Global.I18n 3328 * @crossplatform 3329 * @since 10 3330 */ 3331 /** 3332 * The minimum number of integer digits to use. 3333 * Possible values are from 1 to 21; the default is 1. 3334 * 3335 * @type { ?number } 3336 * @syscap SystemCapability.Global.I18n 3337 * @crossplatform 3338 * @atomicservice 3339 * @since 12 3340 */ 3341 minimumIntegerDigits?: number; 3342 3343 /** 3344 * The minimum number of fraction digits to use. 3345 * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; 3346 * 3347 * @type { number } 3348 * @syscap SystemCapability.Global.I18n 3349 * @since 8 3350 */ 3351 /** 3352 * The minimum number of fraction digits to use. 3353 * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; 3354 * 3355 * @type { ?number } 3356 * @syscap SystemCapability.Global.I18n 3357 * @since 9 3358 */ 3359 /** 3360 * The minimum number of fraction digits to use. 3361 * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; 3362 * 3363 * @type { ?number } 3364 * @syscap SystemCapability.Global.I18n 3365 * @crossplatform 3366 * @since 10 3367 */ 3368 /** 3369 * The minimum number of fraction digits to use. 3370 * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; 3371 * 3372 * @type { ?number } 3373 * @syscap SystemCapability.Global.I18n 3374 * @crossplatform 3375 * @atomicservice 3376 * @since 12 3377 */ 3378 minimumFractionDigits?: number; 3379 3380 /** 3381 * The maximum number of fraction digits to use. 3382 * Possible values are from 0 to 20; 3383 * the default for plain number formatting is the larger of minimumFractionDigits and 3; 3384 * 3385 * @type { number } 3386 * @syscap SystemCapability.Global.I18n 3387 * @since 8 3388 */ 3389 /** 3390 * The maximum number of fraction digits to use. 3391 * Possible values are from 0 to 20; 3392 * the default for plain number formatting is the larger of minimumFractionDigits and 3; 3393 * 3394 * @type { ?number } 3395 * @syscap SystemCapability.Global.I18n 3396 * @since 9 3397 */ 3398 /** 3399 * The maximum number of fraction digits to use. 3400 * Possible values are from 0 to 20; 3401 * the default for plain number formatting is the larger of minimumFractionDigits and 3; 3402 * 3403 * @type { ?number } 3404 * @syscap SystemCapability.Global.I18n 3405 * @crossplatform 3406 * @since 10 3407 */ 3408 /** 3409 * The maximum number of fraction digits to use. 3410 * Possible values are from 0 to 20; 3411 * the default for plain number formatting is the larger of minimumFractionDigits and 3; 3412 * 3413 * @type { ?number } 3414 * @syscap SystemCapability.Global.I18n 3415 * @crossplatform 3416 * @atomicservice 3417 * @since 12 3418 */ 3419 maximumFractionDigits?: number; 3420 3421 /** 3422 * The minimum number of significant digits to use. 3423 * Possible values are from 1 to 21; the default is 1. 3424 * 3425 * @type { number } 3426 * @syscap SystemCapability.Global.I18n 3427 * @since 8 3428 */ 3429 /** 3430 * The minimum number of significant digits to use. 3431 * Possible values are from 1 to 21; the default is 1. 3432 * 3433 * @type { ?number } 3434 * @syscap SystemCapability.Global.I18n 3435 * @since 9 3436 */ 3437 /** 3438 * The minimum number of significant digits to use. 3439 * Possible values are from 1 to 21; the default is 1. 3440 * 3441 * @type { ?number } 3442 * @syscap SystemCapability.Global.I18n 3443 * @crossplatform 3444 * @since 10 3445 */ 3446 /** 3447 * The minimum number of significant digits to use. 3448 * Possible values are from 1 to 21; the default is 1. 3449 * 3450 * @type { ?number } 3451 * @syscap SystemCapability.Global.I18n 3452 * @crossplatform 3453 * @atomicservice 3454 * @since 12 3455 */ 3456 minimumSignificantDigits?: number; 3457 3458 /** 3459 * The maximum number of significant digits to use. 3460 * Possible values are from 1 to 21; the default is 21. 3461 * 3462 * @type { number } 3463 * @syscap SystemCapability.Global.I18n 3464 * @since 8 3465 */ 3466 /** 3467 * The maximum number of significant digits to use. 3468 * Possible values are from 1 to 21; the default is 21. 3469 * 3470 * @type { ?number } 3471 * @syscap SystemCapability.Global.I18n 3472 * @since 9 3473 */ 3474 /** 3475 * The maximum number of significant digits to use. 3476 * Possible values are from 1 to 21; the default is 21. 3477 * 3478 * @type { ?number } 3479 * @syscap SystemCapability.Global.I18n 3480 * @crossplatform 3481 * @since 10 3482 */ 3483 /** 3484 * The maximum number of significant digits to use. 3485 * Possible values are from 1 to 21; the default is 21. 3486 * 3487 * @type { ?number } 3488 * @syscap SystemCapability.Global.I18n 3489 * @crossplatform 3490 * @atomicservice 3491 * @since 12 3492 */ 3493 maximumSignificantDigits?: number; 3494 } 3495 3496 /** 3497 * Enables plural-sensitive formatting and plural-related language rules. 3498 * 3499 * @syscap SystemCapability.Global.I18n 3500 * @since 8 3501 */ 3502 /** 3503 * Enables plural-sensitive formatting and plural-related language rules. 3504 * 3505 * @syscap SystemCapability.Global.I18n 3506 * @crossplatform 3507 * @since 10 3508 */ 3509 /** 3510 * Enables plural-sensitive formatting and plural-related language rules. 3511 * 3512 * @syscap SystemCapability.Global.I18n 3513 * @crossplatform 3514 * @atomicservice 3515 * @since 12 3516 */ 3517 export class PluralRules { 3518 /** 3519 * A constructor used to create PluralRules object. 3520 * 3521 * @syscap SystemCapability.Global.I18n 3522 * @since 8 3523 */ 3524 /** 3525 * A constructor used to create PluralRules object. 3526 * 3527 * @syscap SystemCapability.Global.I18n 3528 * @crossplatform 3529 * @since 10 3530 */ 3531 /** 3532 * A constructor used to create PluralRules object. 3533 * 3534 * @syscap SystemCapability.Global.I18n 3535 * @crossplatform 3536 * @atomicservice 3537 * @since 12 3538 */ 3539 constructor(); 3540 3541 /** 3542 * A constructor used to create PluralRules object. 3543 * 3544 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3545 * the language and optionally the script and region, for the PluralRules object. 3546 * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. 3547 * @syscap SystemCapability.Global.I18n 3548 * @since 8 3549 */ 3550 /** 3551 * A constructor used to create PluralRules object. 3552 * 3553 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3554 * the language and optionally the script and region, for the PluralRules object. 3555 * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. 3556 * @syscap SystemCapability.Global.I18n 3557 * @crossplatform 3558 * @since 10 3559 */ 3560 /** 3561 * A constructor used to create PluralRules object. 3562 * 3563 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3564 * the language and optionally the script and region, for the PluralRules object. 3565 * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. 3566 * @syscap SystemCapability.Global.I18n 3567 * @crossplatform 3568 * @atomicservice 3569 * @since 12 3570 */ 3571 constructor(locale: string | Array<string>, options?: PluralRulesOptions); 3572 3573 /** 3574 * Returns a string indicating which plural rule to use for locale-aware formatting. 3575 * 3576 * @param { number } n - The number to get a plural rule for. 3577 * @returns { string } A string representing the pluralization category of the number, 3578 * can be one of zero, one, two, few, many or other. 3579 * @syscap SystemCapability.Global.I18n 3580 * @since 8 3581 */ 3582 /** 3583 * Returns a string indicating which plural rule to use for locale-aware formatting. 3584 * 3585 * @param { number } n - The number to get a plural rule for. 3586 * @returns { string } A string representing the pluralization category of the number, 3587 * can be one of zero, one, two, few, many or other. 3588 * @syscap SystemCapability.Global.I18n 3589 * @crossplatform 3590 * @since 10 3591 */ 3592 /** 3593 * Returns a string indicating which plural rule to use for locale-aware formatting. 3594 * 3595 * @param { number } n - The number to get a plural rule for. 3596 * @returns { string } A string representing the pluralization category of the number, 3597 * can be one of zero, one, two, few, many or other. 3598 * @syscap SystemCapability.Global.I18n 3599 * @crossplatform 3600 * @atomicservice 3601 * @since 12 3602 */ 3603 select(n: number): string; 3604 } 3605 3606 /** 3607 * Provides the input options of RelativeTimeFormat. 3608 * 3609 * @interface RelativeTimeFormatInputOptions 3610 * @syscap SystemCapability.Global.I18n 3611 * @since 8 3612 */ 3613 /** 3614 * Provides the input options of RelativeTimeFormat. 3615 * 3616 * @interface RelativeTimeFormatInputOptions 3617 * @syscap SystemCapability.Global.I18n 3618 * @crossplatform 3619 * @since 10 3620 */ 3621 /** 3622 * Provides the input options of RelativeTimeFormat. 3623 * 3624 * @interface RelativeTimeFormatInputOptions 3625 * @syscap SystemCapability.Global.I18n 3626 * @crossplatform 3627 * @atomicservice 3628 * @since 12 3629 */ 3630 export interface RelativeTimeFormatInputOptions { 3631 /** 3632 * The locale matching algorithm to use. 3633 * Possible values are: lookup, best fit 3634 * 3635 * @type { string } 3636 * @syscap SystemCapability.Global.I18n 3637 * @since 8 3638 */ 3639 /** 3640 * The locale matching algorithm to use. 3641 * Possible values are: lookup, best fit 3642 * 3643 * @type { ?string } 3644 * @syscap SystemCapability.Global.I18n 3645 * @since 9 3646 */ 3647 /** 3648 * The locale matching algorithm to use. 3649 * Possible values are: lookup, best fit 3650 * 3651 * @type { ?string } 3652 * @syscap SystemCapability.Global.I18n 3653 * @crossplatform 3654 * @since 10 3655 */ 3656 /** 3657 * The locale matching algorithm to use. 3658 * Possible values are: lookup, best fit 3659 * 3660 * @type { ?string } 3661 * @syscap SystemCapability.Global.I18n 3662 * @crossplatform 3663 * @atomicservice 3664 * @since 12 3665 */ 3666 localeMatcher?: string; 3667 3668 /** 3669 * The format of output message. 3670 * Possible values are: always, auto 3671 * 3672 * @type { string } 3673 * @syscap SystemCapability.Global.I18n 3674 * @since 8 3675 */ 3676 /** 3677 * The format of output message. 3678 * Possible values are: always, auto 3679 * 3680 * @type { ?string } 3681 * @syscap SystemCapability.Global.I18n 3682 * @since 9 3683 */ 3684 /** 3685 * The format of output message. 3686 * Possible values are: always, auto 3687 * 3688 * @type { ?string } 3689 * @syscap SystemCapability.Global.I18n 3690 * @crossplatform 3691 * @since 10 3692 */ 3693 /** 3694 * The format of output message. 3695 * Possible values are: always, auto 3696 * 3697 * @type { ?string } 3698 * @syscap SystemCapability.Global.I18n 3699 * @crossplatform 3700 * @atomicservice 3701 * @since 12 3702 */ 3703 numeric?: string; 3704 3705 /** 3706 * The length of the internationalized message. 3707 * Possible values are: long, short, narrow 3708 * 3709 * @type { string } 3710 * @syscap SystemCapability.Global.I18n 3711 * @since 8 3712 */ 3713 /** 3714 * The length of the internationalized message. 3715 * Possible values are: long, short, narrow 3716 * 3717 * @type { ?string } 3718 * @syscap SystemCapability.Global.I18n 3719 * @since 9 3720 */ 3721 /** 3722 * The length of the internationalized message. 3723 * Possible values are: long, short, narrow 3724 * 3725 * @type { ?string } 3726 * @syscap SystemCapability.Global.I18n 3727 * @crossplatform 3728 * @since 10 3729 */ 3730 /** 3731 * The length of the internationalized message. 3732 * Possible values are: long, short, narrow 3733 * 3734 * @type { ?string } 3735 * @syscap SystemCapability.Global.I18n 3736 * @crossplatform 3737 * @atomicservice 3738 * @since 12 3739 */ 3740 style?: string; 3741 } 3742 3743 /** 3744 * Provides the resolved options of RelativeTimeFormat. 3745 * 3746 * @interface RelativeTimeFormatResolvedOptions 3747 * @syscap SystemCapability.Global.I18n 3748 * @since 8 3749 */ 3750 /** 3751 * Provides the resolved options of RelativeTimeFormat. 3752 * 3753 * @interface RelativeTimeFormatResolvedOptions 3754 * @syscap SystemCapability.Global.I18n 3755 * @crossplatform 3756 * @since 10 3757 */ 3758 /** 3759 * Provides the resolved options of RelativeTimeFormat. 3760 * 3761 * @interface RelativeTimeFormatResolvedOptions 3762 * @syscap SystemCapability.Global.I18n 3763 * @crossplatform 3764 * @atomicservice 3765 * @since 12 3766 */ 3767 export interface RelativeTimeFormatResolvedOptions { 3768 /** 3769 * The BCP 47 language tag for the locale actually used. 3770 * 3771 * @syscap SystemCapability.Global.I18n 3772 * @since 8 3773 */ 3774 /** 3775 * The BCP 47 language tag for the locale actually used. 3776 * 3777 * @syscap SystemCapability.Global.I18n 3778 * @crossplatform 3779 * @since 10 3780 */ 3781 /** 3782 * The BCP 47 language tag for the locale actually used. 3783 * 3784 * @type { string } 3785 * @syscap SystemCapability.Global.I18n 3786 * @crossplatform 3787 * @atomicservice 3788 * @since 12 3789 */ 3790 locale: string; 3791 3792 /** 3793 * The length of the internationalized message. 3794 * Possible values are: long, short, narrow 3795 * 3796 * @syscap SystemCapability.Global.I18n 3797 * @since 8 3798 */ 3799 /** 3800 * The length of the internationalized message. 3801 * Possible values are: long, short, narrow 3802 * 3803 * @syscap SystemCapability.Global.I18n 3804 * @crossplatform 3805 * @since 10 3806 */ 3807 /** 3808 * The length of the internationalized message. 3809 * Possible values are: long, short, narrow 3810 * 3811 * @type { string } 3812 * @syscap SystemCapability.Global.I18n 3813 * @crossplatform 3814 * @atomicservice 3815 * @since 12 3816 */ 3817 style: string; 3818 3819 /** 3820 * The format of output message. 3821 * Possible values are: always, auto 3822 * 3823 * @syscap SystemCapability.Global.I18n 3824 * @since 8 3825 */ 3826 /** 3827 * The format of output message. 3828 * Possible values are: always, auto 3829 * 3830 * @syscap SystemCapability.Global.I18n 3831 * @crossplatform 3832 * @since 10 3833 */ 3834 /** 3835 * The format of output message. 3836 * Possible values are: always, auto 3837 * 3838 * @type { string } 3839 * @syscap SystemCapability.Global.I18n 3840 * @crossplatform 3841 * @atomicservice 3842 * @since 12 3843 */ 3844 numeric: string; 3845 3846 /** 3847 * The value requested using the Unicode extension key "nu" or filled in as a default. 3848 * 3849 * @syscap SystemCapability.Global.I18n 3850 * @since 8 3851 */ 3852 /** 3853 * The value requested using the Unicode extension key "nu" or filled in as a default. 3854 * 3855 * @syscap SystemCapability.Global.I18n 3856 * @crossplatform 3857 * @since 10 3858 */ 3859 /** 3860 * The value requested using the Unicode extension key "nu" or filled in as a default. 3861 * 3862 * @type { string } 3863 * @syscap SystemCapability.Global.I18n 3864 * @crossplatform 3865 * @atomicservice 3866 * @since 12 3867 */ 3868 numberingSystem: string; 3869 } 3870 3871 /** 3872 * Given a Time period length value and a unit, RelativeTimeFormat object enables 3873 * language-sensitive relative time formatting. 3874 * 3875 * @syscap SystemCapability.Global.I18n 3876 * @since 8 3877 */ 3878 /** 3879 * Given a Time period length value and a unit, RelativeTimeFormat object enables 3880 * language-sensitive relative time formatting. 3881 * 3882 * @syscap SystemCapability.Global.I18n 3883 * @crossplatform 3884 * @since 10 3885 */ 3886 /** 3887 * Given a Time period length value and a unit, RelativeTimeFormat object enables 3888 * language-sensitive relative time formatting. 3889 * 3890 * @syscap SystemCapability.Global.I18n 3891 * @crossplatform 3892 * @atomicservice 3893 * @since 12 3894 */ 3895 export class RelativeTimeFormat { 3896 /** 3897 * A constructor used to create RelativeTimeFormat object. 3898 * 3899 * @syscap SystemCapability.Global.I18n 3900 * @since 8 3901 */ 3902 /** 3903 * A constructor used to create RelativeTimeFormat object. 3904 * 3905 * @syscap SystemCapability.Global.I18n 3906 * @crossplatform 3907 * @since 10 3908 */ 3909 /** 3910 * A constructor used to create RelativeTimeFormat object. 3911 * 3912 * @syscap SystemCapability.Global.I18n 3913 * @crossplatform 3914 * @atomicservice 3915 * @since 12 3916 */ 3917 constructor(); 3918 3919 /** 3920 * A constructor used to create RelativeTimeFormat object. 3921 * 3922 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3923 * the language and optionally the script and region, for the RelativeTimeFormat object. 3924 * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. 3925 * @syscap SystemCapability.Global.I18n 3926 * @since 8 3927 */ 3928 /** 3929 * A constructor used to create RelativeTimeFormat object. 3930 * 3931 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3932 * the language and optionally the script and region, for the RelativeTimeFormat object. 3933 * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. 3934 * @syscap SystemCapability.Global.I18n 3935 * @crossplatform 3936 * @since 10 3937 */ 3938 /** 3939 * A constructor used to create RelativeTimeFormat object. 3940 * 3941 * @param { string | Array<string> } locale - Indicates a character string containing the locale information, including 3942 * the language and optionally the script and region, for the RelativeTimeFormat object. 3943 * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. 3944 * @syscap SystemCapability.Global.I18n 3945 * @crossplatform 3946 * @atomicservice 3947 * @since 12 3948 */ 3949 constructor(locale: string | Array<string>, options?: RelativeTimeFormatInputOptions); 3950 3951 /** 3952 * formats a value and unit according to the locale and formatting options of this object. 3953 * 3954 * @param { number } value - Numeric value to use in the internationalized relative time message. 3955 * @param { string } unit - Unit to use in the relative time internationalized message. 3956 * Possible values are: year, quarter, month, week, day, hour, minute, second. 3957 * @returns { string } formatted language-sensitive relative time. 3958 * @syscap SystemCapability.Global.I18n 3959 * @since 8 3960 */ 3961 /** 3962 * formats a value and unit according to the locale and formatting options of this object. 3963 * 3964 * @param { number } value - Numeric value to use in the internationalized relative time message. 3965 * @param { string } unit - Unit to use in the relative time internationalized message. 3966 * Possible values are: year, quarter, month, week, day, hour, minute, second. 3967 * @returns { string } formatted language-sensitive relative time. 3968 * @syscap SystemCapability.Global.I18n 3969 * @crossplatform 3970 * @since 10 3971 */ 3972 /** 3973 * formats a value and unit according to the locale and formatting options of this object. 3974 * 3975 * @param { number } value - Numeric value to use in the internationalized relative time message. 3976 * @param { string } unit - Unit to use in the relative time internationalized message. 3977 * Possible values are: year, quarter, month, week, day, hour, minute, second. 3978 * @returns { string } formatted language-sensitive relative time. 3979 * @syscap SystemCapability.Global.I18n 3980 * @crossplatform 3981 * @atomicservice 3982 * @since 12 3983 */ 3984 format(value: number, unit: string): string; 3985 3986 /** 3987 * returns an Array of objects representing the relative time format in parts that can be used for 3988 * custom locale-aware formatting 3989 * 3990 * @param { number } value - Numeric value to use in the internationalized relative time message. 3991 * @param { string } unit - to use in the relative time internationalized message. 3992 * Possible values are: year, quarter, month, week, day, hour, minute, second. 3993 * @returns { Array<object> } an Array of objects representing the relative time format in parts 3994 * @syscap SystemCapability.Global.I18n 3995 * @since 8 3996 */ 3997 /** 3998 * returns an Array of objects representing the relative time format in parts that can be used for 3999 * custom locale-aware formatting 4000 * 4001 * @param { number } value - Numeric value to use in the internationalized relative time message. 4002 * @param { string } unit - to use in the relative time internationalized message. 4003 * Possible values are: year, quarter, month, week, day, hour, minute, second. 4004 * @returns { Array<object> } an Array of objects representing the relative time format in parts 4005 * @syscap SystemCapability.Global.I18n 4006 * @crossplatform 4007 * @since 10 4008 */ 4009 /** 4010 * returns an Array of objects representing the relative time format in parts that can be used for 4011 * custom locale-aware formatting 4012 * 4013 * @param { number } value - Numeric value to use in the internationalized relative time message. 4014 * @param { string } unit - to use in the relative time internationalized message. 4015 * Possible values are: year, quarter, month, week, day, hour, minute, second. 4016 * @returns { Array<object> } an Array of objects representing the relative time format in parts 4017 * @syscap SystemCapability.Global.I18n 4018 * @crossplatform 4019 * @atomicservice 4020 * @since 12 4021 */ 4022 formatToParts(value: number, unit: string): Array<object>; 4023 4024 /** 4025 * Returns a new object with properties that reflect the locale and formatting options computed during 4026 * initialization of the object. 4027 * 4028 * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. 4029 * @syscap SystemCapability.Global.I18n 4030 * @since 8 4031 */ 4032 /** 4033 * Returns a new object with properties that reflect the locale and formatting options computed during 4034 * initialization of the object. 4035 * 4036 * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. 4037 * @syscap SystemCapability.Global.I18n 4038 * @crossplatform 4039 * @since 10 4040 */ 4041 /** 4042 * Returns a new object with properties that reflect the locale and formatting options computed during 4043 * initialization of the object. 4044 * 4045 * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. 4046 * @syscap SystemCapability.Global.I18n 4047 * @crossplatform 4048 * @atomicservice 4049 * @since 12 4050 */ 4051 resolvedOptions(): RelativeTimeFormatResolvedOptions; 4052 } 4053} 4054export default intl; 4055