@prezly/theme-kit-nextjs 2.0.0-1 → 2.0.0-3
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/README.md +8 -13
- package/build/intl/index.d.ts +1 -1
- package/build/intl/index.js +1 -1
- package/build/intl/index.js.map +1 -1
- package/build/intl/languages.js +1 -1
- package/build/intl/languages.js.map +1 -1
- package/build/intl/locale.d.ts +0 -1
- package/build/intl/locale.js +1 -2
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeConfig.d.ts +3 -1
- package/build/intl/localeConfig.js +14 -1
- package/build/intl/localeConfig.js.map +1 -1
- package/build/intl/localeObject.js +1 -1
- package/build/intl/localeObject.js.map +1 -1
- package/build/newsroom-context/index.d.ts +2 -1
- package/build/newsroom-context/index.js +1 -1
- package/build/newsroom-context/index.js.map +1 -1
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -69,26 +69,21 @@ module.exports = {
|
|
|
69
69
|
If you want to support multi-language in your theme, you'll need to make additional changes to the file:
|
|
70
70
|
|
|
71
71
|
```js
|
|
72
|
-
const {
|
|
73
|
-
const locales = require('@prezly/theme-kit-nextjs/build/intl/localeConfig');
|
|
72
|
+
const { localeConfig } = require('@prezly/theme-kit-nextjs/localeConfig');
|
|
74
73
|
|
|
75
74
|
module.exports = {
|
|
76
75
|
/* ...your next config... */
|
|
77
76
|
|
|
78
|
-
i18n:
|
|
79
|
-
// These are all the locales you want to support in
|
|
80
|
-
// your application
|
|
81
|
-
locales: [...locales, DUMMY_DEFAULT_LOCALE],
|
|
82
|
-
// This is the default locale you want to be used when visiting
|
|
83
|
-
// a non-locale prefixed path e.g. `/media`
|
|
84
|
-
// We use Pseudo locale used for localization testing, to reliably determine if we need to fallback to the default newsroom language
|
|
85
|
-
defaultLocale: DUMMY_DEFAULT_LOCALE,
|
|
86
|
-
// Default locale detection is disabled, since the locales would be determined by Prezly API
|
|
87
|
-
localeDetection: false,
|
|
88
|
-
},
|
|
77
|
+
i18n: localeConfig,
|
|
89
78
|
};
|
|
90
79
|
```
|
|
91
80
|
|
|
81
|
+
The `localeConfig` sets three properties on `i18n` configuration:
|
|
82
|
+
|
|
83
|
+
* `locales` - These are all locales that Prezly Theme can support
|
|
84
|
+
* `defaultLocale` - A pseudo locale used for localization testing, to reliably determine if we need to fallback to the default newsroom language. This is needed for internal locale resolution in the Theme Kit
|
|
85
|
+
* `localeDetection` is set to `false`, since the locales would be determined by Prezly API
|
|
86
|
+
|
|
92
87
|
### pages/_app.tsx
|
|
93
88
|
|
|
94
89
|
In order to provide all the necessary data to the entire application, this library exports the `NewsroomContextProvider` component, which accepts props retrieved by our data-fetching methods (see next section). These props contain data that would be required to display common components like navigation, language picker, boilerplate, etc.
|
package/build/intl/index.d.ts
CHANGED
package/build/intl/index.js
CHANGED
package/build/intl/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intl/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intl/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
package/build/intl/languages.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../../src/intl/languages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../../src/intl/languages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,SAAS,aAAa,CAAC,OAAmB,E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CAAC,YAAY,EAAE,CAAC;IAC9C,MAAM,6BAA6B,GAAG,SAAS,CAAC,MAAM,CAClD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,KAAK,eAAe,CAClF,CAAC;IACF,gDAAgD;IAChD,MAAM,yBAAyB,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IAChE,MAAM,qCAAqC,GAAG,SAAS,CAAC,MAAM,CAC1D,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CACT,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,KAAK,yBAAyB;QACpF,IAAI,KAAK,yBAAyB,CACzC,CAAC;IACF,IACI,6BAA6B,CAAC,MAAM,KAAK,CAAC;QAC1C,gIAAgI;QAChI,qCAAqC,CAAC,MAAM,KAAK,CAAC;QAClD,gDAAgD;QAChD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EACvC;QACE,OAAO,eAAe,CAAC;KAC1B;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
|
package/build/intl/locale.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Redirect } from 'next';
|
|
|
3
3
|
import type { ParsedUrlQuery } from 'querystring';
|
|
4
4
|
import { LocaleObject } from './localeObject';
|
|
5
5
|
export declare const DEFAULT_LOCALE = "en";
|
|
6
|
-
export declare const DUMMY_DEFAULT_LOCALE = "qps-ploc";
|
|
7
6
|
/**
|
|
8
7
|
* Use this function to determine which translations file you should load from `@prezly/themes-intl-mesages` package.
|
|
9
8
|
* See https://github.com/prezly/theme-nextjs-bea/blob/main/utils/lang.ts for a usage example.
|
package/build/intl/locale.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { stringify } from 'querystring';
|
|
2
|
+
import { DUMMY_DEFAULT_LOCALE } from "./localeConfig.js";
|
|
2
3
|
import { LocaleObject } from "./localeObject.js";
|
|
3
4
|
export const DEFAULT_LOCALE = 'en';
|
|
4
|
-
// We use pseudo locale used for localization testing, to reliably determine if we need to fallback to the default newsroom language
|
|
5
|
-
export const DUMMY_DEFAULT_LOCALE = 'qps-ploc';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* This a list of locales that Prezly has translations for. Each code represents a language file in the `@prezly/themes-intl-messages` package.
|
package/build/intl/locale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/intl/locale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/intl/locale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC;;;GAGG;AACH,MAAM,iBAAiB,GAAG;IACtB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ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AM,YAAY,GACd,YAAY,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;QAEtF,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAErD,OAAO;YACH,WAAW,EAAE,kBAAkB;gBAC3B,CAAC,CAAC,IAAI,kBAAkB,GAAG,YAAY,GAAG,QAAQ,EAAE;gBACpD,CAAC,CAAC,GAAG,YAAY,GAAG,QAAQ,EAAE;YAClC,SAAS,EAAE,KAAK;SACnB,CAAC;KACL;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAoB;IACnD,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAE3D,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;QAClD,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -6,8 +6,21 @@
|
|
|
6
6
|
import { localeList } from "./localeList.js";
|
|
7
7
|
const lowercaseLocales = localeList.map(l => l.toLowerCase());
|
|
8
8
|
|
|
9
|
+
// We use pseudo locale used for localization testing, to reliably determine if we need to fallback to the default newsroom language
|
|
10
|
+
export const DUMMY_DEFAULT_LOCALE = 'qps-ploc';
|
|
11
|
+
|
|
9
12
|
// Get all permutations for the shorter locale codes supported by Prezly (e.g. short region codes and neutral language codes)
|
|
10
13
|
const lowercaseLocalPermutations = Array.from(new Set([...lowercaseLocales, ...lowercaseLocales.map(code => code.split('-')[0]), ...lowercaseLocales.map(code => code.split('-')[1]).filter(Boolean)
|
|
11
14
|
// Remove number-only codes from possible permutations (like `419` for `es-419`)
|
|
12
15
|
.filter(code => Number.isNaN(Number(code)))])).sort();
|
|
13
|
-
export const localeConfig =
|
|
16
|
+
export const localeConfig = {
|
|
17
|
+
// These are all the locales you want to support in
|
|
18
|
+
// your application
|
|
19
|
+
locales: [DUMMY_DEFAULT_LOCALE, ...lowercaseLocalPermutations],
|
|
20
|
+
// This is the default locale you want to be used when visiting
|
|
21
|
+
// a non-locale prefixed path e.g. `/media`
|
|
22
|
+
// We use Pseudo locale used for localization testing, to reliably determine if we need to fallback to the default newsroom language
|
|
23
|
+
defaultLocale: DUMMY_DEFAULT_LOCALE,
|
|
24
|
+
// Default locale detection is disabled, since the locales would be determined by Prezly API
|
|
25
|
+
localeDetection: false
|
|
26
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localeConfig.js","sourceRoot":"","sources":["../../src/intl/localeConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"localeConfig.js","sourceRoot":"","sources":["../../src/intl/localeConfig.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAEhE,oIAAoI;AACpI,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,6HAA6H;AAC7H,MAAM,0BAA0B,GAAG,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CAAC;IACJ,GAAG,gBAAgB;IACnB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,GAAG,gBAAgB;SACd,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC,MAAM,CAAC,OAAO,CAAC;QAChB,gFAAgF;SAC/E,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;CACpD,CAAC,CACL,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,CAAC,MAAM,YAAY,GAAe;IACpC,mDAAmD;IACnD,mBAAmB;IACnB,OAAO,EAAE,CAAC,oBAAoB,EAAE,GAAG,0BAA0B,CAAC;IAC9D,+DAA+D;IAC/D,2CAA2C;IAC3C,oIAAoI;IACpI,aAAa,EAAE,oBAAoB;IACnC,4FAA4F;IAC5F,eAAe,EAAE,KAAK;CACzB,CAAC"}
|
|
@@ -33,7 +33,7 @@ export class LocaleObject {
|
|
|
33
33
|
*/
|
|
34
34
|
static fromAnyCode(localeCode) {
|
|
35
35
|
const lowercaseCode = localeCode.toLowerCase().replace('_', '-');
|
|
36
|
-
const foundCode = localeConfig.find(code => code === lowercaseCode);
|
|
36
|
+
const foundCode = localeConfig.locales.find(code => code === lowercaseCode);
|
|
37
37
|
if (!foundCode) {
|
|
38
38
|
throw new Error(`Unsupported locale code provided: "${lowercaseCode}"`);
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localeObject.js","sourceRoot":"","sources":["../../src/intl/localeObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACrB;;;OAGG;IACK,UAAU,CAAS;IAE3B,YAAoB,UAAkB;QAClC,IAAI,CAAC,iCAAiC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;SACpD;QAED,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEjD,IAAI,MAAM,EAAE;YACR,2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;QACtC,OAAO,aAAa,CAAC,YAAY,EAAE,KAAK,IAAI,CAAC,UAAU,CAAC;IAC5D,CAAC;CACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { NewsroomContext, NewsroomContextProvider
|
|
1
|
+
export { NewsroomContext, NewsroomContextProvider } from "./context.js";
|
|
2
2
|
export * from "./hooks/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAErE,cAAc,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/theme-kit-nextjs",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-3",
|
|
4
4
|
"description": "Data layer and utility library for developing Prezly themes with NextJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"types": "build/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./build/index.d.ts",
|
|
11
|
+
"import": "./build/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./localeConfig": "./build/intl/localeConfig.js"
|
|
14
|
+
},
|
|
8
15
|
"files": [
|
|
9
16
|
"build"
|
|
10
17
|
],
|