@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.1](https://github.com/bottlebooks/bottlebooks/compare/@bottlebooks/valid-values@1.2.0...@bottlebooks/valid-values@1.2.1) (2022-11-23)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- valid-values translate logic ([8aa9b48](https://github.com/bottlebooks/bottlebooks/commit/8aa9b486193f6bdc9711e92a81373069fa7016e6))
|
|
11
|
+
|
|
6
12
|
# [1.2.0](https://github.com/bottlebooks/bottlebooks/compare/@bottlebooks/valid-values@1.1.0...@bottlebooks/valid-values@1.2.0) (2022-11-23)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/dist/core/translate.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MessageDescriptor } from '@lingui/core';
|
|
2
|
-
export declare function translate(
|
|
2
|
+
export declare function translate(title: MessageDescriptor | string, locale?: string): string;
|
|
3
3
|
//# sourceMappingURL=translate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/core/translate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEvD,wBAAgB,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/core/translate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,UAqC3E"}
|
package/dist/core/translate.js
CHANGED
|
@@ -7,17 +7,35 @@ exports.translate = translate;
|
|
|
7
7
|
|
|
8
8
|
var _core = require("@lingui/core");
|
|
9
9
|
|
|
10
|
-
function translate(
|
|
11
|
-
|
|
10
|
+
function translate(title, locale) {
|
|
11
|
+
// if (typeof title === 'string') {
|
|
12
|
+
// return title;
|
|
13
|
+
// }
|
|
14
|
+
var messageId = typeof title === 'string' ? title : title === null || title === void 0 ? void 0 : title.id;
|
|
15
|
+
|
|
16
|
+
if (!messageId) {
|
|
17
|
+
console.log('%c' + "ERROR: messageId_missing:".concat(JSON.stringify(title)), 'color: #d0011b;');
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!locale) {
|
|
22
|
+
locale = 'en';
|
|
23
|
+
} // else {
|
|
24
|
+
// i18n.activate('en');
|
|
25
|
+
// }
|
|
12
26
|
|
|
13
|
-
var translation = _core.i18n._(message);
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
_core.i18n.activate(locale);
|
|
29
|
+
|
|
30
|
+
var translation = _core.i18n._(messageId);
|
|
17
31
|
|
|
18
|
-
|
|
32
|
+
if (translation === messageId) {
|
|
33
|
+
if (messageId.includes('validValues.')) {
|
|
34
|
+
console.log('%c' + "ERROR: translation_missing:".concat(messageId, ":").concat(locale), 'color: #d0011b;');
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
19
37
|
|
|
20
|
-
|
|
38
|
+
console.log('%c' + "WARNING: translation==messageId:".concat(messageId, ":").concat(locale), 'color: #d0011b;');
|
|
21
39
|
}
|
|
22
40
|
|
|
23
41
|
return translation;
|
package/dist/main.js
CHANGED
|
@@ -32,27 +32,27 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
32
32
|
|
|
33
33
|
document.querySelector('#app').innerHTML = "\n <div>\n <h1>ValidValues</h1>\n ".concat(Object.entries(validValues).map(function (_ref) {
|
|
34
34
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
35
|
-
|
|
35
|
+
validValueCategory = _ref2[0],
|
|
36
36
|
values = _ref2[1];
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return "<h2>".concat(
|
|
38
|
+
var list = values.list;
|
|
39
|
+
var content = "<h2>".concat(validValueCategory, "</h2>"); // if (['designation'].includes(validValueCategory)) {
|
|
40
|
+
// return '';
|
|
41
|
+
// }
|
|
42
|
+
|
|
43
|
+
return "".concat(content, "\n <pre>").concat(list.map(function (item, i) {
|
|
44
|
+
var key = item.key,
|
|
45
|
+
title = item.title,
|
|
46
|
+
form = item.form; // const message = { id: item.id } as MessageDescriptor;
|
|
47
|
+
|
|
48
|
+
return i === 0 ? JSON.stringify(_objectSpread(_objectSpread({
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
id: item.id,
|
|
51
|
+
'title(en)': (0, _translate.translate)(title, 'en'),
|
|
52
|
+
'title(de)': (0, _translate.translate)(title, 'de')
|
|
53
|
+
}, item), {}, {
|
|
54
|
+
form: item.form ? item.form && _objectSpread({}, item.form) : null
|
|
55
|
+
}), undefined, 2) : '';
|
|
56
|
+
}), "</pre>\n ");
|
|
57
|
+
return "<h2>".concat(validValueCategory, "</h2>\n <pre>").concat(JSON.stringify(values, undefined, 2), "</pre>\n ");
|
|
58
58
|
}).join(''), "</pre></code>\n </div>\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country.d.ts","sourceRoot":"","sources":["../../src/validValues/country.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"country.d.ts","sourceRoot":"","sources":["../../src/validValues/country.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;;;;;;;;;;;;;;;;;;;AAED,wBA6pDG"}
|