nextjs-cms 0.6.8 → 0.6.9
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/core/config/config-loader.d.ts +4 -10
- package/dist/core/config/config-loader.d.ts.map +1 -1
- package/dist/core/config/config-loader.js +14 -14
- package/dist/core/sections/category.d.ts +32 -32
- package/dist/core/sections/hasItems.d.ts +32 -32
- package/dist/core/sections/section.d.ts +16 -16
- package/dist/core/sections/simple.d.ts +8 -8
- package/dist/translations/client.d.ts +5178 -1
- package/dist/translations/client.d.ts.map +1 -1
- package/dist/translations/client.js +29 -4
- package/dist/translations/dict-store.d.ts +5 -1
- package/dist/translations/dict-store.d.ts.map +1 -1
- package/dist/translations/dict-store.js +30 -3
- package/dist/translations/index.d.ts +1 -1
- package/dist/translations/index.js +1 -1
- package/dist/translations/server.d.ts +5171 -1
- package/dist/translations/server.d.ts.map +1 -1
- package/dist/translations/server.js +26 -4
- package/package.json +3 -3
- package/dist/core/helpers/i18n.d.ts +0 -2
- package/dist/core/helpers/i18n.d.ts.map +0 -1
- package/dist/core/helpers/i18n.js +0 -3
- package/dist/core/localization.d.ts +0 -40
- package/dist/core/localization.d.ts.map +0 -1
- package/dist/core/localization.js +0 -48
- package/dist/logging/audit.d.ts +0 -20
- package/dist/logging/audit.d.ts.map +0 -1
- package/dist/logging/audit.js +0 -48
- package/dist/translations/localized-string.d.ts +0 -17
- package/dist/translations/localized-string.d.ts.map +0 -1
- package/dist/translations/localized-string.js +0 -32
- package/dist/translations/use-project-translation.d.ts +0 -19
- package/dist/translations/use-project-translation.d.ts.map +0 -1
- package/dist/translations/use-project-translation.js +0 -25
- package/dist/validators/types.d.ts +0 -7
- package/dist/validators/types.d.ts.map +0 -1
- package/dist/validators/types.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/translations/client.
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACb,gBAAgB,cAEgC,CAAA;AAGpD,KAAK,uBAAuB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IACpD,QAAQ,EAAE,SAAS,CAAA;CACtB,CAAA;AAID,wBAAgB,kBAAkB,CAAC,EAC/B,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,QAAQ,GACX,EAAE,uBAAuB,qBAWzB;AAED,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { createI18nClient } from 'next-international/client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { getAllDicts, getDict, setConfigDicts } from './dict-store.js';
|
|
5
|
+
function createDynamicLocaleImporters() {
|
|
6
|
+
return new Proxy({}, {
|
|
7
|
+
get: (_target, prop) => {
|
|
8
|
+
if (typeof prop !== 'string')
|
|
9
|
+
return undefined;
|
|
10
|
+
return async () => ({ default: getDict(prop) });
|
|
11
|
+
},
|
|
12
|
+
ownKeys: () => Object.keys(getAllDicts()),
|
|
13
|
+
getOwnPropertyDescriptor: (_target, prop) => {
|
|
14
|
+
if (typeof prop !== 'string')
|
|
15
|
+
return undefined;
|
|
16
|
+
if (!(prop in getAllDicts()))
|
|
17
|
+
return undefined;
|
|
18
|
+
return { enumerable: true, configurable: true };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const { useI18n, useScopedI18n, useCurrentLocale, I18nProviderClient: BaseI18nProviderClient, } = createI18nClient(createDynamicLocaleImporters());
|
|
23
|
+
let lastAppliedDicts;
|
|
24
|
+
export function I18nProviderClient({ locale, fallback, dictionaries, children, }) {
|
|
25
|
+
if (dictionaries && dictionaries !== lastAppliedDicts) {
|
|
26
|
+
setConfigDicts(dictionaries);
|
|
27
|
+
lastAppliedDicts = dictionaries;
|
|
28
|
+
}
|
|
29
|
+
return (React.createElement(BaseI18nProviderClient, { locale: locale, fallback: fallback }, children));
|
|
30
|
+
}
|
|
31
|
+
export { useI18n, useScopedI18n, useCurrentLocale };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { TranslationDictionary } from './types.js';
|
|
2
|
+
type DictStore = Record<string, TranslationDictionary>;
|
|
2
3
|
/**
|
|
3
4
|
* Set dictionaries from config (supportedLanguages record).
|
|
4
5
|
* Called by config loader when user provides i18n.supportedLanguages.
|
|
5
6
|
*/
|
|
6
|
-
export declare function setConfigDicts(dicts: Record<string, TranslationDictionary>): void;
|
|
7
|
+
export declare function setConfigDicts(dicts: Record<string, TranslationDictionary | undefined>): void;
|
|
7
8
|
/**
|
|
8
9
|
* Get the dictionary for a locale. Used by getString.
|
|
9
10
|
* Falls back to 'en' from store, then to built-in en.
|
|
10
11
|
*/
|
|
11
12
|
export declare function getDict(locale: string): TranslationDictionary;
|
|
13
|
+
export declare function getAllDicts(): DictStore;
|
|
14
|
+
export declare function getConfigOverrides(): DictStore;
|
|
15
|
+
export {};
|
|
12
16
|
//# sourceMappingURL=dict-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dict-store.d.ts","sourceRoot":"","sources":["../../src/translations/dict-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dict-store.d.ts","sourceRoot":"","sources":["../../src/translations/dict-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEvD,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;AA0BtD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAC,GAAG,IAAI,CAS7F;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CAE7D;AAED,wBAAgB,WAAW,IAAI,SAAS,CAEvC;AAED,wBAAgB,kBAAkB,IAAI,SAAS,CAE9C"}
|
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
import enStrings from './dictionaries/en.js';
|
|
2
|
-
import arStrings from './dictionaries/ar.js';
|
|
3
2
|
const builtin = {
|
|
4
3
|
en: enStrings,
|
|
5
|
-
ar: arStrings,
|
|
6
4
|
};
|
|
5
|
+
let overrides = {};
|
|
7
6
|
let store = { ...builtin };
|
|
7
|
+
function mergeDicts(base, extra) {
|
|
8
|
+
const merged = { ...base };
|
|
9
|
+
const englishBase = base['en'] ?? {};
|
|
10
|
+
for (const [locale, dict] of Object.entries(extra)) {
|
|
11
|
+
if (!dict)
|
|
12
|
+
continue;
|
|
13
|
+
if (locale === 'en') {
|
|
14
|
+
merged['en'] = { ...englishBase, ...dict };
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
// Non-English locales inherit from English by default, then override with locale-specific strings.
|
|
18
|
+
merged[locale] = { ...englishBase, ...(base[locale] ?? {}), ...dict };
|
|
19
|
+
}
|
|
20
|
+
return merged;
|
|
21
|
+
}
|
|
8
22
|
/**
|
|
9
23
|
* Set dictionaries from config (supportedLanguages record).
|
|
10
24
|
* Called by config loader when user provides i18n.supportedLanguages.
|
|
11
25
|
*/
|
|
12
26
|
export function setConfigDicts(dicts) {
|
|
13
|
-
|
|
27
|
+
const cleaned = {};
|
|
28
|
+
for (const [locale, dict] of Object.entries(dicts)) {
|
|
29
|
+
if (dict && typeof dict === 'object') {
|
|
30
|
+
cleaned[locale] = dict;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
overrides = cleaned;
|
|
34
|
+
store = mergeDicts(builtin, overrides);
|
|
14
35
|
}
|
|
15
36
|
/**
|
|
16
37
|
* Get the dictionary for a locale. Used by getString.
|
|
@@ -19,3 +40,9 @@ export function setConfigDicts(dicts) {
|
|
|
19
40
|
export function getDict(locale) {
|
|
20
41
|
return store[locale] ?? store['en'] ?? builtin['en'];
|
|
21
42
|
}
|
|
43
|
+
export function getAllDicts() {
|
|
44
|
+
return store;
|
|
45
|
+
}
|
|
46
|
+
export function getConfigOverrides() {
|
|
47
|
+
return overrides;
|
|
48
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a string directly from a specific dictionary.
|
|
3
3
|
* Uses config-driven dicts when i18n.supportedLanguages is set;
|
|
4
|
-
* otherwise falls back to built-in en
|
|
4
|
+
* otherwise falls back to built-in en.
|
|
5
5
|
* Unknown locales fall back to English.
|
|
6
6
|
*
|
|
7
7
|
* @param key - The key of the string to get
|
|
@@ -3,7 +3,7 @@ const FALLBACK_LOCALE = 'en';
|
|
|
3
3
|
/**
|
|
4
4
|
* Get a string directly from a specific dictionary.
|
|
5
5
|
* Uses config-driven dicts when i18n.supportedLanguages is set;
|
|
6
|
-
* otherwise falls back to built-in en
|
|
6
|
+
* otherwise falls back to built-in en.
|
|
7
7
|
* Unknown locales fall back to English.
|
|
8
8
|
*
|
|
9
9
|
* @param key - The key of the string to get
|