@bottlebooks/valid-values 1.2.0 → 1.2.1
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/CHANGELOG.md +6 -0
- package/dist/core/translate.d.ts +1 -1
- package/dist/core/translate.d.ts.map +1 -1
- package/dist/core/translate.js +25 -7
- package/dist/main.js +21 -21
- package/dist/validValues/country.d.ts +6 -1
- package/dist/validValues/country.d.ts.map +1 -1
- package/dist/validValues/country.js +2 -149
- package/dist/validValues/designation.d.ts +0 -115
- package/dist/validValues/designation.d.ts.map +1 -1
- package/dist/validValues/subregion.d.ts +0 -2
- package/dist/validValues/subregion.d.ts.map +1 -1
- package/dist/validValues/subregion.js +1385 -2770
- package/dist/validValues/types/ValidValueDefinition.d.ts +1 -1
- package/dist/validValues/types/ValidValueDefinition.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/core/translate.ts +33 -9
- package/src/locales/po/bg.po +1542 -1542
- package/src/locales/po/de.po +1542 -1542
- package/src/locales/po/ee.po +1542 -1542
- package/src/locales/po/en.po +1542 -1542
- package/src/locales/po/es.po +1542 -1542
- package/src/locales/po/fi.po +1542 -1542
- package/src/locales/po/fr.po +1542 -1542
- package/src/locales/po/hr.po +1542 -1542
- package/src/locales/po/hu.po +1542 -1542
- package/src/locales/po/it.po +1542 -1542
- package/src/locales/po/lt.po +1542 -1542
- package/src/locales/po/lv.po +1542 -1542
- package/src/locales/po/mt.po +1542 -1542
- package/src/locales/po/nl.po +1542 -1542
- package/src/locales/po/pl.po +1542 -1542
- package/src/locales/po/pt.po +1542 -1542
- package/src/locales/po/ro.po +1542 -1542
- package/src/locales/po/se.po +1542 -1542
- package/src/locales/po/si.po +1542 -1542
- package/src/locales/po/sk.po +1542 -1542
- package/src/main.ts +16 -13
- package/src/validValues/country.ts +7 -148
- package/src/validValues/designation.ts +0 -5
- package/src/validValues/subregion.ts +1 -1387
- package/src/validValues/types/ValidValueDefinition.ts +1 -1
- package/dist/validValues/types/Country.js +0 -5
- package/src/validValues/types/Country.ts +0 -39
|
@@ -11,7 +11,7 @@ export interface ValidValueDefinition {
|
|
|
11
11
|
*
|
|
12
12
|
* Define it using `defineMessage()` from @lingui/macro.
|
|
13
13
|
*/
|
|
14
|
-
title
|
|
14
|
+
title: string | MessageDescriptor;
|
|
15
15
|
/**
|
|
16
16
|
* Fields that will never be stored in the database,
|
|
17
17
|
* because they are not relevant to the frontend rendering.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidValueDefinition.d.ts","sourceRoot":"","sources":["../../../src/validValues/types/ValidValueDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACpC;;;;OAIG;IACH,KAAK,
|
|
1
|
+
{"version":3,"file":"ValidValueDefinition.d.ts","sourceRoot":"","sources":["../../../src/validValues/types/ValidValueDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACpC;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAC;IAClC;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAKN,CAAC;IACF;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,EAAE,CAAC;CACf"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@bottlebooks/valid-values",
|
|
3
3
|
"description": "The Bottlebooks lookup values, defined globally.",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.1",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"scripts": {
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"@babel/core": "^7.15.5",
|
|
33
33
|
"@lingui/core": "^3.14.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "fc6e66bcc86624d21020629f89b961862bbb7f4f"
|
|
36
36
|
}
|
package/src/core/translate.ts
CHANGED
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
import { i18n, MessageDescriptor } from '@lingui/core';
|
|
2
2
|
|
|
3
|
-
export function translate(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export function translate(title: MessageDescriptor | string, locale?: string) {
|
|
4
|
+
// if (typeof title === 'string') {
|
|
5
|
+
// return title;
|
|
6
|
+
// }
|
|
7
|
+
const messageId = typeof title === 'string' ? title : title?.id;
|
|
8
|
+
if (!messageId) {
|
|
9
|
+
console.log(
|
|
10
|
+
'%c' + `ERROR: messageId_missing:${JSON.stringify(title)}`,
|
|
11
|
+
'color: #d0011b;'
|
|
12
|
+
);
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!locale) {
|
|
17
|
+
locale = 'en';
|
|
18
|
+
}
|
|
19
|
+
// else {
|
|
20
|
+
// i18n.activate('en');
|
|
21
|
+
// }
|
|
22
|
+
i18n.activate(locale);
|
|
23
|
+
|
|
24
|
+
let translation = i18n._(messageId);
|
|
25
|
+
if (translation === messageId) {
|
|
26
|
+
if (messageId.includes('validValues.')) {
|
|
7
27
|
console.log(
|
|
8
|
-
'%c' + `
|
|
28
|
+
'%c' + `ERROR: translation_missing:${messageId}:${locale}`,
|
|
9
29
|
'color: #d0011b;'
|
|
10
30
|
);
|
|
11
|
-
|
|
12
|
-
return i18n._(message) || '';
|
|
31
|
+
return '';
|
|
13
32
|
}
|
|
14
|
-
|
|
33
|
+
console.log(
|
|
34
|
+
'%c' + `WARNING: translation==messageId:${messageId}:${locale}`,
|
|
35
|
+
'color: #d0011b;'
|
|
36
|
+
);
|
|
15
37
|
}
|
|
16
|
-
|
|
38
|
+
|
|
39
|
+
return translation;
|
|
40
|
+
}
|