@strapi/i18n 0.0.0-experimental.25f7de53c1fc990bbb86d4aa43c379acfa838064 → 0.0.0-experimental.281d87ac79eeddcaa1823767b9a4c9dbd5d6192d
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/admin/index.js +0 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +0 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js +34 -24
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -1
- package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +34 -24
- package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -1
- package/dist/admin/src/utils/schemas.d.ts +642 -16
- package/dist/admin/utils/fields.js +6 -1
- package/dist/admin/utils/fields.js.map +1 -1
- package/dist/admin/utils/fields.mjs +6 -1
- package/dist/admin/utils/fields.mjs.map +1 -1
- package/dist/admin/utils/schemas.js +19 -13
- package/dist/admin/utils/schemas.js.map +1 -1
- package/dist/admin/utils/schemas.mjs +19 -13
- package/dist/admin/utils/schemas.mjs.map +1 -1
- package/package.json +8 -8
@@ -1,5 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
var has = require('lodash/has');
|
4
|
+
|
3
5
|
const LOCALIZED_FIELDS = [
|
4
6
|
'biginteger',
|
5
7
|
'boolean',
|
@@ -22,7 +24,10 @@ const LOCALIZED_FIELDS = [
|
|
22
24
|
'text',
|
23
25
|
'time'
|
24
26
|
];
|
25
|
-
const doesPluginOptionsHaveI18nLocalized = (opts)=>
|
27
|
+
const doesPluginOptionsHaveI18nLocalized = (opts)=>has(opts, [
|
28
|
+
'i18n',
|
29
|
+
'localized'
|
30
|
+
]);
|
26
31
|
|
27
32
|
exports.LOCALIZED_FIELDS = LOCALIZED_FIELDS;
|
28
33
|
exports.doesPluginOptionsHaveI18nLocalized = doesPluginOptionsHaveI18nLocalized;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"file":"fields.js","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["import has from 'lodash/has';\n\nconst LOCALIZED_FIELDS = [\n 'biginteger',\n 'boolean',\n 'component',\n 'date',\n 'datetime',\n 'decimal',\n 'dynamiczone',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'media',\n 'number',\n 'password',\n 'richtext',\n 'blocks',\n 'string',\n 'text',\n 'time',\n];\n\nconst doesPluginOptionsHaveI18nLocalized = (\n opts?: object\n): opts is { i18n: { localized: boolean } } => has(opts, ['i18n', 'localized']);\n\nexport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };\n"],"names":["LOCALIZED_FIELDS","doesPluginOptionsHaveI18nLocalized","opts","has"],"mappings":";;;;AAEA,MAAMA,gBAAmB,GAAA;AACvB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD;AAED,MAAMC,kCAAqC,GAAA,CACzCC,IAC6CC,GAAAA,GAAAA,CAAID,IAAM,EAAA;AAAC,QAAA,MAAA;AAAQ,QAAA;AAAY,KAAA;;;;;"}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import has from 'lodash/has';
|
2
|
+
|
1
3
|
const LOCALIZED_FIELDS = [
|
2
4
|
'biginteger',
|
3
5
|
'boolean',
|
@@ -20,7 +22,10 @@ const LOCALIZED_FIELDS = [
|
|
20
22
|
'text',
|
21
23
|
'time'
|
22
24
|
];
|
23
|
-
const doesPluginOptionsHaveI18nLocalized = (opts)=>
|
25
|
+
const doesPluginOptionsHaveI18nLocalized = (opts)=>has(opts, [
|
26
|
+
'i18n',
|
27
|
+
'localized'
|
28
|
+
]);
|
24
29
|
|
25
30
|
export { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };
|
26
31
|
//# sourceMappingURL=fields.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.mjs","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"file":"fields.mjs","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["import has from 'lodash/has';\n\nconst LOCALIZED_FIELDS = [\n 'biginteger',\n 'boolean',\n 'component',\n 'date',\n 'datetime',\n 'decimal',\n 'dynamiczone',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'media',\n 'number',\n 'password',\n 'richtext',\n 'blocks',\n 'string',\n 'text',\n 'time',\n];\n\nconst doesPluginOptionsHaveI18nLocalized = (\n opts?: object\n): opts is { i18n: { localized: boolean } } => has(opts, ['i18n', 'localized']);\n\nexport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };\n"],"names":["LOCALIZED_FIELDS","doesPluginOptionsHaveI18nLocalized","opts","has"],"mappings":";;AAEA,MAAMA,gBAAmB,GAAA;AACvB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD;AAED,MAAMC,kCAAqC,GAAA,CACzCC,IAC6CC,GAAAA,GAAAA,CAAID,IAAM,EAAA;AAAC,QAAA,MAAA;AAAQ,QAAA;AAAY,KAAA;;;;"}
|
@@ -5,13 +5,17 @@ var fields = require('./fields.js');
|
|
5
5
|
|
6
6
|
/* -------------------------------------------------------------------------------------------------
|
7
7
|
* mutateCTBContentTypeSchema
|
8
|
-
* -----------------------------------------------------------------------------------------------*/
|
8
|
+
* -----------------------------------------------------------------------------------------------*/ // TODO: refactor for CTB refactors
|
9
|
+
const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
|
10
|
+
if (!prevSchema) {
|
11
|
+
return nextSchema;
|
12
|
+
}
|
9
13
|
// Don't perform mutations components
|
10
14
|
if (!fields.doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {
|
11
15
|
return nextSchema;
|
12
16
|
}
|
13
17
|
const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;
|
14
|
-
const isPrevSchemaLocalized = fields.doesPluginOptionsHaveI18nLocalized(prevSchema?.
|
18
|
+
const isPrevSchemaLocalized = fields.doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions) ? prevSchema?.pluginOptions.i18n.localized : false;
|
15
19
|
// No need to perform modification on the schema, if the i18n feature was not changed
|
16
20
|
// at the ct level
|
17
21
|
if (isNextSchemaLocalized && isPrevSchemaLocalized) {
|
@@ -38,8 +42,8 @@ var fields = require('./fields.js');
|
|
38
42
|
};
|
39
43
|
/* -------------------------------------------------------------------------------------------------
|
40
44
|
* addLocalisationToFields
|
41
|
-
* -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>
|
42
|
-
|
45
|
+
* -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>{
|
46
|
+
return attributes.map((currentAttribute)=>{
|
43
47
|
if (fields.LOCALIZED_FIELDS.includes(currentAttribute.type)) {
|
44
48
|
const i18n = {
|
45
49
|
localized: true
|
@@ -50,19 +54,21 @@ var fields = require('./fields.js');
|
|
50
54
|
} : {
|
51
55
|
i18n
|
52
56
|
};
|
53
|
-
|
57
|
+
return {
|
54
58
|
...currentAttribute,
|
55
59
|
pluginOptions
|
56
60
|
};
|
57
|
-
return acc;
|
58
61
|
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
return currentAttribute;
|
63
|
+
});
|
64
|
+
};
|
65
|
+
/* -------------------------------------------------------------------------------------------------
|
66
|
+
* disableAttributesLocalisation
|
67
|
+
* -----------------------------------------------------------------------------------------------*/ const disableAttributesLocalisation = (attributes)=>{
|
68
|
+
return attributes.map((currentAttribute)=>{
|
69
|
+
return omit(currentAttribute, 'pluginOptions.i18n');
|
70
|
+
});
|
71
|
+
};
|
66
72
|
|
67
73
|
exports.mutateCTBContentTypeSchema = mutateCTBContentTypeSchema;
|
68
74
|
//# sourceMappingURL=schemas.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schemas.js","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\nconst mutateCTBContentTypeSchema = (\n nextSchema: Schema.ContentType,\n prevSchema?: {\n
|
1
|
+
{"version":3,"file":"schemas.js","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\n// TODO: refactor for CTB refactors\nconst mutateCTBContentTypeSchema = (\n nextSchema: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n },\n prevSchema?: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n }\n) => {\n if (!prevSchema) {\n return nextSchema;\n }\n\n // Don't perform mutations components\n if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {\n return nextSchema;\n }\n\n const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;\n const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions)\n ? prevSchema?.pluginOptions.i18n.localized\n : false;\n\n // No need to perform modification on the schema, if the i18n feature was not changed\n // at the ct level\n if (isNextSchemaLocalized && isPrevSchemaLocalized) {\n return nextSchema;\n }\n\n if (isNextSchemaLocalized) {\n const attributes = addLocalisationToFields(nextSchema.attributes);\n\n return {\n ...nextSchema,\n attributes,\n };\n }\n\n // Remove the i18n object from the pluginOptions\n if (!isNextSchemaLocalized) {\n const pluginOptions = omit(nextSchema.pluginOptions, 'i18n');\n const attributes = disableAttributesLocalisation(nextSchema.attributes);\n\n return {\n ...nextSchema,\n pluginOptions,\n attributes,\n };\n }\n\n return nextSchema;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * addLocalisationToFields\n * -----------------------------------------------------------------------------------------------*/\n\nconst addLocalisationToFields = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {\n const i18n = { localized: true };\n\n const pluginOptions = currentAttribute.pluginOptions\n ? { ...currentAttribute.pluginOptions, i18n }\n : { i18n };\n\n return { ...currentAttribute, pluginOptions };\n }\n\n return currentAttribute;\n });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * disableAttributesLocalisation\n * -----------------------------------------------------------------------------------------------*/\n\nconst disableAttributesLocalisation = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n return omit(currentAttribute, 'pluginOptions.i18n');\n });\n};\n\nexport { mutateCTBContentTypeSchema };\n"],"names":["mutateCTBContentTypeSchema","nextSchema","prevSchema","doesPluginOptionsHaveI18nLocalized","pluginOptions","isNextSchemaLocalized","i18n","localized","isPrevSchemaLocalized","attributes","addLocalisationToFields","omit","disableAttributesLocalisation","map","currentAttribute","LOCALIZED_FIELDS","includes","type"],"mappings":";;;;;AAMA;;AAEkG;AAG5FA,MAAAA,0BAAAA,GAA6B,CACjCC,UAKAC,EAAAA,UAAAA,GAAAA;AAMA,IAAA,IAAI,CAACA,UAAY,EAAA;QACf,OAAOD,UAAAA;AACT;;AAGA,IAAA,IAAI,CAACE,yCAAAA,CAAmCF,UAAWG,CAAAA,aAAa,CAAG,EAAA;QACjE,OAAOH,UAAAA;AACT;AAEA,IAAA,MAAMI,wBAAwBJ,UAAWG,CAAAA,aAAa,CAACE,IAAI,CAACC,SAAS;AACrE,IAAA,MAAMC,wBAAwBL,yCAAmCD,CAAAA,UAAAA,EAAYE,iBACzEF,UAAYE,EAAAA,aAAAA,CAAcE,KAAKC,SAC/B,GAAA,KAAA;;;AAIJ,IAAA,IAAIF,yBAAyBG,qBAAuB,EAAA;QAClD,OAAOP,UAAAA;AACT;AAEA,IAAA,IAAII,qBAAuB,EAAA;QACzB,MAAMI,UAAAA,GAAaC,uBAAwBT,CAAAA,UAAAA,CAAWQ,UAAU,CAAA;QAEhE,OAAO;AACL,YAAA,GAAGR,UAAU;AACbQ,YAAAA;AACF,SAAA;AACF;;AAGA,IAAA,IAAI,CAACJ,qBAAuB,EAAA;AAC1B,QAAA,MAAMD,aAAgBO,GAAAA,IAAAA,CAAKV,UAAWG,CAAAA,aAAa,EAAE,MAAA,CAAA;QACrD,MAAMK,UAAAA,GAAaG,6BAA8BX,CAAAA,UAAAA,CAAWQ,UAAU,CAAA;QAEtE,OAAO;AACL,YAAA,GAAGR,UAAU;AACbG,YAAAA,aAAAA;AACAK,YAAAA;AACF,SAAA;AACF;IAEA,OAAOR,UAAAA;AACT;AAEA;;qGAIA,MAAMS,0BAA0B,CAACD,UAAAA,GAAAA;IAC/B,OAAOA,UAAAA,CAAWI,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,IAAIC,uBAAiBC,CAAAA,QAAQ,CAACF,gBAAAA,CAAiBG,IAAI,CAAG,EAAA;AACpD,YAAA,MAAMX,IAAO,GAAA;gBAAEC,SAAW,EAAA;AAAK,aAAA;YAE/B,MAAMH,aAAAA,GAAgBU,gBAAiBV,CAAAA,aAAa,GAChD;AAAE,gBAAA,GAAGU,iBAAiBV,aAAa;AAAEE,gBAAAA;aACrC,GAAA;AAAEA,gBAAAA;AAAK,aAAA;YAEX,OAAO;AAAE,gBAAA,GAAGQ,gBAAgB;AAAEV,gBAAAA;AAAc,aAAA;AAC9C;QAEA,OAAOU,gBAAAA;AACT,KAAA,CAAA;AACF,CAAA;AAEA;;qGAIA,MAAMF,gCAAgC,CAACH,UAAAA,GAAAA;IACrC,OAAOA,UAAAA,CAAWI,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,OAAOH,KAAKG,gBAAkB,EAAA,oBAAA,CAAA;AAChC,KAAA,CAAA;AACF,CAAA;;;;"}
|
@@ -3,13 +3,17 @@ import { doesPluginOptionsHaveI18nLocalized, LOCALIZED_FIELDS } from './fields.m
|
|
3
3
|
|
4
4
|
/* -------------------------------------------------------------------------------------------------
|
5
5
|
* mutateCTBContentTypeSchema
|
6
|
-
* -----------------------------------------------------------------------------------------------*/
|
6
|
+
* -----------------------------------------------------------------------------------------------*/ // TODO: refactor for CTB refactors
|
7
|
+
const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
|
8
|
+
if (!prevSchema) {
|
9
|
+
return nextSchema;
|
10
|
+
}
|
7
11
|
// Don't perform mutations components
|
8
12
|
if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {
|
9
13
|
return nextSchema;
|
10
14
|
}
|
11
15
|
const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;
|
12
|
-
const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.
|
16
|
+
const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions) ? prevSchema?.pluginOptions.i18n.localized : false;
|
13
17
|
// No need to perform modification on the schema, if the i18n feature was not changed
|
14
18
|
// at the ct level
|
15
19
|
if (isNextSchemaLocalized && isPrevSchemaLocalized) {
|
@@ -36,8 +40,8 @@ import { doesPluginOptionsHaveI18nLocalized, LOCALIZED_FIELDS } from './fields.m
|
|
36
40
|
};
|
37
41
|
/* -------------------------------------------------------------------------------------------------
|
38
42
|
* addLocalisationToFields
|
39
|
-
* -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>
|
40
|
-
|
43
|
+
* -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>{
|
44
|
+
return attributes.map((currentAttribute)=>{
|
41
45
|
if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {
|
42
46
|
const i18n = {
|
43
47
|
localized: true
|
@@ -48,19 +52,21 @@ import { doesPluginOptionsHaveI18nLocalized, LOCALIZED_FIELDS } from './fields.m
|
|
48
52
|
} : {
|
49
53
|
i18n
|
50
54
|
};
|
51
|
-
|
55
|
+
return {
|
52
56
|
...currentAttribute,
|
53
57
|
pluginOptions
|
54
58
|
};
|
55
|
-
return acc;
|
56
59
|
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
return currentAttribute;
|
61
|
+
});
|
62
|
+
};
|
63
|
+
/* -------------------------------------------------------------------------------------------------
|
64
|
+
* disableAttributesLocalisation
|
65
|
+
* -----------------------------------------------------------------------------------------------*/ const disableAttributesLocalisation = (attributes)=>{
|
66
|
+
return attributes.map((currentAttribute)=>{
|
67
|
+
return omit(currentAttribute, 'pluginOptions.i18n');
|
68
|
+
});
|
69
|
+
};
|
64
70
|
|
65
71
|
export { mutateCTBContentTypeSchema };
|
66
72
|
//# sourceMappingURL=schemas.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schemas.mjs","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\nconst mutateCTBContentTypeSchema = (\n nextSchema: Schema.ContentType,\n prevSchema?: {\n
|
1
|
+
{"version":3,"file":"schemas.mjs","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\n// TODO: refactor for CTB refactors\nconst mutateCTBContentTypeSchema = (\n nextSchema: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n },\n prevSchema?: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n }\n) => {\n if (!prevSchema) {\n return nextSchema;\n }\n\n // Don't perform mutations components\n if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {\n return nextSchema;\n }\n\n const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;\n const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions)\n ? prevSchema?.pluginOptions.i18n.localized\n : false;\n\n // No need to perform modification on the schema, if the i18n feature was not changed\n // at the ct level\n if (isNextSchemaLocalized && isPrevSchemaLocalized) {\n return nextSchema;\n }\n\n if (isNextSchemaLocalized) {\n const attributes = addLocalisationToFields(nextSchema.attributes);\n\n return {\n ...nextSchema,\n attributes,\n };\n }\n\n // Remove the i18n object from the pluginOptions\n if (!isNextSchemaLocalized) {\n const pluginOptions = omit(nextSchema.pluginOptions, 'i18n');\n const attributes = disableAttributesLocalisation(nextSchema.attributes);\n\n return {\n ...nextSchema,\n pluginOptions,\n attributes,\n };\n }\n\n return nextSchema;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * addLocalisationToFields\n * -----------------------------------------------------------------------------------------------*/\n\nconst addLocalisationToFields = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {\n const i18n = { localized: true };\n\n const pluginOptions = currentAttribute.pluginOptions\n ? { ...currentAttribute.pluginOptions, i18n }\n : { i18n };\n\n return { ...currentAttribute, pluginOptions };\n }\n\n return currentAttribute;\n });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * disableAttributesLocalisation\n * -----------------------------------------------------------------------------------------------*/\n\nconst disableAttributesLocalisation = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n return omit(currentAttribute, 'pluginOptions.i18n');\n });\n};\n\nexport { mutateCTBContentTypeSchema };\n"],"names":["mutateCTBContentTypeSchema","nextSchema","prevSchema","doesPluginOptionsHaveI18nLocalized","pluginOptions","isNextSchemaLocalized","i18n","localized","isPrevSchemaLocalized","attributes","addLocalisationToFields","omit","disableAttributesLocalisation","map","currentAttribute","LOCALIZED_FIELDS","includes","type"],"mappings":";;;AAMA;;AAEkG;AAG5FA,MAAAA,0BAAAA,GAA6B,CACjCC,UAKAC,EAAAA,UAAAA,GAAAA;AAMA,IAAA,IAAI,CAACA,UAAY,EAAA;QACf,OAAOD,UAAAA;AACT;;AAGA,IAAA,IAAI,CAACE,kCAAAA,CAAmCF,UAAWG,CAAAA,aAAa,CAAG,EAAA;QACjE,OAAOH,UAAAA;AACT;AAEA,IAAA,MAAMI,wBAAwBJ,UAAWG,CAAAA,aAAa,CAACE,IAAI,CAACC,SAAS;AACrE,IAAA,MAAMC,wBAAwBL,kCAAmCD,CAAAA,UAAAA,EAAYE,iBACzEF,UAAYE,EAAAA,aAAAA,CAAcE,KAAKC,SAC/B,GAAA,KAAA;;;AAIJ,IAAA,IAAIF,yBAAyBG,qBAAuB,EAAA;QAClD,OAAOP,UAAAA;AACT;AAEA,IAAA,IAAII,qBAAuB,EAAA;QACzB,MAAMI,UAAAA,GAAaC,uBAAwBT,CAAAA,UAAAA,CAAWQ,UAAU,CAAA;QAEhE,OAAO;AACL,YAAA,GAAGR,UAAU;AACbQ,YAAAA;AACF,SAAA;AACF;;AAGA,IAAA,IAAI,CAACJ,qBAAuB,EAAA;AAC1B,QAAA,MAAMD,aAAgBO,GAAAA,IAAAA,CAAKV,UAAWG,CAAAA,aAAa,EAAE,MAAA,CAAA;QACrD,MAAMK,UAAAA,GAAaG,6BAA8BX,CAAAA,UAAAA,CAAWQ,UAAU,CAAA;QAEtE,OAAO;AACL,YAAA,GAAGR,UAAU;AACbG,YAAAA,aAAAA;AACAK,YAAAA;AACF,SAAA;AACF;IAEA,OAAOR,UAAAA;AACT;AAEA;;qGAIA,MAAMS,0BAA0B,CAACD,UAAAA,GAAAA;IAC/B,OAAOA,UAAAA,CAAWI,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,IAAIC,gBAAiBC,CAAAA,QAAQ,CAACF,gBAAAA,CAAiBG,IAAI,CAAG,EAAA;AACpD,YAAA,MAAMX,IAAO,GAAA;gBAAEC,SAAW,EAAA;AAAK,aAAA;YAE/B,MAAMH,aAAAA,GAAgBU,gBAAiBV,CAAAA,aAAa,GAChD;AAAE,gBAAA,GAAGU,iBAAiBV,aAAa;AAAEE,gBAAAA;aACrC,GAAA;AAAEA,gBAAAA;AAAK,aAAA;YAEX,OAAO;AAAE,gBAAA,GAAGQ,gBAAgB;AAAEV,gBAAAA;AAAc,aAAA;AAC9C;QAEA,OAAOU,gBAAAA;AACT,KAAA,CAAA;AACF,CAAA;AAEA;;qGAIA,MAAMF,gCAAgC,CAACH,UAAAA,GAAAA;IACrC,OAAOA,UAAAA,CAAWI,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,OAAOH,KAAKG,gBAAkB,EAAA,oBAAA,CAAA;AAChC,KAAA,CAAA;AACF,CAAA;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@strapi/i18n",
|
3
|
-
"version": "0.0.0-experimental.
|
3
|
+
"version": "0.0.0-experimental.281d87ac79eeddcaa1823767b9a4c9dbd5d6192d",
|
4
4
|
"description": "Create read and update content in different languages, both from the Admin Panel and from the API",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -57,9 +57,9 @@
|
|
57
57
|
},
|
58
58
|
"dependencies": {
|
59
59
|
"@reduxjs/toolkit": "1.9.7",
|
60
|
-
"@strapi/design-system": "2.0.0-rc.
|
61
|
-
"@strapi/icons": "2.0.0-rc.
|
62
|
-
"@strapi/utils": "0.0.0-experimental.
|
60
|
+
"@strapi/design-system": "2.0.0-rc.27",
|
61
|
+
"@strapi/icons": "2.0.0-rc.27",
|
62
|
+
"@strapi/utils": "0.0.0-experimental.281d87ac79eeddcaa1823767b9a4c9dbd5d6192d",
|
63
63
|
"lodash": "4.17.21",
|
64
64
|
"qs": "6.11.1",
|
65
65
|
"react-intl": "6.6.2",
|
@@ -67,10 +67,10 @@
|
|
67
67
|
"yup": "0.32.9"
|
68
68
|
},
|
69
69
|
"devDependencies": {
|
70
|
-
"@strapi/admin": "0.0.0-experimental.
|
71
|
-
"@strapi/admin-test-utils": "0.0.0-experimental.
|
72
|
-
"@strapi/content-manager": "0.0.0-experimental.
|
73
|
-
"@strapi/types": "0.0.0-experimental.
|
70
|
+
"@strapi/admin": "0.0.0-experimental.281d87ac79eeddcaa1823767b9a4c9dbd5d6192d",
|
71
|
+
"@strapi/admin-test-utils": "0.0.0-experimental.281d87ac79eeddcaa1823767b9a4c9dbd5d6192d",
|
72
|
+
"@strapi/content-manager": "0.0.0-experimental.281d87ac79eeddcaa1823767b9a4c9dbd5d6192d",
|
73
|
+
"@strapi/types": "0.0.0-experimental.281d87ac79eeddcaa1823767b9a4c9dbd5d6192d",
|
74
74
|
"@testing-library/react": "15.0.7",
|
75
75
|
"@testing-library/user-event": "14.5.2",
|
76
76
|
"msw": "1.3.0",
|