@byline/i18n 4.11.2 → 4.13.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/dist/index.d.ts CHANGED
@@ -26,8 +26,8 @@
26
26
  */
27
27
  export { createFormatter } from './formatter.js';
28
28
  export { mergeTranslations } from './merge.js';
29
- export { resolveInterfaceLocale } from './resolve.js';
29
+ export { resolveAdminLocale } from './resolve.js';
30
30
  export type { Formatter, FormatterOptions, MissingTranslationEvent, } from './formatter.js';
31
31
  export type { MergeOptions, TranslationCollision } from './merge.js';
32
- export type { ResolveInterfaceLocaleOptions } from './resolve.js';
32
+ export type { ResolveAdminLocaleOptions } from './resolve.js';
33
33
  export type { LocaleCode, LocaleDefinition, MessageKey, Namespace, NamespaceTranslations, TranslationBundle, TranslationValues, } from './types.js';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { createFormatter } from "./formatter.js";
2
2
  export { mergeTranslations } from "./merge.js";
3
- export { resolveInterfaceLocale } from "./resolve.js";
3
+ export { resolveAdminLocale } from "./resolve.js";
package/dist/resolve.d.ts CHANGED
@@ -6,10 +6,10 @@
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
8
  import type { LocaleCode } from './types.js';
9
- export interface ResolveInterfaceLocaleOptions {
10
- /** Permitted locale set — from `i18n.interface.locales`. */
9
+ export interface ResolveAdminLocaleOptions {
10
+ /** Permitted locale set — from `i18n.admin.locales`. */
11
11
  locales: readonly LocaleCode[];
12
- /** Last-resort fallback — from `i18n.interface.defaultLocale`. */
12
+ /** Last-resort fallback — from `i18n.admin.defaultLocale`. */
13
13
  defaultLocale: LocaleCode;
14
14
  /** `admin_users.preferred_locale` for the authenticated request, if any. */
15
15
  preferred?: LocaleCode | null;
@@ -18,4 +18,4 @@ export interface ResolveInterfaceLocaleOptions {
18
18
  /** Raw `Accept-Language` request header. */
19
19
  acceptLanguage?: string | null;
20
20
  }
21
- export declare function resolveInterfaceLocale(options: ResolveInterfaceLocaleOptions): LocaleCode;
21
+ export declare function resolveAdminLocale(options: ResolveAdminLocaleOptions): LocaleCode;
package/dist/resolve.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { match } from "@formatjs/intl-localematcher";
2
2
  import negotiator_0 from "negotiator";
3
- function resolveInterfaceLocale(options) {
3
+ function resolveAdminLocale(options) {
4
4
  const { locales, defaultLocale, preferred, cookie, acceptLanguage } = options;
5
5
  if (null != preferred && locales.includes(preferred)) return preferred;
6
6
  if (null != cookie && locales.includes(cookie)) return cookie;
@@ -25,4 +25,4 @@ function negotiateAcceptLanguage(header, locales, defaultLocale) {
25
25
  return null;
26
26
  }
27
27
  }
28
- export { resolveInterfaceLocale };
28
+ export { resolveAdminLocale };
package/dist/types.d.ts CHANGED
@@ -8,13 +8,13 @@
8
8
  /**
9
9
  * Locale code — kept as a plain `string` so the package stays open to
10
10
  * any BCP 47 tag (`en`, `pt-BR`, `zh-Hans-CN`). The host's
11
- * `i18n.interface.locales` config is the canonical allow-list at
11
+ * `i18n.admin.locales` config is the canonical allow-list at
12
12
  * runtime; the resolver / validator narrow against it.
13
13
  */
14
14
  export type LocaleCode = string;
15
15
  /**
16
16
  * Lightweight locale definition used by `<LanguageMenu>` to render the
17
- * dropdown. The `code` matches a string in `i18n.interface.locales`;
17
+ * dropdown. The `code` matches a string in `i18n.admin.locales`;
18
18
  * the `nativeName` is what the user sees ("English", "Español",
19
19
  * "Français", "Deutsch", "日本語").
20
20
  */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "license": "MPL-2.0",
6
- "version": "4.11.2",
6
+ "version": "4.13.0",
7
7
  "engines": {
8
8
  "node": ">=20.9.0"
9
9
  },
@@ -53,20 +53,20 @@
53
53
  "dependencies": {
54
54
  "@formatjs/intl-localematcher": "^0.8.13",
55
55
  "clsx": "^2.1.1",
56
- "intl-messageformat": "^11.2.13",
56
+ "intl-messageformat": "^11.2.14",
57
57
  "negotiator": "^1.0.0",
58
- "@byline/ui": "4.11.2"
58
+ "@byline/ui": "4.13.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react": "^19.0.0",
62
62
  "react-dom": "^19.0.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@biomejs/biome": "2.5.6",
65
+ "@biomejs/biome": "2.5.9",
66
66
  "@rsbuild/plugin-react": "^2.1.0",
67
67
  "@rslib/core": "^0.23.2",
68
- "@types/negotiator": "^0.6.4",
69
- "@types/node": "^26.1.2",
68
+ "@types/negotiator": "^0.6.5",
69
+ "@types/node": "^26.2.0",
70
70
  "@types/react": "19.2.18",
71
71
  "@types/react-dom": "19.2.4",
72
72
  "@vitejs/plugin-react": "^6.0.5",
@@ -75,8 +75,8 @@
75
75
  "react-dom": "^19.2.8",
76
76
  "rimraf": "^6.1.3",
77
77
  "typescript": "^7.0.2",
78
- "vite": "^8.2.0",
79
- "vitest": "^4.1.10"
78
+ "vite": "^8.2.1",
79
+ "vitest": "^4.1.11"
80
80
  },
81
81
  "publishConfig": {
82
82
  "access": "public",
@@ -17,6 +17,7 @@ import {
17
17
  fr,
18
18
  it as itBundle,
19
19
  ko,
20
+ th,
20
21
  zhCN,
21
22
  } from './index.js'
22
23
 
@@ -44,6 +45,7 @@ describe('bundled locale data', () => {
44
45
  ['it', itBundle],
45
46
  ['zh-CN', zhCN],
46
47
  ['ko', ko],
48
+ ['th', th],
47
49
  ])('exports the %s bundle with the same key set as en (no drift)', (_code, bundle) => {
48
50
  expect(new Set(Object.keys(bundle))).toEqual(new Set(Object.keys(en)))
49
51
  })
@@ -63,7 +65,7 @@ describe('bundled locale data', () => {
63
65
  'collections.list.treeRefreshFailedDescription',
64
66
  'collections.edit.deletedWithWarningsDescription',
65
67
  ] as const
66
- const nonEnglishBundles = { fr, es, de, it: itBundle, 'zh-CN': zhCN, ko } as const
68
+ const nonEnglishBundles = { fr, es, de, it: itBundle, 'zh-CN': zhCN, ko, th } as const
67
69
 
68
70
  expect(Object.keys(nonEnglishBundles)).toEqual(
69
71
  bundledLocales.filter((locale) => locale !== 'en')
@@ -33,6 +33,7 @@ import esJson from './es.json'
33
33
  import frJson from './fr.json'
34
34
  import itJson from './it.json'
35
35
  import koJson from './ko.json'
36
+ import thJson from './th.json'
36
37
  import zhCNJson from './zh-CN.json'
37
38
  import type { LocaleCode, NamespaceTranslations, TranslationBundle } from '../types.js'
38
39
 
@@ -43,6 +44,7 @@ const de: NamespaceTranslations = deJson
43
44
  const it: NamespaceTranslations = itJson
44
45
  const zhCN: NamespaceTranslations = zhCNJson
45
46
  const ko: NamespaceTranslations = koJson
47
+ const th: NamespaceTranslations = thJson
46
48
 
47
49
  /**
48
50
  * Map of every bundled locale → its `byline-admin` namespace
@@ -59,13 +61,14 @@ const BUNDLES: Readonly<Record<LocaleCode, NamespaceTranslations>> = {
59
61
  it,
60
62
  'zh-CN': zhCN,
61
63
  ko,
64
+ th,
62
65
  }
63
66
 
64
67
  /** Locale codes for which a bundled translation ships in-package. */
65
68
  export const bundledLocales: readonly LocaleCode[] = Object.freeze(Object.keys(BUNDLES))
66
69
 
67
70
  /** Re-exported as typed consts for plugin authors who want the literal-key autocomplete. */
68
- export { de, en, es, fr, it, ko, zhCN }
71
+ export { de, en, es, fr, it, ko, th, zhCN }
69
72
  export type AdminNamespaceTranslations = typeof enJson
70
73
 
71
74
  export interface AdminTranslationsOptions {
@@ -86,9 +89,9 @@ export interface AdminTranslationsOptions {
86
89
  * ```ts
87
90
  * import { adminTranslations } from '@byline/i18n/admin'
88
91
  *
89
- * defineClientConfig({
92
+ * defineAdminConfig({
90
93
  * i18n: {
91
- * interface: { defaultLocale: 'en', locales: ['en', 'fr'] },
94
+ * admin: { defaultLocale: 'en', locales: ['en', 'fr'] },
92
95
  * translations: adminTranslations({ locales: ['en', 'fr'] }),
93
96
  * },
94
97
  * })