@d3plus/locales 3.1.6 → 4.1.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.1.0",
4
4
  "description": "International localizations for number, date, and UI labels.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "browser": "./umd/d3plus-locales.full.js",
15
15
  "engines": {
16
- "node": ">=20"
16
+ "node": ">=22"
17
17
  },
18
18
  "sideEffects": false,
19
19
  "files": [
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;