@strapi/i18n 0.0.0-next.8f0cdd4f9e4697ffed86c783465297fe532713f8 → 0.0.0-next.913e7071c9410ff8af2e776e25f9fb1c38cb59dd
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/components/CMHeaderActions.js +116 -1
- package/dist/admin/components/CMHeaderActions.js.map +1 -1
- package/dist/admin/components/CMHeaderActions.mjs +119 -5
- package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
- package/dist/admin/components/CreateLocale.js +1 -1
- package/dist/admin/components/CreateLocale.js.map +1 -1
- package/dist/admin/components/CreateLocale.mjs +1 -1
- package/dist/admin/components/CreateLocale.mjs.map +1 -1
- package/dist/admin/components/EditLocale.js +1 -1
- package/dist/admin/components/EditLocale.js.map +1 -1
- package/dist/admin/components/EditLocale.mjs +1 -1
- package/dist/admin/components/EditLocale.mjs.map +1 -1
- package/dist/admin/components/LocaleListCell.js +65 -45
- package/dist/admin/components/LocaleListCell.js.map +1 -1
- package/dist/admin/components/LocaleListCell.mjs +66 -46
- package/dist/admin/components/LocaleListCell.mjs.map +1 -1
- package/dist/admin/components/LocalePicker.js +18 -11
- package/dist/admin/components/LocalePicker.js.map +1 -1
- package/dist/admin/components/LocalePicker.mjs +19 -12
- package/dist/admin/components/LocalePicker.mjs.map +1 -1
- package/dist/admin/contentManagerHooks/editView.js +6 -3
- package/dist/admin/contentManagerHooks/editView.js.map +1 -1
- package/dist/admin/contentManagerHooks/editView.mjs +7 -4
- package/dist/admin/contentManagerHooks/editView.mjs.map +1 -1
- package/dist/admin/contentManagerHooks/listView.js +2 -1
- package/dist/admin/contentManagerHooks/listView.js.map +1 -1
- package/dist/admin/contentManagerHooks/listView.mjs +2 -1
- package/dist/admin/contentManagerHooks/listView.mjs.map +1 -1
- package/dist/admin/index.js +1 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/pages/SettingsPage.js +121 -46
- package/dist/admin/pages/SettingsPage.js.map +1 -1
- package/dist/admin/pages/SettingsPage.mjs +124 -30
- package/dist/admin/pages/SettingsPage.mjs.map +1 -1
- package/dist/admin/services/api.js +3 -1
- package/dist/admin/services/api.js.map +1 -1
- package/dist/admin/services/api.mjs +3 -1
- package/dist/admin/services/api.mjs.map +1 -1
- package/dist/admin/services/locales.js +4 -2
- package/dist/admin/services/locales.js.map +1 -1
- package/dist/admin/services/locales.mjs +4 -2
- package/dist/admin/services/locales.mjs.map +1 -1
- package/dist/admin/services/settings.js +29 -0
- package/dist/admin/services/settings.js.map +1 -0
- package/dist/admin/services/settings.mjs +26 -0
- package/dist/admin/services/settings.mjs.map +1 -0
- package/dist/admin/src/components/CMHeaderActions.d.ts +7 -1
- package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/locales.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +1 -1
- package/dist/admin/src/services/settings.d.ts +5 -0
- package/dist/admin/translations/en.json.js +7 -0
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +7 -0
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/utils/clean.js +2 -2
- package/dist/admin/utils/clean.js.map +1 -1
- package/dist/admin/utils/clean.mjs +2 -2
- package/dist/admin/utils/clean.mjs.map +1 -1
- package/dist/server/constants/iso-locales.json.js +4 -0
- package/dist/server/constants/iso-locales.json.js.map +1 -1
- package/dist/server/constants/iso-locales.json.mjs +4 -0
- package/dist/server/constants/iso-locales.json.mjs.map +1 -1
- package/dist/server/controllers/index.js +3 -1
- package/dist/server/controllers/index.js.map +1 -1
- package/dist/server/controllers/index.mjs +3 -1
- package/dist/server/controllers/index.mjs.map +1 -1
- package/dist/server/controllers/settings.js +24 -0
- package/dist/server/controllers/settings.js.map +1 -0
- package/dist/server/controllers/settings.mjs +22 -0
- package/dist/server/controllers/settings.mjs.map +1 -0
- package/dist/server/routes/admin.js +20 -0
- package/dist/server/routes/admin.js.map +1 -1
- package/dist/server/routes/admin.mjs +20 -0
- package/dist/server/routes/admin.mjs.map +1 -1
- package/dist/server/routes/content-api.js +11 -13
- package/dist/server/routes/content-api.js.map +1 -1
- package/dist/server/routes/content-api.mjs +11 -13
- package/dist/server/routes/content-api.mjs.map +1 -1
- package/dist/server/routes/index.mjs +2 -2
- package/dist/server/services/ai-localizations.js +143 -0
- package/dist/server/services/ai-localizations.js.map +1 -0
- package/dist/server/services/ai-localizations.mjs +141 -0
- package/dist/server/services/ai-localizations.mjs.map +1 -0
- package/dist/server/services/index.js +5 -1
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +5 -1
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/services/settings.js +25 -0
- package/dist/server/services/settings.js.map +1 -0
- package/dist/server/services/settings.mjs +23 -0
- package/dist/server/services/settings.mjs.map +1 -0
- package/dist/server/src/controllers/index.d.ts +4 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/settings.d.ts +7 -0
- package/dist/server/src/controllers/settings.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +27 -1
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/admin.d.ts.map +1 -1
- package/dist/server/src/routes/content-api.d.ts +5 -2
- package/dist/server/src/routes/content-api.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +4 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/ai-localizations.d.ts +17 -0
- package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +19 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts +13 -0
- package/dist/server/src/services/settings.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +5 -1
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/src/validation/settings.d.ts +12 -0
- package/dist/server/src/validation/settings.d.ts.map +1 -0
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/dist/server/validation/settings.js +11 -0
- package/dist/server/validation/settings.js.map +1 -0
- package/dist/server/validation/settings.mjs +9 -0
- package/dist/server/validation/settings.mjs.map +1 -0
- package/dist/shared/contracts/settings.d.ts +40 -0
- package/package.json +9 -8
|
@@ -1,19 +1,17 @@
|
|
|
1
|
+
import { createContentApiRoutesFactory } from '@strapi/utils';
|
|
1
2
|
import { I18nLocaleRouteValidator } from './validation/locale.mjs';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
const createContentApiRoutes = createContentApiRoutesFactory(()=>{
|
|
4
5
|
const validator = new I18nLocaleRouteValidator(strapi);
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
};
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
method: 'GET',
|
|
9
|
+
path: '/locales',
|
|
10
|
+
handler: 'locales.listLocales',
|
|
11
|
+
response: validator.locales
|
|
12
|
+
}
|
|
13
|
+
];
|
|
16
14
|
});
|
|
17
15
|
|
|
18
|
-
export {
|
|
16
|
+
export { createContentApiRoutes as default };
|
|
19
17
|
//# sourceMappingURL=content-api.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-api.mjs","sources":["../../../server/src/routes/content-api.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { I18nLocaleRouteValidator } from './validation';\n\
|
|
1
|
+
{"version":3,"file":"content-api.mjs","sources":["../../../server/src/routes/content-api.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { createContentApiRoutesFactory } from '@strapi/utils';\nimport { I18nLocaleRouteValidator } from './validation';\n\nconst createContentApiRoutes = createContentApiRoutesFactory((): Core.RouterInput['routes'] => {\n const validator = new I18nLocaleRouteValidator(strapi);\n return [\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n response: validator.locales,\n },\n ];\n});\n\nexport default createContentApiRoutes;\n"],"names":["createContentApiRoutes","createContentApiRoutesFactory","validator","I18nLocaleRouteValidator","strapi","method","path","handler","response","locales"],"mappings":";;;AAIA,MAAMA,yBAAyBC,6BAA8B,CAAA,IAAA;IAC3D,MAAMC,SAAAA,GAAY,IAAIC,wBAAyBC,CAAAA,MAAAA,CAAAA;IAC/C,OAAO;AACL,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA,qBAAA;AACTC,YAAAA,QAAAA,EAAUN,UAAUO;AACtB;AACD,KAAA;AACH,CAAA;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import admin from './admin.mjs';
|
|
2
|
-
import
|
|
2
|
+
import createContentApiRoutes from './content-api.mjs';
|
|
3
3
|
|
|
4
4
|
var routes = {
|
|
5
5
|
admin,
|
|
6
|
-
'content-api':
|
|
6
|
+
'content-api': createContentApiRoutes
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { routes as default };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@strapi/utils');
|
|
4
|
+
var index = require('../utils/index.js');
|
|
5
|
+
|
|
6
|
+
const createAILocalizationsService = ({ strapi })=>{
|
|
7
|
+
// TODO: add a helper function to get the AI server URL
|
|
8
|
+
const aiServerUrl = process.env.STRAPI_AI_URL || 'https://strapi-ai.apps.strapi.io';
|
|
9
|
+
return {
|
|
10
|
+
// Async to avoid changing the signature later (there will be a db check in the future)
|
|
11
|
+
async isEnabled () {
|
|
12
|
+
// Check if future flag is enabled
|
|
13
|
+
const isFutureFlagEnabled = strapi.features.future.isEnabled('unstableAILocalizations');
|
|
14
|
+
if (!isFutureFlagEnabled) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
// Check if user disabled AI features globally
|
|
18
|
+
const isAIEnabled = strapi.config.get('admin.ai.enabled', true);
|
|
19
|
+
if (!isAIEnabled) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// Check if the user's license grants access to AI features
|
|
23
|
+
const hasAccess = strapi.ee.features.isEnabled('cms-ai');
|
|
24
|
+
if (!hasAccess) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Checks if there are localizations that need to be generated for the given document,
|
|
31
|
+
* and if so, calls the AI service and saves the results to the database.
|
|
32
|
+
* Works for both single and collection types, on create and update.
|
|
33
|
+
*/ async generateDocumentLocalizations ({ model, document }) {
|
|
34
|
+
const schema = strapi.getModel(model);
|
|
35
|
+
const localeService = index.getService('locales');
|
|
36
|
+
// No localizations needed for content types with i18n disabled
|
|
37
|
+
const isLocalizedContentType = index.getService('content-types').isLocalizedContentType(schema);
|
|
38
|
+
if (!isLocalizedContentType) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// Don't trigger localizations if the update is on a derived locale, only do it on the default
|
|
42
|
+
const defaultLocale = await localeService.getDefaultLocale();
|
|
43
|
+
if (document.locale !== defaultLocale) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const isFeatureEnabled = await this.isEnabled();
|
|
47
|
+
if (!isFeatureEnabled) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const documentId = document.documentId;
|
|
51
|
+
if (!documentId) {
|
|
52
|
+
strapi.log.warn(`AI Localizations: missing documentId for ${schema.uid}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Extract only the localized content from the document
|
|
56
|
+
const translateableContent = await utils.traverseEntity(({ key, attribute }, { remove })=>{
|
|
57
|
+
const hasLocalizedOption = attribute?.pluginOptions?.i18n?.localized === true;
|
|
58
|
+
// Only keep fields that actually need to be localized
|
|
59
|
+
// TODO: remove blocks from this list once the AI server can handle it reliably
|
|
60
|
+
if (!hasLocalizedOption || [
|
|
61
|
+
'media',
|
|
62
|
+
'blocks'
|
|
63
|
+
].includes(attribute.type)) {
|
|
64
|
+
remove(key);
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
schema,
|
|
68
|
+
getModel: strapi.getModel.bind(strapi)
|
|
69
|
+
}, document);
|
|
70
|
+
// Call the AI server to get the localized content
|
|
71
|
+
const localesList = await localeService.find();
|
|
72
|
+
const targetLocales = localesList.filter((l)=>l.code !== document.locale).map((l)=>l.code);
|
|
73
|
+
if (targetLocales.length === 0) {
|
|
74
|
+
strapi.log.info(`AI Localizations: no target locales for ${schema.uid} document ${documentId}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
let token;
|
|
78
|
+
try {
|
|
79
|
+
const tokenData = await strapi.service('admin::user').getAiToken();
|
|
80
|
+
token = tokenData.token;
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw new Error('Failed to retrieve AI token', {
|
|
83
|
+
cause: error instanceof Error ? error : undefined
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
strapi.log.http('Contacting AI Server for localizations generation');
|
|
87
|
+
const response = await fetch(`${aiServerUrl}/i18n/generate-localizations`, {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
headers: {
|
|
90
|
+
'Content-Type': 'application/json',
|
|
91
|
+
Authorization: `Bearer ${token}`
|
|
92
|
+
},
|
|
93
|
+
body: JSON.stringify({
|
|
94
|
+
content: translateableContent,
|
|
95
|
+
sourceLocale: document.locale,
|
|
96
|
+
targetLocales
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
strapi.log.error(`AI Localizations request failed: ${response.status} ${response.statusText}`);
|
|
101
|
+
throw new Error(`AI Localizations request failed: ${response.statusText}`);
|
|
102
|
+
}
|
|
103
|
+
const aiResult = await response.json();
|
|
104
|
+
// Get all media field names dynamically from the schema
|
|
105
|
+
const mediaFields = Object.entries(schema.attributes)// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
|
+
.filter(([_, attr])=>attr.type === 'media').map(([key])=>key);
|
|
107
|
+
try {
|
|
108
|
+
await Promise.allSettled(aiResult.localizations.map(async (localization)=>{
|
|
109
|
+
const { content, locale } = localization;
|
|
110
|
+
// Fetch the derived locale document
|
|
111
|
+
const derivedDoc = await strapi.documents(model).findOne({
|
|
112
|
+
documentId,
|
|
113
|
+
locale,
|
|
114
|
+
populate: mediaFields
|
|
115
|
+
});
|
|
116
|
+
// Merge AI content and media fields
|
|
117
|
+
const mergedData = {
|
|
118
|
+
...content
|
|
119
|
+
};
|
|
120
|
+
for (const field of mediaFields){
|
|
121
|
+
// Only copy media if not already set in derived locale
|
|
122
|
+
if (!derivedDoc || !derivedDoc[field]) {
|
|
123
|
+
mergedData[field] = document[field];
|
|
124
|
+
} else {
|
|
125
|
+
mergedData[field] = derivedDoc[field];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return strapi.documents(model).update({
|
|
129
|
+
documentId,
|
|
130
|
+
locale,
|
|
131
|
+
fields: [],
|
|
132
|
+
data: mergedData
|
|
133
|
+
});
|
|
134
|
+
}));
|
|
135
|
+
} catch (error) {
|
|
136
|
+
strapi.log.error('AI Localizations generation failed', error);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
exports.createAILocalizationsService = createAILocalizationsService;
|
|
143
|
+
//# sourceMappingURL=ai-localizations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-localizations.js","sources":["../../../server/src/services/ai-localizations.ts"],"sourcesContent":["import type { Core, Modules, UID } from '@strapi/types';\nimport { traverseEntity } from '@strapi/utils';\nimport { getService } from '../utils';\n\nconst createAILocalizationsService = ({ strapi }: { strapi: Core.Strapi }) => {\n // TODO: add a helper function to get the AI server URL\n const aiServerUrl = process.env.STRAPI_AI_URL || 'https://strapi-ai.apps.strapi.io';\n\n return {\n // Async to avoid changing the signature later (there will be a db check in the future)\n async isEnabled() {\n // Check if future flag is enabled\n const isFutureFlagEnabled = strapi.features.future.isEnabled('unstableAILocalizations');\n if (!isFutureFlagEnabled) {\n return false;\n }\n\n // Check if user disabled AI features globally\n const isAIEnabled = strapi.config.get('admin.ai.enabled', true);\n if (!isAIEnabled) {\n return false;\n }\n\n // Check if the user's license grants access to AI features\n const hasAccess = strapi.ee.features.isEnabled('cms-ai');\n if (!hasAccess) {\n return false;\n }\n\n return true;\n },\n\n /**\n * Checks if there are localizations that need to be generated for the given document,\n * and if so, calls the AI service and saves the results to the database.\n * Works for both single and collection types, on create and update.\n */\n async generateDocumentLocalizations({\n model,\n document,\n }: {\n model: UID.ContentType;\n document: Modules.Documents.AnyDocument;\n }) {\n const schema = strapi.getModel(model);\n const localeService = getService('locales');\n\n // No localizations needed for content types with i18n disabled\n const isLocalizedContentType = getService('content-types').isLocalizedContentType(schema);\n if (!isLocalizedContentType) {\n return;\n }\n\n // Don't trigger localizations if the update is on a derived locale, only do it on the default\n const defaultLocale = await localeService.getDefaultLocale();\n if (document.locale !== defaultLocale) {\n return;\n }\n\n const isFeatureEnabled = await this.isEnabled();\n if (!isFeatureEnabled) {\n return;\n }\n\n const documentId = document.documentId;\n\n if (!documentId) {\n strapi.log.warn(`AI Localizations: missing documentId for ${schema.uid}`);\n return;\n }\n\n // Extract only the localized content from the document\n const translateableContent = await traverseEntity(\n ({ key, attribute }, { remove }) => {\n const hasLocalizedOption = attribute?.pluginOptions?.i18n?.localized === true;\n // Only keep fields that actually need to be localized\n // TODO: remove blocks from this list once the AI server can handle it reliably\n if (!hasLocalizedOption || ['media', 'blocks'].includes(attribute.type)) {\n remove(key);\n }\n },\n { schema, getModel: strapi.getModel.bind(strapi) },\n document\n );\n\n // Call the AI server to get the localized content\n const localesList = await localeService.find();\n const targetLocales = localesList\n .filter((l) => l.code !== document.locale)\n .map((l) => l.code);\n\n if (targetLocales.length === 0) {\n strapi.log.info(\n `AI Localizations: no target locales for ${schema.uid} document ${documentId}`\n );\n return;\n }\n\n let token: string;\n try {\n const tokenData = await strapi.service('admin::user').getAiToken();\n token = tokenData.token;\n } catch (error) {\n throw new Error('Failed to retrieve AI token', {\n cause: error instanceof Error ? error : undefined,\n });\n }\n\n strapi.log.http('Contacting AI Server for localizations generation');\n const response = await fetch(`${aiServerUrl}/i18n/generate-localizations`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n content: translateableContent,\n sourceLocale: document.locale,\n targetLocales,\n }),\n });\n\n if (!response.ok) {\n strapi.log.error(\n `AI Localizations request failed: ${response.status} ${response.statusText}`\n );\n throw new Error(`AI Localizations request failed: ${response.statusText}`);\n }\n\n const aiResult = await response.json();\n\n // Get all media field names dynamically from the schema\n const mediaFields = Object.entries(schema.attributes)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, attr]) => attr.type === 'media')\n .map(([key]) => key);\n\n try {\n await Promise.allSettled(\n aiResult.localizations.map(async (localization: any) => {\n const { content, locale } = localization;\n\n // Fetch the derived locale document\n const derivedDoc = await strapi.documents(model).findOne({\n documentId,\n locale,\n populate: mediaFields,\n });\n\n // Merge AI content and media fields\n const mergedData = { ...content };\n for (const field of mediaFields) {\n // Only copy media if not already set in derived locale\n if (!derivedDoc || !derivedDoc[field]) {\n mergedData[field] = document[field];\n } else {\n mergedData[field] = derivedDoc[field];\n }\n }\n\n return strapi.documents(model).update({\n documentId,\n locale,\n fields: [],\n data: mergedData,\n });\n })\n );\n } catch (error) {\n strapi.log.error('AI Localizations generation failed', error);\n }\n },\n };\n};\n\nexport { createAILocalizationsService };\n"],"names":["createAILocalizationsService","strapi","aiServerUrl","process","env","STRAPI_AI_URL","isEnabled","isFutureFlagEnabled","features","future","isAIEnabled","config","get","hasAccess","ee","generateDocumentLocalizations","model","document","schema","getModel","localeService","getService","isLocalizedContentType","defaultLocale","getDefaultLocale","locale","isFeatureEnabled","documentId","log","warn","uid","translateableContent","traverseEntity","key","attribute","remove","hasLocalizedOption","pluginOptions","i18n","localized","includes","type","bind","localesList","find","targetLocales","filter","l","code","map","length","info","token","tokenData","service","getAiToken","error","Error","cause","undefined","http","response","fetch","method","headers","Authorization","body","JSON","stringify","content","sourceLocale","ok","status","statusText","aiResult","json","mediaFields","Object","entries","attributes","_","attr","Promise","allSettled","localizations","localization","derivedDoc","documents","findOne","populate","mergedData","field","update","fields","data"],"mappings":";;;;;AAIA,MAAMA,4BAA+B,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;;AAEvE,IAAA,MAAMC,WAAcC,GAAAA,OAAAA,CAAQC,GAAG,CAACC,aAAa,IAAI,kCAAA;IAEjD,OAAO;;QAEL,MAAMC,SAAAA,CAAAA,GAAAA;;AAEJ,YAAA,MAAMC,sBAAsBN,MAAOO,CAAAA,QAAQ,CAACC,MAAM,CAACH,SAAS,CAAC,yBAAA,CAAA;AAC7D,YAAA,IAAI,CAACC,mBAAqB,EAAA;gBACxB,OAAO,KAAA;AACT;;AAGA,YAAA,MAAMG,cAAcT,MAAOU,CAAAA,MAAM,CAACC,GAAG,CAAC,kBAAoB,EAAA,IAAA,CAAA;AAC1D,YAAA,IAAI,CAACF,WAAa,EAAA;gBAChB,OAAO,KAAA;AACT;;AAGA,YAAA,MAAMG,YAAYZ,MAAOa,CAAAA,EAAE,CAACN,QAAQ,CAACF,SAAS,CAAC,QAAA,CAAA;AAC/C,YAAA,IAAI,CAACO,SAAW,EAAA;gBACd,OAAO,KAAA;AACT;YAEA,OAAO,IAAA;AACT,SAAA;AAEA;;;;AAIC,QACD,MAAME,6BAA8B,CAAA,CAAA,EAClCC,KAAK,EACLC,QAAQ,EAIT,EAAA;YACC,MAAMC,MAAAA,GAASjB,MAAOkB,CAAAA,QAAQ,CAACH,KAAAA,CAAAA;AAC/B,YAAA,MAAMI,gBAAgBC,gBA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,MAAA;AACLD,4BAAAA,UAAU,CAACC,KAAAA,CAAM,GAAGL,UAAU,CAACK,KAAM,CAAA;AACvC;AACF;AAEA,oBAAA,OAAO1F,MAAOsF,CAAAA,SAAS,CAACvE,KAAAA,CAAAA,CAAO4E,MAAM,CAAC;AACpCjE,wBAAAA,UAAAA;AACAF,wBAAAA,MAAAA;AACAoE,wBAAAA,MAAAA,EAAQ,EAAE;wBACVC,IAAMJ,EAAAA;AACR,qBAAA,CAAA;AACF,iBAAA,CAAA,CAAA;AAEJ,aAAA,CAAE,OAAOlC,KAAO,EAAA;AACdvD,gBAAAA,MAAAA,CAAO2B,GAAG,CAAC4B,KAAK,CAAC,oCAAsCA,EAAAA,KAAAA,CAAAA;AACzD;AACF;AACF,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { traverseEntity } from '@strapi/utils';
|
|
2
|
+
import { getService } from '../utils/index.mjs';
|
|
3
|
+
|
|
4
|
+
const createAILocalizationsService = ({ strapi })=>{
|
|
5
|
+
// TODO: add a helper function to get the AI server URL
|
|
6
|
+
const aiServerUrl = process.env.STRAPI_AI_URL || 'https://strapi-ai.apps.strapi.io';
|
|
7
|
+
return {
|
|
8
|
+
// Async to avoid changing the signature later (there will be a db check in the future)
|
|
9
|
+
async isEnabled () {
|
|
10
|
+
// Check if future flag is enabled
|
|
11
|
+
const isFutureFlagEnabled = strapi.features.future.isEnabled('unstableAILocalizations');
|
|
12
|
+
if (!isFutureFlagEnabled) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
// Check if user disabled AI features globally
|
|
16
|
+
const isAIEnabled = strapi.config.get('admin.ai.enabled', true);
|
|
17
|
+
if (!isAIEnabled) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
// Check if the user's license grants access to AI features
|
|
21
|
+
const hasAccess = strapi.ee.features.isEnabled('cms-ai');
|
|
22
|
+
if (!hasAccess) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Checks if there are localizations that need to be generated for the given document,
|
|
29
|
+
* and if so, calls the AI service and saves the results to the database.
|
|
30
|
+
* Works for both single and collection types, on create and update.
|
|
31
|
+
*/ async generateDocumentLocalizations ({ model, document }) {
|
|
32
|
+
const schema = strapi.getModel(model);
|
|
33
|
+
const localeService = getService('locales');
|
|
34
|
+
// No localizations needed for content types with i18n disabled
|
|
35
|
+
const isLocalizedContentType = getService('content-types').isLocalizedContentType(schema);
|
|
36
|
+
if (!isLocalizedContentType) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Don't trigger localizations if the update is on a derived locale, only do it on the default
|
|
40
|
+
const defaultLocale = await localeService.getDefaultLocale();
|
|
41
|
+
if (document.locale !== defaultLocale) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const isFeatureEnabled = await this.isEnabled();
|
|
45
|
+
if (!isFeatureEnabled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const documentId = document.documentId;
|
|
49
|
+
if (!documentId) {
|
|
50
|
+
strapi.log.warn(`AI Localizations: missing documentId for ${schema.uid}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// Extract only the localized content from the document
|
|
54
|
+
const translateableContent = await traverseEntity(({ key, attribute }, { remove })=>{
|
|
55
|
+
const hasLocalizedOption = attribute?.pluginOptions?.i18n?.localized === true;
|
|
56
|
+
// Only keep fields that actually need to be localized
|
|
57
|
+
// TODO: remove blocks from this list once the AI server can handle it reliably
|
|
58
|
+
if (!hasLocalizedOption || [
|
|
59
|
+
'media',
|
|
60
|
+
'blocks'
|
|
61
|
+
].includes(attribute.type)) {
|
|
62
|
+
remove(key);
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
schema,
|
|
66
|
+
getModel: strapi.getModel.bind(strapi)
|
|
67
|
+
}, document);
|
|
68
|
+
// Call the AI server to get the localized content
|
|
69
|
+
const localesList = await localeService.find();
|
|
70
|
+
const targetLocales = localesList.filter((l)=>l.code !== document.locale).map((l)=>l.code);
|
|
71
|
+
if (targetLocales.length === 0) {
|
|
72
|
+
strapi.log.info(`AI Localizations: no target locales for ${schema.uid} document ${documentId}`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
let token;
|
|
76
|
+
try {
|
|
77
|
+
const tokenData = await strapi.service('admin::user').getAiToken();
|
|
78
|
+
token = tokenData.token;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
throw new Error('Failed to retrieve AI token', {
|
|
81
|
+
cause: error instanceof Error ? error : undefined
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
strapi.log.http('Contacting AI Server for localizations generation');
|
|
85
|
+
const response = await fetch(`${aiServerUrl}/i18n/generate-localizations`, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
headers: {
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
Authorization: `Bearer ${token}`
|
|
90
|
+
},
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
content: translateableContent,
|
|
93
|
+
sourceLocale: document.locale,
|
|
94
|
+
targetLocales
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
strapi.log.error(`AI Localizations request failed: ${response.status} ${response.statusText}`);
|
|
99
|
+
throw new Error(`AI Localizations request failed: ${response.statusText}`);
|
|
100
|
+
}
|
|
101
|
+
const aiResult = await response.json();
|
|
102
|
+
// Get all media field names dynamically from the schema
|
|
103
|
+
const mediaFields = Object.entries(schema.attributes)// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
104
|
+
.filter(([_, attr])=>attr.type === 'media').map(([key])=>key);
|
|
105
|
+
try {
|
|
106
|
+
await Promise.allSettled(aiResult.localizations.map(async (localization)=>{
|
|
107
|
+
const { content, locale } = localization;
|
|
108
|
+
// Fetch the derived locale document
|
|
109
|
+
const derivedDoc = await strapi.documents(model).findOne({
|
|
110
|
+
documentId,
|
|
111
|
+
locale,
|
|
112
|
+
populate: mediaFields
|
|
113
|
+
});
|
|
114
|
+
// Merge AI content and media fields
|
|
115
|
+
const mergedData = {
|
|
116
|
+
...content
|
|
117
|
+
};
|
|
118
|
+
for (const field of mediaFields){
|
|
119
|
+
// Only copy media if not already set in derived locale
|
|
120
|
+
if (!derivedDoc || !derivedDoc[field]) {
|
|
121
|
+
mergedData[field] = document[field];
|
|
122
|
+
} else {
|
|
123
|
+
mergedData[field] = derivedDoc[field];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return strapi.documents(model).update({
|
|
127
|
+
documentId,
|
|
128
|
+
locale,
|
|
129
|
+
fields: [],
|
|
130
|
+
data: mergedData
|
|
131
|
+
});
|
|
132
|
+
}));
|
|
133
|
+
} catch (error) {
|
|
134
|
+
strapi.log.error('AI Localizations generation failed', error);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export { createAILocalizationsService };
|
|
141
|
+
//# sourceMappingURL=ai-localizations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-localizations.mjs","sources":["../../../server/src/services/ai-localizations.ts"],"sourcesContent":["import type { Core, Modules, UID } from '@strapi/types';\nimport { traverseEntity } from '@strapi/utils';\nimport { getService } from '../utils';\n\nconst createAILocalizationsService = ({ strapi }: { strapi: Core.Strapi }) => {\n // TODO: add a helper function to get the AI server URL\n const aiServerUrl = process.env.STRAPI_AI_URL || 'https://strapi-ai.apps.strapi.io';\n\n return {\n // Async to avoid changing the signature later (there will be a db check in the future)\n async isEnabled() {\n // Check if future flag is enabled\n const isFutureFlagEnabled = strapi.features.future.isEnabled('unstableAILocalizations');\n if (!isFutureFlagEnabled) {\n return false;\n }\n\n // Check if user disabled AI features globally\n const isAIEnabled = strapi.config.get('admin.ai.enabled', true);\n if (!isAIEnabled) {\n return false;\n }\n\n // Check if the user's license grants access to AI features\n const hasAccess = strapi.ee.features.isEnabled('cms-ai');\n if (!hasAccess) {\n return false;\n }\n\n return true;\n },\n\n /**\n * Checks if there are localizations that need to be generated for the given document,\n * and if so, calls the AI service and saves the results to the database.\n * Works for both single and collection types, on create and update.\n */\n async generateDocumentLocalizations({\n model,\n document,\n }: {\n model: UID.ContentType;\n document: Modules.Documents.AnyDocument;\n }) {\n const schema = strapi.getModel(model);\n const localeService = getService('locales');\n\n // No localizations needed for content types with i18n disabled\n const isLocalizedContentType = getService('content-types').isLocalizedContentType(schema);\n if (!isLocalizedContentType) {\n return;\n }\n\n // Don't trigger localizations if the update is on a derived locale, only do it on the default\n const defaultLocale = await localeService.getDefaultLocale();\n if (document.locale !== defaultLocale) {\n return;\n }\n\n const isFeatureEnabled = await this.isEnabled();\n if (!isFeatureEnabled) {\n return;\n }\n\n const documentId = document.documentId;\n\n if (!documentId) {\n strapi.log.warn(`AI Localizations: missing documentId for ${schema.uid}`);\n return;\n }\n\n // Extract only the localized content from the document\n const translateableContent = await traverseEntity(\n ({ key, attribute }, { remove }) => {\n const hasLocalizedOption = attribute?.pluginOptions?.i18n?.localized === true;\n // Only keep fields that actually need to be localized\n // TODO: remove blocks from this list once the AI server can handle it reliably\n if (!hasLocalizedOption || ['media', 'blocks'].includes(attribute.type)) {\n remove(key);\n }\n },\n { schema, getModel: strapi.getModel.bind(strapi) },\n document\n );\n\n // Call the AI server to get the localized content\n const localesList = await localeService.find();\n const targetLocales = localesList\n .filter((l) => l.code !== document.locale)\n .map((l) => l.code);\n\n if (targetLocales.length === 0) {\n strapi.log.info(\n `AI Localizations: no target locales for ${schema.uid} document ${documentId}`\n );\n return;\n }\n\n let token: string;\n try {\n const tokenData = await strapi.service('admin::user').getAiToken();\n token = tokenData.token;\n } catch (error) {\n throw new Error('Failed to retrieve AI token', {\n cause: error instanceof Error ? error : undefined,\n });\n }\n\n strapi.log.http('Contacting AI Server for localizations generation');\n const response = await fetch(`${aiServerUrl}/i18n/generate-localizations`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n content: translateableContent,\n sourceLocale: document.locale,\n targetLocales,\n }),\n });\n\n if (!response.ok) {\n strapi.log.error(\n `AI Localizations request failed: ${response.status} ${response.statusText}`\n );\n throw new Error(`AI Localizations request failed: ${response.statusText}`);\n }\n\n const aiResult = await response.json();\n\n // Get all media field names dynamically from the schema\n const mediaFields = Object.entries(schema.attributes)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, attr]) => attr.type === 'media')\n .map(([key]) => key);\n\n try {\n await Promise.allSettled(\n aiResult.localizations.map(async (localization: any) => {\n const { content, locale } = localization;\n\n // Fetch the derived locale document\n const derivedDoc = await strapi.documents(model).findOne({\n documentId,\n locale,\n populate: mediaFields,\n });\n\n // Merge AI content and media fields\n const mergedData = { ...content };\n for (const field of mediaFields) {\n // Only copy media if not already set in derived locale\n if (!derivedDoc || !derivedDoc[field]) {\n mergedData[field] = document[field];\n } else {\n mergedData[field] = derivedDoc[field];\n }\n }\n\n return strapi.documents(model).update({\n documentId,\n locale,\n fields: [],\n data: mergedData,\n });\n })\n );\n } catch (error) {\n strapi.log.error('AI Localizations generation failed', error);\n }\n },\n };\n};\n\nexport { createAILocalizationsService };\n"],"names":["createAILocalizationsService","strapi","aiServerUrl","process","env","STRAPI_AI_URL","isEnabled","isFutureFlagEnabled","features","future","isAIEnabled","config","get","hasAccess","ee","generateDocumentLocalizations","model","document","schema","getModel","localeService","getService","isLocalizedContentType","defaultLocale","getDefaultLocale","locale","isFeatureEnabled","documentId","log","warn","uid","translateableContent","traverseEntity","key","attribute","remove","hasLocalizedOption","pluginOptions","i18n","localized","includes","type","bind","localesList","find","targetLocales","filter","l","code","map","length","info","token","tokenData","service","getAiToken","error","Error","cause","undefined","http","response","fetch","method","headers","Authorization","body","JSON","stringify","content","sourceLocale","ok","status","statusText","aiResult","json","mediaFields","Object","entries","attributes","_","attr","Promise","allSettled","localizations","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,CAAA,CAAA;AAEJ,aAAA,CAAE,OAAOlC,KAAO,EAAA;AACdvD,gBAAAA,MAAAA,CAAO2B,GAAG,CAAC4B,KAAK,CAAC,oCAAsCA,EAAAA,KAAAA,CAAAA;AACzD;AACF;AACF,KAAA;AACF;;;;"}
|
|
@@ -7,6 +7,8 @@ var locales = require('./locales.js');
|
|
|
7
7
|
var isoLocales = require('./iso-locales.js');
|
|
8
8
|
var contentTypes = require('./content-types.js');
|
|
9
9
|
var index = require('./sanitize/index.js');
|
|
10
|
+
var settings = require('./settings.js');
|
|
11
|
+
var aiLocalizations = require('./ai-localizations.js');
|
|
10
12
|
|
|
11
13
|
var services = {
|
|
12
14
|
permissions,
|
|
@@ -15,7 +17,9 @@ var services = {
|
|
|
15
17
|
locales,
|
|
16
18
|
sanitize: index,
|
|
17
19
|
'iso-locales': isoLocales,
|
|
18
|
-
'content-types': contentTypes
|
|
20
|
+
'content-types': contentTypes,
|
|
21
|
+
'ai-localizations': aiLocalizations.createAILocalizationsService,
|
|
22
|
+
settings: settings.createSettingsService
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
module.exports = services;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\nimport { createSettingsService } from './settings';\nimport { createAILocalizationsService } from './ai-localizations';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n 'ai-localizations': createAILocalizationsService,\n settings: createSettingsService,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes","createAILocalizationsService","settings","createSettingsService"],"mappings":";;;;;;;;;;;;AAUA,eAAe;AACbA,IAAAA,WAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,aAAAA;AACAC,IAAAA,OAAAA;AACAC,cAAAA,KAAAA;IACA,aAAeC,EAAAA,UAAAA;IACf,eAAiBC,EAAAA,YAAAA;IACjB,kBAAoBC,EAAAA,4CAAAA;IACpBC,QAAUC,EAAAA;AACZ,CAAE;;;;"}
|
|
@@ -5,6 +5,8 @@ import locales from './locales.mjs';
|
|
|
5
5
|
import isoLocalesService from './iso-locales.mjs';
|
|
6
6
|
import contentTypes from './content-types.mjs';
|
|
7
7
|
import sanitize from './sanitize/index.mjs';
|
|
8
|
+
import { createSettingsService } from './settings.mjs';
|
|
9
|
+
import { createAILocalizationsService } from './ai-localizations.mjs';
|
|
8
10
|
|
|
9
11
|
var services = {
|
|
10
12
|
permissions,
|
|
@@ -13,7 +15,9 @@ var services = {
|
|
|
13
15
|
locales,
|
|
14
16
|
sanitize,
|
|
15
17
|
'iso-locales': isoLocalesService,
|
|
16
|
-
'content-types': contentTypes
|
|
18
|
+
'content-types': contentTypes,
|
|
19
|
+
'ai-localizations': createAILocalizationsService,
|
|
20
|
+
settings: createSettingsService
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
export { services as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\nimport { createSettingsService } from './settings';\nimport { createAILocalizationsService } from './ai-localizations';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n 'ai-localizations': createAILocalizationsService,\n settings: createSettingsService,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes","createAILocalizationsService","settings","createSettingsService"],"mappings":";;;;;;;;;;AAUA,eAAe;AACbA,IAAAA,WAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,aAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,QAAAA;IACA,aAAeC,EAAAA,iBAAAA;IACf,eAAiBC,EAAAA,YAAAA;IACjB,kBAAoBC,EAAAA,4BAAAA;IACpBC,QAAUC,EAAAA;AACZ,CAAE;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const createSettingsService = ({ strapi })=>{
|
|
4
|
+
const settings = strapi.store({
|
|
5
|
+
type: 'plugin',
|
|
6
|
+
name: 'i18n',
|
|
7
|
+
key: 'settings'
|
|
8
|
+
});
|
|
9
|
+
async function getSettings() {
|
|
10
|
+
const res = await settings.get({});
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
13
|
+
function setSettings(value) {
|
|
14
|
+
return settings.set({
|
|
15
|
+
value
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
getSettings,
|
|
20
|
+
setSettings
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.createSettingsService = createSettingsService;
|
|
25
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sources":["../../../server/src/services/settings.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport type { Settings } from '../validation/settings';\n\nconst createSettingsService = ({ strapi }: { strapi: Core.Strapi }) => {\n const settings = strapi.store!({ type: 'plugin', name: 'i18n', key: 'settings' });\n\n async function getSettings() {\n const res = (await settings.get({})) as Settings | null;\n\n return res;\n }\n\n function setSettings(value: Settings) {\n return settings.set({ value });\n }\n\n return {\n getSettings,\n setSettings,\n };\n};\n\nexport { createSettingsService };\nexport type SettingsService = ReturnType<typeof createSettingsService>;\n"],"names":["createSettingsService","strapi","settings","store","type","name","key","getSettings","res","get","setSettings","value","set"],"mappings":";;AAGA,MAAMA,qBAAwB,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;IAChE,MAAMC,QAAAA,GAAWD,MAAOE,CAAAA,KAAK,CAAE;QAAEC,IAAM,EAAA,QAAA;QAAUC,IAAM,EAAA,MAAA;QAAQC,GAAK,EAAA;AAAW,KAAA,CAAA;IAE/E,eAAeC,WAAAA,GAAAA;AACb,QAAA,MAAMC,GAAO,GAAA,MAAMN,QAASO,CAAAA,GAAG,CAAC,EAAC,CAAA;QAEjC,OAAOD,GAAAA;AACT;AAEA,IAAA,SAASE,YAAYC,KAAe,EAAA;QAClC,OAAOT,QAAAA,CAASU,GAAG,CAAC;AAAED,YAAAA;AAAM,SAAA,CAAA;AAC9B;IAEA,OAAO;AACLJ,QAAAA,WAAAA;AACAG,QAAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const createSettingsService = ({ strapi })=>{
|
|
2
|
+
const settings = strapi.store({
|
|
3
|
+
type: 'plugin',
|
|
4
|
+
name: 'i18n',
|
|
5
|
+
key: 'settings'
|
|
6
|
+
});
|
|
7
|
+
async function getSettings() {
|
|
8
|
+
const res = await settings.get({});
|
|
9
|
+
return res;
|
|
10
|
+
}
|
|
11
|
+
function setSettings(value) {
|
|
12
|
+
return settings.set({
|
|
13
|
+
value
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
getSettings,
|
|
18
|
+
setSettings
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { createSettingsService };
|
|
23
|
+
//# sourceMappingURL=settings.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.mjs","sources":["../../../server/src/services/settings.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport type { Settings } from '../validation/settings';\n\nconst createSettingsService = ({ strapi }: { strapi: Core.Strapi }) => {\n const settings = strapi.store!({ type: 'plugin', name: 'i18n', key: 'settings' });\n\n async function getSettings() {\n const res = (await settings.get({})) as Settings | null;\n\n return res;\n }\n\n function setSettings(value: Settings) {\n return settings.set({ value });\n }\n\n return {\n getSettings,\n setSettings,\n };\n};\n\nexport { createSettingsService };\nexport type SettingsService = ReturnType<typeof createSettingsService>;\n"],"names":["createSettingsService","strapi","settings","store","type","name","key","getSettings","res","get","setSettings","value","set"],"mappings":"AAGA,MAAMA,qBAAwB,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;IAChE,MAAMC,QAAAA,GAAWD,MAAOE,CAAAA,KAAK,CAAE;QAAEC,IAAM,EAAA,QAAA;QAAUC,IAAM,EAAA,MAAA;QAAQC,GAAK,EAAA;AAAW,KAAA,CAAA;IAE/E,eAAeC,WAAAA,GAAAA;AACb,QAAA,MAAMC,GAAO,GAAA,MAAMN,QAASO,CAAAA,GAAG,CAAC,EAAC,CAAA;QAEjC,OAAOD,GAAAA;AACT;AAEA,IAAA,SAASE,YAAYC,KAAe,EAAA;QAClC,OAAOT,QAAAA,CAASU,GAAG,CAAC;AAAED,YAAAA;AAAM,SAAA,CAAA;AAC9B;IAEA,OAAO;AACLJ,QAAAA,WAAAA;AACAG,QAAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -5,6 +5,10 @@ declare const _default: {
|
|
|
5
5
|
'content-types': {
|
|
6
6
|
getNonLocalizedAttributes(ctx: import("koa").Context): Promise<import("koa").Context | undefined>;
|
|
7
7
|
};
|
|
8
|
+
settings: {
|
|
9
|
+
updateSettings(ctx: import("koa").Context): Promise<void>;
|
|
10
|
+
getSettings(ctx: import("koa").Context): Promise<void>;
|
|
11
|
+
};
|
|
8
12
|
};
|
|
9
13
|
export default _default;
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;;wBAMP,OAAO;qBAYV,OAAO;;AAbhC,wBAkBE"}
|
|
@@ -22,7 +22,10 @@ declare const _default: () => {
|
|
|
22
22
|
};
|
|
23
23
|
}[];
|
|
24
24
|
};
|
|
25
|
-
'content-api': () =>
|
|
25
|
+
'content-api': () => {
|
|
26
|
+
type: "content-api";
|
|
27
|
+
routes: import("@strapi/types/dist/core").RouteInput[];
|
|
28
|
+
};
|
|
26
29
|
};
|
|
27
30
|
controllers: {
|
|
28
31
|
locales: import("@strapi/types/dist/core").Controller;
|
|
@@ -30,6 +33,10 @@ declare const _default: () => {
|
|
|
30
33
|
'content-types': {
|
|
31
34
|
getNonLocalizedAttributes(ctx: import("koa").Context): Promise<import("koa").Context | undefined>;
|
|
32
35
|
};
|
|
36
|
+
settings: {
|
|
37
|
+
updateSettings(ctx: import("koa").Context): Promise<void>;
|
|
38
|
+
getSettings(ctx: import("koa").Context): Promise<void>;
|
|
39
|
+
};
|
|
33
40
|
};
|
|
34
41
|
contentTypes: {
|
|
35
42
|
locale: {
|
|
@@ -143,6 +150,25 @@ declare const _default: () => {
|
|
|
143
150
|
fillNonLocalizedAttributes: (entry: any, relatedEntry: any, { model }: any) => void;
|
|
144
151
|
getNestedPopulateOfNonLocalizedAttributes: (modelUID: any) => string[];
|
|
145
152
|
};
|
|
153
|
+
'ai-localizations': ({ strapi }: {
|
|
154
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
155
|
+
}) => {
|
|
156
|
+
isEnabled(): Promise<boolean>;
|
|
157
|
+
generateDocumentLocalizations({ model, document, }: {
|
|
158
|
+
model: import("@strapi/types/dist/uid").ContentType;
|
|
159
|
+
document: import("@strapi/types/dist/modules/documents").AnyDocument;
|
|
160
|
+
}): Promise<void>;
|
|
161
|
+
};
|
|
162
|
+
settings: ({ strapi }: {
|
|
163
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
164
|
+
}) => {
|
|
165
|
+
getSettings: () => Promise<import("yup/lib/object").AssertsShape<{
|
|
166
|
+
aiLocalizations: import("yup").BooleanSchema<boolean, Record<string, any>, boolean>;
|
|
167
|
+
}> | null>;
|
|
168
|
+
setSettings: (value: import("yup/lib/object").AssertsShape<{
|
|
169
|
+
aiLocalizations: import("yup").BooleanSchema<boolean, Record<string, any>, boolean>;
|
|
170
|
+
}>) => Promise<void>;
|
|
171
|
+
};
|
|
146
172
|
};
|
|
147
173
|
};
|
|
148
174
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wBAOG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/admin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/admin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wBA4FE"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Core } from '@strapi/types';
|
|
2
|
-
declare const
|
|
3
|
-
|
|
2
|
+
declare const createContentApiRoutes: () => {
|
|
3
|
+
type: "content-api";
|
|
4
|
+
routes: Core.RouteInput[];
|
|
5
|
+
};
|
|
6
|
+
export default createContentApiRoutes;
|
|
4
7
|
//# sourceMappingURL=content-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-api.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/content-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"content-api.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/content-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI1C,QAAA,MAAM,sBAAsB;;;CAU1B,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
|