@prezly/theme-kit-intl 10.9.0 → 10.12.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/build/formatting/messages/lib.cjs +4 -8
- package/build/formatting/messages/lib.mjs +4 -8
- package/build/i18n/en.json +34 -0
- package/build/locales/Locale.cjs +18 -3
- package/build/locales/Locale.mjs +18 -3
- package/build/locales/pickSuportedLocale.cjs +3 -4
- package/build/locales/pickSuportedLocale.mjs +3 -4
- package/build/messages/content.cjs +28 -1
- package/build/messages/content.d.ts +27 -0
- package/build/messages/content.mjs +27 -0
- package/package.json +2 -6
|
@@ -14,10 +14,8 @@ var _types = require("./types.cjs");
|
|
|
14
14
|
var getPluralRules = exports.getPluralRules = (0, _index2.withCache)(locale => new Intl.PluralRules(_index.Locale.from(locale).isoCode));
|
|
15
15
|
function formatMessageFragment(locale, _ref, dictionary) {
|
|
16
16
|
var _ref2, _dictionary$id;
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
defaultMessage
|
|
20
|
-
} = _ref;
|
|
17
|
+
var id = _ref.id,
|
|
18
|
+
defaultMessage = _ref.defaultMessage;
|
|
21
19
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
22
20
|
var format = (_ref2 = (_dictionary$id = dictionary[id]) !== null && _dictionary$id !== void 0 ? _dictionary$id : prepareMessage(defaultMessage)) !== null && _ref2 !== void 0 ? _ref2 : [{
|
|
23
21
|
type: 0,
|
|
@@ -27,10 +25,8 @@ function formatMessageFragment(locale, _ref, dictionary) {
|
|
|
27
25
|
}
|
|
28
26
|
function formatMessageString(locale, _ref3, dictionary) {
|
|
29
27
|
var _ref4, _dictionary$id2;
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
defaultMessage
|
|
33
|
-
} = _ref3;
|
|
28
|
+
var id = _ref3.id,
|
|
29
|
+
defaultMessage = _ref3.defaultMessage;
|
|
34
30
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
35
31
|
var format = (_ref4 = (_dictionary$id2 = dictionary[id]) !== null && _dictionary$id2 !== void 0 ? _dictionary$id2 : prepareMessage(defaultMessage)) !== null && _ref4 !== void 0 ? _ref4 : [{
|
|
36
32
|
type: _types.IntlMessageFormat.Type.LITERAL,
|
|
@@ -4,10 +4,8 @@ import { IntlMessageFormat } from "./types.mjs";
|
|
|
4
4
|
export var getPluralRules = withCache(locale => new Intl.PluralRules(Locale.from(locale).isoCode));
|
|
5
5
|
export function formatMessageFragment(locale, _ref, dictionary) {
|
|
6
6
|
var _ref2, _dictionary$id;
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
defaultMessage
|
|
10
|
-
} = _ref;
|
|
7
|
+
var id = _ref.id,
|
|
8
|
+
defaultMessage = _ref.defaultMessage;
|
|
11
9
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
12
10
|
var format = (_ref2 = (_dictionary$id = dictionary[id]) !== null && _dictionary$id !== void 0 ? _dictionary$id : prepareMessage(defaultMessage)) !== null && _ref2 !== void 0 ? _ref2 : [{
|
|
13
11
|
type: 0,
|
|
@@ -17,10 +15,8 @@ export function formatMessageFragment(locale, _ref, dictionary) {
|
|
|
17
15
|
}
|
|
18
16
|
export function formatMessageString(locale, _ref3, dictionary) {
|
|
19
17
|
var _ref4, _dictionary$id2;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
defaultMessage
|
|
23
|
-
} = _ref3;
|
|
18
|
+
var id = _ref3.id,
|
|
19
|
+
defaultMessage = _ref3.defaultMessage;
|
|
24
20
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
25
21
|
var format = (_ref4 = (_dictionary$id2 = dictionary[id]) !== null && _dictionary$id2 !== void 0 ? _dictionary$id2 : prepareMessage(defaultMessage)) !== null && _ref4 !== void 0 ? _ref4 : [{
|
|
26
22
|
type: IntlMessageFormat.Type.LITERAL,
|
package/build/i18n/en.json
CHANGED
|
@@ -267,6 +267,40 @@
|
|
|
267
267
|
"value": "Latest stories"
|
|
268
268
|
}
|
|
269
269
|
],
|
|
270
|
+
"liveEvent.badge": [
|
|
271
|
+
{
|
|
272
|
+
"type": 0,
|
|
273
|
+
"value": "Live"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"liveEvent.lastUpdated": [
|
|
277
|
+
{
|
|
278
|
+
"type": 0,
|
|
279
|
+
"value": "Last updated "
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"type": 1,
|
|
283
|
+
"value": "time"
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
"liveEvent.noLiveEvents": [
|
|
287
|
+
{
|
|
288
|
+
"type": 0,
|
|
289
|
+
"value": "No live events"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"liveEvent.previousEvents": [
|
|
293
|
+
{
|
|
294
|
+
"type": 0,
|
|
295
|
+
"value": "Previous events"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"liveEvent.updates": [
|
|
299
|
+
{
|
|
300
|
+
"type": 0,
|
|
301
|
+
"value": "Live updates"
|
|
302
|
+
}
|
|
303
|
+
],
|
|
270
304
|
"mediaGallery.imagesCount": [
|
|
271
305
|
{
|
|
272
306
|
"offset": 0,
|
package/build/locales/Locale.cjs
CHANGED
|
@@ -5,6 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Locale = void 0;
|
|
7
7
|
var _isNotUndefined = require("@technically/is-not-undefined");
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
16
|
var KNOWN_SCRIPTS = ['hant', 'hans'];
|
|
9
17
|
var KNOWN_RTL_LANGUAGES = ['ar', 'he', 'ur'];
|
|
10
18
|
var LANG_CODE_REGEX = /^[a-z]{2,3}$/;
|
|
@@ -25,7 +33,10 @@ var Locale;
|
|
|
25
33
|
if (cached) {
|
|
26
34
|
return cached;
|
|
27
35
|
}
|
|
28
|
-
var
|
|
36
|
+
var _ref = locale.toLowerCase().split(/[_-]/g),
|
|
37
|
+
_ref2 = _toArray(_ref),
|
|
38
|
+
lang = _ref2[0],
|
|
39
|
+
rest = _arrayLikeToArray(_ref2).slice(1);
|
|
29
40
|
if (!lang.match(LANG_CODE_REGEX)) {
|
|
30
41
|
throw new Error("Invalid locale code provided: \"".concat(locale, "\"."));
|
|
31
42
|
}
|
|
@@ -37,8 +48,12 @@ var Locale;
|
|
|
37
48
|
if (regions.length > 1) {
|
|
38
49
|
throw new Error("Unable to parse the provided locale code: \"".concat(locale, "\". Multiple region codes detected."));
|
|
39
50
|
}
|
|
40
|
-
var
|
|
41
|
-
|
|
51
|
+
var _ref3 = scripts,
|
|
52
|
+
_ref4 = _slicedToArray(_ref3, 1),
|
|
53
|
+
scriptCode = _ref4[0];
|
|
54
|
+
var _ref5 = regions,
|
|
55
|
+
_ref6 = _slicedToArray(_ref5, 1),
|
|
56
|
+
regionCode = _ref6[0];
|
|
42
57
|
var code = [lang.toLowerCase(), regionCode, scriptCode ? toPascalCase(scriptCode) : undefined].filter(_isNotUndefined.isNotUndefined).join('_');
|
|
43
58
|
var isoCode = code.replace('_', '-');
|
|
44
59
|
var obj = {
|
package/build/locales/Locale.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
3
|
+
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
8
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
1
9
|
import { isNotUndefined } from '@technically/is-not-undefined';
|
|
2
10
|
var KNOWN_SCRIPTS = ['hant', 'hans'];
|
|
3
11
|
var KNOWN_RTL_LANGUAGES = ['ar', 'he', 'ur'];
|
|
@@ -19,7 +27,10 @@ export var Locale;
|
|
|
19
27
|
if (cached) {
|
|
20
28
|
return cached;
|
|
21
29
|
}
|
|
22
|
-
var
|
|
30
|
+
var _ref = locale.toLowerCase().split(/[_-]/g),
|
|
31
|
+
_ref2 = _toArray(_ref),
|
|
32
|
+
lang = _ref2[0],
|
|
33
|
+
rest = _arrayLikeToArray(_ref2).slice(1);
|
|
23
34
|
if (!lang.match(LANG_CODE_REGEX)) {
|
|
24
35
|
throw new Error("Invalid locale code provided: \"".concat(locale, "\"."));
|
|
25
36
|
}
|
|
@@ -31,8 +42,12 @@ export var Locale;
|
|
|
31
42
|
if (regions.length > 1) {
|
|
32
43
|
throw new Error("Unable to parse the provided locale code: \"".concat(locale, "\". Multiple region codes detected."));
|
|
33
44
|
}
|
|
34
|
-
var
|
|
35
|
-
|
|
45
|
+
var _ref3 = scripts,
|
|
46
|
+
_ref4 = _slicedToArray(_ref3, 1),
|
|
47
|
+
scriptCode = _ref4[0];
|
|
48
|
+
var _ref5 = regions,
|
|
49
|
+
_ref6 = _slicedToArray(_ref5, 1),
|
|
50
|
+
regionCode = _ref6[0];
|
|
36
51
|
var code = [lang.toLowerCase(), regionCode, scriptCode ? toPascalCase(scriptCode) : undefined].filter(isNotUndefined).join('_');
|
|
37
52
|
var isoCode = code.replace('_', '-');
|
|
38
53
|
var obj = {
|
|
@@ -24,10 +24,9 @@ var COUNTRY_TO_LOCALE = {
|
|
|
24
24
|
* See https://github.com/prezly/theme-nextjs-bea/blob/main/utils/lang.ts for a usage example.
|
|
25
25
|
*/
|
|
26
26
|
function pickSupportedLocale(locale) {
|
|
27
|
-
var
|
|
28
|
-
isoCode,
|
|
29
|
-
lang
|
|
30
|
-
} = _Locale.Locale.from(locale);
|
|
27
|
+
var _Locale$from = _Locale.Locale.from(locale),
|
|
28
|
+
isoCode = _Locale$from.isoCode,
|
|
29
|
+
lang = _Locale$from.lang;
|
|
31
30
|
if ((0, _isLocaleSupported.isLocaleSupported)(locale)) {
|
|
32
31
|
return isoCode;
|
|
33
32
|
}
|
|
@@ -18,10 +18,9 @@ var COUNTRY_TO_LOCALE = {
|
|
|
18
18
|
* See https://github.com/prezly/theme-nextjs-bea/blob/main/utils/lang.ts for a usage example.
|
|
19
19
|
*/
|
|
20
20
|
export function pickSupportedLocale(locale) {
|
|
21
|
-
var
|
|
22
|
-
isoCode,
|
|
23
|
-
lang
|
|
24
|
-
} = Locale.from(locale);
|
|
21
|
+
var _Locale$from = Locale.from(locale),
|
|
22
|
+
isoCode = _Locale$from.isoCode,
|
|
23
|
+
lang = _Locale$from.lang;
|
|
25
24
|
if (isLocaleSupported(locale)) {
|
|
26
25
|
return isoCode;
|
|
27
26
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.noStories = exports.newsroom = exports.mediaGallery = exports.homepage = exports.cookieConsent = exports.contacts = exports.categories = exports.boilerplate = void 0;
|
|
6
|
+
exports.noStories = exports.newsroom = exports.mediaGallery = exports.liveEvent = exports.homepage = exports.cookieConsent = exports.contacts = exports.categories = exports.boilerplate = void 0;
|
|
7
7
|
var _dsl = require("../dsl.cjs");
|
|
8
8
|
var homepage = exports.homepage = (0, _dsl.defineMessages)({
|
|
9
9
|
latestStories: {
|
|
@@ -71,6 +71,33 @@ var newsroom = exports.newsroom = (0, _dsl.defineMessages)({
|
|
|
71
71
|
defaultMessage: 'Site'
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
+
var liveEvent = exports.liveEvent = (0, _dsl.defineMessages)({
|
|
75
|
+
badge: {
|
|
76
|
+
id: 'liveEvent.badge',
|
|
77
|
+
defaultMessage: 'Live',
|
|
78
|
+
description: 'A short badge on an ongoing event (e.g. an incident) whose page is updated as news comes in, as in "live coverage"'
|
|
79
|
+
},
|
|
80
|
+
updates: {
|
|
81
|
+
id: 'liveEvent.updates',
|
|
82
|
+
defaultMessage: 'Live updates',
|
|
83
|
+
description: 'Title of the timeline of short news updates about an ongoing event'
|
|
84
|
+
},
|
|
85
|
+
lastUpdated: {
|
|
86
|
+
id: 'liveEvent.lastUpdated',
|
|
87
|
+
defaultMessage: 'Last updated {time}',
|
|
88
|
+
description: '{time} is a time of day, e.g. "14:05 CEST"'
|
|
89
|
+
},
|
|
90
|
+
noLiveEvents: {
|
|
91
|
+
id: 'liveEvent.noLiveEvents',
|
|
92
|
+
defaultMessage: 'No live events',
|
|
93
|
+
description: 'Shown when there is no ongoing event covered with live updates'
|
|
94
|
+
},
|
|
95
|
+
previousEvents: {
|
|
96
|
+
id: 'liveEvent.previousEvents',
|
|
97
|
+
defaultMessage: 'Previous events',
|
|
98
|
+
description: 'Title of a list of past events that were covered with live updates'
|
|
99
|
+
}
|
|
100
|
+
});
|
|
74
101
|
var cookieConsent = exports.cookieConsent = (0, _dsl.defineMessages)({
|
|
75
102
|
title: {
|
|
76
103
|
id: 'cookieConsent.title',
|
|
@@ -64,6 +64,33 @@ export declare const newsroom: {
|
|
|
64
64
|
defaultMessage: string;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
+
export declare const liveEvent: {
|
|
68
|
+
badge: {
|
|
69
|
+
id: string;
|
|
70
|
+
defaultMessage: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
updates: {
|
|
74
|
+
id: string;
|
|
75
|
+
defaultMessage: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
lastUpdated: {
|
|
79
|
+
id: string;
|
|
80
|
+
defaultMessage: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
noLiveEvents: {
|
|
84
|
+
id: string;
|
|
85
|
+
defaultMessage: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
previousEvents: {
|
|
89
|
+
id: string;
|
|
90
|
+
defaultMessage: string;
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
67
94
|
export declare const cookieConsent: {
|
|
68
95
|
title: {
|
|
69
96
|
id: string;
|
|
@@ -65,6 +65,33 @@ export var newsroom = defineMessages({
|
|
|
65
65
|
defaultMessage: 'Site'
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
+
export var liveEvent = defineMessages({
|
|
69
|
+
badge: {
|
|
70
|
+
id: 'liveEvent.badge',
|
|
71
|
+
defaultMessage: 'Live',
|
|
72
|
+
description: 'A short badge on an ongoing event (e.g. an incident) whose page is updated as news comes in, as in "live coverage"'
|
|
73
|
+
},
|
|
74
|
+
updates: {
|
|
75
|
+
id: 'liveEvent.updates',
|
|
76
|
+
defaultMessage: 'Live updates',
|
|
77
|
+
description: 'Title of the timeline of short news updates about an ongoing event'
|
|
78
|
+
},
|
|
79
|
+
lastUpdated: {
|
|
80
|
+
id: 'liveEvent.lastUpdated',
|
|
81
|
+
defaultMessage: 'Last updated {time}',
|
|
82
|
+
description: '{time} is a time of day, e.g. "14:05 CEST"'
|
|
83
|
+
},
|
|
84
|
+
noLiveEvents: {
|
|
85
|
+
id: 'liveEvent.noLiveEvents',
|
|
86
|
+
defaultMessage: 'No live events',
|
|
87
|
+
description: 'Shown when there is no ongoing event covered with live updates'
|
|
88
|
+
},
|
|
89
|
+
previousEvents: {
|
|
90
|
+
id: 'liveEvent.previousEvents',
|
|
91
|
+
defaultMessage: 'Previous events',
|
|
92
|
+
description: 'Title of a list of past events that were covered with live updates'
|
|
93
|
+
}
|
|
94
|
+
});
|
|
68
95
|
export var cookieConsent = defineMessages({
|
|
69
96
|
title: {
|
|
70
97
|
id: 'cookieConsent.title',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/theme-kit-intl",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.12.0",
|
|
4
4
|
"description": "Translations for Prezly themes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.mjs",
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"node": ">= 14.x",
|
|
23
23
|
"npm": ">= 7.x"
|
|
24
24
|
},
|
|
25
|
-
"devEngines": {
|
|
26
|
-
"node": ">= 14.x",
|
|
27
|
-
"npm": ">= 7.x"
|
|
28
|
-
},
|
|
29
25
|
"scripts": {
|
|
30
26
|
"clean": "rimraf --glob build/* *.tsbuildinfo",
|
|
31
27
|
"prebuild": "pnpm clean && pnpm build:locales && pnpm format",
|
|
@@ -74,5 +70,5 @@
|
|
|
74
70
|
"publishConfig": {
|
|
75
71
|
"access": "public"
|
|
76
72
|
},
|
|
77
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "aa8fe2c8311ddf0c5aa2329da15e086b12a81d96"
|
|
78
74
|
}
|