@d3plus/locales 3.1.6 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3plus/locales",
3
- "version": "3.1.6",
3
+ "version": "4.0.0",
4
4
  "description": "International localizations for number, date, and UI labels.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/types/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export { default as translateLocale } from "./src/dictionaries/translateLocale.js";
2
2
  export { default as formatLocale } from "./src/dictionaries/formatLocale.js";
3
+ export { default as titleCaseLocale } from "./src/dictionaries/titleCaseLocale.js";
3
4
  export { default as locale } from "./src/dictionaries/timeLocale.js";
4
5
  export { default as findLocale } from "./src/findLocale.js";
5
6
  export type { TranslationStrings } from "./src/dictionaries/translateLocale.js";
6
7
  export type { FormatLocaleDefinition } from "./src/dictionaries/formatLocale.js";
8
+ export type { TitleCaseRules } from "./src/dictionaries/titleCaseLocale.js";
7
9
  export type { TimeLocaleDefinition } from "./src/dictionaries/timeLocale.js";
@@ -0,0 +1,26 @@
1
+ export interface TitleCaseRules {
2
+ /**
3
+ * "title" capitalizes each significant word, lowercasing the minor words in
4
+ * the middle (the English convention). "sentence" capitalizes only the first
5
+ * word. Acronyms are forced uppercase under both styles; the `lowercase` list
6
+ * is consulted only for "title".
7
+ */
8
+ style: "title" | "sentence";
9
+ /**
10
+ * Short function words (articles, conjunctions, prepositions, contractions)
11
+ * kept lowercase in the MIDDLE of a title. Matched case-insensitively and
12
+ * against the punctuation-stripped token, so "v" also covers "v." and "vs"
13
+ * covers "vs.".
14
+ */
15
+ lowercase?: string[];
16
+ /**
17
+ * Acronyms / initialisms emitted in the given canonical casing (matched
18
+ * case-insensitively, so "ceo" and "CEO" both become "CEO"). Mixed-case forms
19
+ * ("iOS", "GmbH", "PhD") are preserved as written. Plurals ("TVs") are derived
20
+ * automatically — so forms whose plural collides with a real word (e.g.
21
+ * "IDE" → "ides") are intentionally omitted.
22
+ */
23
+ acronyms?: string[];
24
+ }
25
+ declare const titleCaseLocale: Record<string, TitleCaseRules>;
26
+ export default titleCaseLocale;
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/locales v3.1.5
2
+ @d3plus/locales v4.0.0
3
3
  International localizations for number, date, and UI labels.
4
4
  Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT
@@ -423,6 +423,658 @@
423
423
  }
424
424
  };
425
425
 
426
+ // Tech acronyms written the same way across Latin-script languages, spread into
427
+ // each non-English locale alongside its own entries. Deliberately excludes forms
428
+ // that collide with a common word in one of these languages — e.g. "API"
429
+ // (Italian "api" = bees), "RAM" (Catalan "ram" = bouquet), "ML"/"kg" (units).
430
+ const intl = [
431
+ "TV",
432
+ "CPU",
433
+ "GPU",
434
+ "SSD",
435
+ "USB",
436
+ "DVD",
437
+ "GPS",
438
+ "PDF",
439
+ "HTML",
440
+ "CSS",
441
+ "XML",
442
+ "JSON",
443
+ "SQL",
444
+ "HTTP",
445
+ "HTTPS",
446
+ "URL",
447
+ "DNS",
448
+ "VPN",
449
+ "SDK"
450
+ ];
451
+ const titleCaseLocale = {
452
+ // Fallback for languages without an explicit entry — title-cases every word
453
+ // (no minor-word list to keep lowercase). A no-op for scripts that have no
454
+ // letter case (Arabic "ar", Chinese "zh", Korean "ko", Punjabi "pa"), so
455
+ // those are intentionally omitted.
456
+ default: {
457
+ style: "title"
458
+ },
459
+ en: {
460
+ style: "title",
461
+ lowercase: [
462
+ "a",
463
+ "amid",
464
+ "an",
465
+ "and",
466
+ "as",
467
+ "at",
468
+ "atop",
469
+ "but",
470
+ "by",
471
+ "for",
472
+ "from",
473
+ "if",
474
+ "in",
475
+ "into",
476
+ "near",
477
+ "nor",
478
+ "of",
479
+ "on",
480
+ "onto",
481
+ "or",
482
+ "per",
483
+ "so",
484
+ "than",
485
+ "that",
486
+ "the",
487
+ "till",
488
+ "to",
489
+ "unto",
490
+ "upon",
491
+ "v",
492
+ "versus",
493
+ "via",
494
+ "vs",
495
+ "with",
496
+ "yet"
497
+ ],
498
+ acronyms: [
499
+ "API",
500
+ "B2B",
501
+ "B2C",
502
+ "CEO",
503
+ "CFO",
504
+ "CIA",
505
+ "CIO",
506
+ "CMO",
507
+ "CNC",
508
+ "COO",
509
+ "CPU",
510
+ "CRM",
511
+ "CSS",
512
+ "CTO",
513
+ "DNS",
514
+ "DVD",
515
+ "ERP",
516
+ "FAQ",
517
+ "FBI",
518
+ "GDP",
519
+ "GDPR",
520
+ "GNP",
521
+ "GPS",
522
+ "GPU",
523
+ "HTML",
524
+ "HTTP",
525
+ "HTTPS",
526
+ "HVAC",
527
+ "IaaS",
528
+ "IoT",
529
+ "iOS",
530
+ "JSON",
531
+ "KPI",
532
+ "macOS",
533
+ "NASA",
534
+ "PaaS",
535
+ "PDF",
536
+ "PhD",
537
+ "PR",
538
+ "R&D",
539
+ "ROI",
540
+ "SaaS",
541
+ "SDK",
542
+ "SQL",
543
+ "SSD",
544
+ "TV",
545
+ "UI",
546
+ "URL",
547
+ "USB",
548
+ "UX",
549
+ "VP",
550
+ "VPN",
551
+ "XML"
552
+ ]
553
+ },
554
+ // The lists below are fuller, but still collision-vetted by a non-native pass —
555
+ // worth a native-speaker review before relying on them. Every locale
556
+ // title-cases; its `lowercase` list keeps that language's minor words lowered
557
+ // mid-title, and its `acronyms` are forced uppercase.
558
+ ca: {
559
+ style: "title",
560
+ lowercase: [
561
+ "a",
562
+ "al",
563
+ "als",
564
+ "amb",
565
+ "cap",
566
+ "contra",
567
+ "d",
568
+ "de",
569
+ "del",
570
+ "dels",
571
+ "des",
572
+ "el",
573
+ "els",
574
+ "en",
575
+ "entre",
576
+ "fins",
577
+ "i",
578
+ "l",
579
+ "la",
580
+ "les",
581
+ "ni",
582
+ "o",
583
+ "pel",
584
+ "pels",
585
+ "per",
586
+ "però",
587
+ "que",
588
+ "sense",
589
+ "sinó",
590
+ "sobre",
591
+ "sota",
592
+ "un",
593
+ "una",
594
+ "unes",
595
+ "uns",
596
+ "vers"
597
+ ],
598
+ acronyms: [
599
+ ...intl,
600
+ "API",
601
+ "CEO",
602
+ "PIB",
603
+ "IVA",
604
+ "UE",
605
+ "ONU",
606
+ "ONG",
607
+ "ADN",
608
+ "OMS",
609
+ "FMI",
610
+ "UNESCO"
611
+ ]
612
+ },
613
+ da: {
614
+ style: "title",
615
+ lowercase: [
616
+ "af",
617
+ "efter",
618
+ "eller",
619
+ "en",
620
+ "et",
621
+ "for",
622
+ "fra",
623
+ "før",
624
+ "gennem",
625
+ "hos",
626
+ "i",
627
+ "med",
628
+ "mellem",
629
+ "men",
630
+ "mod",
631
+ "og",
632
+ "om",
633
+ "over",
634
+ "på",
635
+ "samt",
636
+ "så",
637
+ "til",
638
+ "uden",
639
+ "under",
640
+ "ved"
641
+ ],
642
+ acronyms: [
643
+ ...intl,
644
+ "API",
645
+ "CEO",
646
+ "BNP",
647
+ "EU",
648
+ "FN",
649
+ "NATO",
650
+ "DNA",
651
+ "CVR",
652
+ "CPR"
653
+ ]
654
+ },
655
+ // German capitalizes all nouns by orthographic rule; title case capitalizes
656
+ // every significant word (nouns included), lowering only these minor words.
657
+ de: {
658
+ style: "title",
659
+ lowercase: [
660
+ "aber",
661
+ "an",
662
+ "auf",
663
+ "aus",
664
+ "bei",
665
+ "bis",
666
+ "bzw",
667
+ "das",
668
+ "dem",
669
+ "den",
670
+ "denn",
671
+ "der",
672
+ "des",
673
+ "die",
674
+ "durch",
675
+ "ein",
676
+ "eine",
677
+ "einem",
678
+ "einen",
679
+ "einer",
680
+ "eines",
681
+ "für",
682
+ "gegen",
683
+ "hinter",
684
+ "in",
685
+ "mit",
686
+ "nach",
687
+ "neben",
688
+ "oder",
689
+ "ohne",
690
+ "sondern",
691
+ "sowie",
692
+ "über",
693
+ "um",
694
+ "und",
695
+ "unter",
696
+ "von",
697
+ "vor",
698
+ "während",
699
+ "wegen",
700
+ "zu",
701
+ "zwischen"
702
+ ],
703
+ acronyms: [
704
+ ...intl,
705
+ "API",
706
+ "CEO",
707
+ "BIP",
708
+ "GmbH",
709
+ "AG",
710
+ "MwSt",
711
+ "USt",
712
+ "EU",
713
+ "UNO",
714
+ "NATO",
715
+ "KI",
716
+ "EDV",
717
+ "DSGVO",
718
+ "AGB",
719
+ "PLZ",
720
+ "KFZ",
721
+ "LKW",
722
+ "PKW",
723
+ "IBAN",
724
+ "EZB"
725
+ ]
726
+ },
727
+ es: {
728
+ style: "title",
729
+ lowercase: [
730
+ "a",
731
+ "al",
732
+ "ante",
733
+ "bajo",
734
+ "cabe",
735
+ "con",
736
+ "contra",
737
+ "de",
738
+ "del",
739
+ "desde",
740
+ "durante",
741
+ "e",
742
+ "el",
743
+ "en",
744
+ "entre",
745
+ "hacia",
746
+ "hasta",
747
+ "la",
748
+ "las",
749
+ "lo",
750
+ "los",
751
+ "mediante",
752
+ "ni",
753
+ "o",
754
+ "para",
755
+ "pero",
756
+ "por",
757
+ "que",
758
+ "según",
759
+ "sin",
760
+ "sino",
761
+ "so",
762
+ "sobre",
763
+ "tras",
764
+ "u",
765
+ "un",
766
+ "una",
767
+ "unas",
768
+ "unos",
769
+ "versus",
770
+ "vía",
771
+ "y"
772
+ ],
773
+ acronyms: [
774
+ ...intl,
775
+ "API",
776
+ "CEO",
777
+ "CFO",
778
+ "COO",
779
+ "PIB",
780
+ "IVA",
781
+ "UE",
782
+ "ONU",
783
+ "ONG",
784
+ "PYME",
785
+ "ADN",
786
+ "OTAN",
787
+ "OMS",
788
+ "FMI",
789
+ "IPC",
790
+ "UNESCO",
791
+ "UNICEF"
792
+ ]
793
+ },
794
+ et: {
795
+ style: "title",
796
+ lowercase: [
797
+ "aga",
798
+ "ega",
799
+ "ent",
800
+ "et",
801
+ "ja",
802
+ "kui",
803
+ "kuid",
804
+ "nagu",
805
+ "ning",
806
+ "sest",
807
+ "vaid",
808
+ "või"
809
+ ],
810
+ acronyms: [
811
+ ...intl,
812
+ "API",
813
+ "SKT",
814
+ "EL",
815
+ "ÜRO",
816
+ "NATO",
817
+ "DNA"
818
+ ]
819
+ },
820
+ fr: {
821
+ style: "title",
822
+ lowercase: [
823
+ "à",
824
+ "après",
825
+ "au",
826
+ "aux",
827
+ "avant",
828
+ "avec",
829
+ "car",
830
+ "chez",
831
+ "comme",
832
+ "contre",
833
+ "d",
834
+ "dans",
835
+ "de",
836
+ "depuis",
837
+ "des",
838
+ "donc",
839
+ "du",
840
+ "dès",
841
+ "en",
842
+ "entre",
843
+ "envers",
844
+ "et",
845
+ "hors",
846
+ "l",
847
+ "la",
848
+ "le",
849
+ "les",
850
+ "mais",
851
+ "malgré",
852
+ "ne",
853
+ "ni",
854
+ "or",
855
+ "ou",
856
+ "par",
857
+ "parmi",
858
+ "pour",
859
+ "que",
860
+ "qui",
861
+ "sans",
862
+ "sauf",
863
+ "selon",
864
+ "si",
865
+ "sous",
866
+ "sur",
867
+ "un",
868
+ "une",
869
+ "vers",
870
+ "via"
871
+ ],
872
+ acronyms: [
873
+ ...intl,
874
+ "API",
875
+ "PDG",
876
+ "PIB",
877
+ "R&D",
878
+ "UE",
879
+ "ONU",
880
+ "PME",
881
+ "TVA",
882
+ "RH",
883
+ "SARL",
884
+ "TGV",
885
+ "ADN",
886
+ "OTAN",
887
+ "OMS",
888
+ "FMI",
889
+ "INSEE",
890
+ "SMIC",
891
+ "RGPD"
892
+ ]
893
+ },
894
+ // No "API" (Italian "api" = bees) and no short note/word forms (ai, do, re,
895
+ // la, si …) — they would clobber everyday words.
896
+ it: {
897
+ style: "title",
898
+ lowercase: [
899
+ "a",
900
+ "agli",
901
+ "ai",
902
+ "al",
903
+ "alla",
904
+ "alle",
905
+ "allo",
906
+ "che",
907
+ "coi",
908
+ "col",
909
+ "come",
910
+ "con",
911
+ "da",
912
+ "dai",
913
+ "dal",
914
+ "dalla",
915
+ "dei",
916
+ "del",
917
+ "della",
918
+ "delle",
919
+ "dello",
920
+ "di",
921
+ "e",
922
+ "ed",
923
+ "fra",
924
+ "gli",
925
+ "i",
926
+ "il",
927
+ "in",
928
+ "la",
929
+ "le",
930
+ "lo",
931
+ "ma",
932
+ "né",
933
+ "negli",
934
+ "nei",
935
+ "nel",
936
+ "nella",
937
+ "nelle",
938
+ "o",
939
+ "od",
940
+ "per",
941
+ "se",
942
+ "su",
943
+ "sugli",
944
+ "sui",
945
+ "sul",
946
+ "sulla",
947
+ "tra",
948
+ "un",
949
+ "una",
950
+ "uno"
951
+ ],
952
+ acronyms: [
953
+ ...intl,
954
+ "CEO",
955
+ "PIL",
956
+ "IVA",
957
+ "UE",
958
+ "ONU",
959
+ "PMI",
960
+ "NATO",
961
+ "OMS",
962
+ "FMI",
963
+ "ISTAT",
964
+ "SRL",
965
+ "DNA"
966
+ ]
967
+ },
968
+ pt: {
969
+ style: "title",
970
+ lowercase: [
971
+ "a",
972
+ "à",
973
+ "às",
974
+ "ante",
975
+ "ao",
976
+ "aos",
977
+ "após",
978
+ "as",
979
+ "até",
980
+ "com",
981
+ "contra",
982
+ "da",
983
+ "das",
984
+ "de",
985
+ "desde",
986
+ "do",
987
+ "dos",
988
+ "e",
989
+ "em",
990
+ "entre",
991
+ "mas",
992
+ "na",
993
+ "nas",
994
+ "nem",
995
+ "no",
996
+ "nos",
997
+ "num",
998
+ "numa",
999
+ "o",
1000
+ "os",
1001
+ "ou",
1002
+ "para",
1003
+ "pela",
1004
+ "pelo",
1005
+ "per",
1006
+ "perante",
1007
+ "por",
1008
+ "que",
1009
+ "sem",
1010
+ "sob",
1011
+ "sobre",
1012
+ "um",
1013
+ "uma",
1014
+ "via"
1015
+ ],
1016
+ acronyms: [
1017
+ ...intl,
1018
+ "API",
1019
+ "CEO",
1020
+ "PIB",
1021
+ "UE",
1022
+ "ONU",
1023
+ "EUA",
1024
+ "PME",
1025
+ "ONG",
1026
+ "OTAN",
1027
+ "OMS",
1028
+ "FMI",
1029
+ "IBGE",
1030
+ "CPF",
1031
+ "CNPJ"
1032
+ ]
1033
+ },
1034
+ sv: {
1035
+ style: "title",
1036
+ lowercase: [
1037
+ "av",
1038
+ "efter",
1039
+ "eller",
1040
+ "en",
1041
+ "ett",
1042
+ "för",
1043
+ "före",
1044
+ "från",
1045
+ "genom",
1046
+ "hos",
1047
+ "i",
1048
+ "med",
1049
+ "mellan",
1050
+ "men",
1051
+ "mot",
1052
+ "och",
1053
+ "om",
1054
+ "över",
1055
+ "på",
1056
+ "samt",
1057
+ "så",
1058
+ "till",
1059
+ "utan",
1060
+ "under",
1061
+ "vid"
1062
+ ],
1063
+ acronyms: [
1064
+ ...intl,
1065
+ "API",
1066
+ "CEO",
1067
+ "VD",
1068
+ "BNP",
1069
+ "EU",
1070
+ "FN",
1071
+ "NATO",
1072
+ "DNA",
1073
+ "SCB"
1074
+ ]
1075
+ }
1076
+ };
1077
+
426
1078
  const locale = {
427
1079
  "ar-SA": {
428
1080
  dateTime: "%x, %X",
@@ -10778,6 +11430,7 @@
10778
11430
  exports.findLocale = findLocale;
10779
11431
  exports.formatLocale = formatLocale;
10780
11432
  exports.locale = locale;
11433
+ exports.titleCaseLocale = titleCaseLocale;
10781
11434
  exports.translateLocale = translateLocale;
10782
11435
 
10783
11436
  }));