@strapi/i18n 5.48.1 → 5.50.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/dist/admin/components/CMHeaderActions.js +3 -2
- package/dist/admin/components/CMHeaderActions.js.map +1 -1
- package/dist/admin/components/CheckboxConfirmation.js +3 -2
- package/dist/admin/components/CheckboxConfirmation.js.map +1 -1
- package/dist/admin/components/CreateLocale.js +4 -3
- package/dist/admin/components/CreateLocale.js.map +1 -1
- package/dist/admin/components/DeleteLocale.js +3 -2
- package/dist/admin/components/DeleteLocale.js.map +1 -1
- package/dist/admin/components/EditLocale.js +3 -2
- package/dist/admin/components/EditLocale.js.map +1 -1
- package/dist/admin/components/LocalePicker.js +3 -2
- package/dist/admin/components/LocalePicker.js.map +1 -1
- package/dist/admin/components/LocaleTable.js +3 -2
- package/dist/admin/components/LocaleTable.js.map +1 -1
- package/dist/admin/hooks/useAILocalizationJobsPolling.js +3 -2
- package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -1
- package/dist/admin/hooks/useI18n.js +7 -3
- package/dist/admin/hooks/useI18n.js.map +1 -1
- package/dist/admin/index.js +8 -3
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +1 -0
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js +6 -2
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -1
- package/dist/admin/middlewares/rbac-middleware.js +3 -2
- package/dist/admin/middlewares/rbac-middleware.js.map +1 -1
- package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/settings.d.ts +1 -1
- package/dist/admin/src/utils/schemas.d.ts +6 -6
- package/dist/admin/translations/ja.json.js +92 -0
- package/dist/admin/translations/ja.json.js.map +1 -0
- package/dist/admin/translations/ja.json.mjs +90 -0
- package/dist/admin/translations/ja.json.mjs.map +1 -0
- package/dist/admin/utils/fields.js +5 -1
- package/dist/admin/utils/fields.js.map +1 -1
- package/dist/admin/utils/schemas.js +6 -2
- package/dist/admin/utils/schemas.js.map +1 -1
- package/dist/server/controllers/locales.js +3 -2
- package/dist/server/controllers/locales.js.map +1 -1
- package/dist/server/register.js +10 -2
- package/dist/server/register.js.map +1 -1
- package/dist/server/register.mjs +4 -0
- package/dist/server/register.mjs.map +1 -1
- package/dist/server/routes/validation/locale.js +3 -2
- package/dist/server/routes/validation/locale.js.map +1 -1
- package/dist/server/services/content-types.js +6 -2
- package/dist/server/services/content-types.js.map +1 -1
- package/dist/server/services/content-types.mjs.map +1 -1
- package/dist/server/services/localizations.js.map +1 -1
- package/dist/server/services/localizations.mjs.map +1 -1
- package/dist/server/services/permissions/actions.js +95 -1
- package/dist/server/services/permissions/actions.js.map +1 -1
- package/dist/server/services/permissions/actions.mjs +95 -1
- package/dist/server/services/permissions/actions.mjs.map +1 -1
- package/dist/server/services/permissions/sections-builder.js +6 -4
- package/dist/server/services/permissions/sections-builder.js.map +1 -1
- package/dist/server/services/permissions/sections-builder.mjs +6 -4
- package/dist/server/services/permissions/sections-builder.mjs.map +1 -1
- package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -1
- package/dist/server/src/controllers/content-types.d.ts +2 -3
- package/dist/server/src/controllers/content-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +2 -3
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/domain/locale.d.ts.map +1 -1
- package/dist/server/src/graphql.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +12 -11
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/services/ai-localization-jobs.d.ts +1 -1
- package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -1
- package/dist/server/src/services/ai-localizations.d.ts.map +1 -1
- package/dist/server/src/services/content-types.d.ts +1 -1
- package/dist/server/src/services/content-types.d.ts.map +1 -1
- package/dist/server/src/services/fill-from-locale.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +10 -8
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/localizations.d.ts.map +1 -1
- package/dist/server/src/services/permissions/actions.d.ts +5 -0
- package/dist/server/src/services/permissions/actions.d.ts.map +1 -1
- package/dist/server/src/services/permissions/conditions.d.ts.map +1 -1
- package/dist/server/src/services/permissions/engine.d.ts.map +1 -1
- package/dist/server/src/services/permissions/sections-builder.d.ts.map +1 -1
- package/dist/server/src/services/permissions.d.ts +5 -0
- package/dist/server/src/services/permissions.d.ts.map +1 -1
- package/dist/server/src/services/sanitize/index.d.ts +0 -1
- package/dist/server/src/services/sanitize/index.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +15 -15
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/src/validation/content-types.d.ts +2 -2
- package/dist/server/src/validation/content-types.d.ts.map +1 -1
- package/dist/server/src/validation/locales.d.ts +2 -2
- package/dist/server/src/validation/settings.d.ts +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extendCTBAttributeInitialData.js","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = ({ uid }: { uid: string }) => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const type = get(store, [\n 'content-type-builder_dataManagerProvider',\n 'current',\n 'contentTypes',\n uid,\n ]);\n\n if (!type || type.modelType !== 'contentType') {\n return next(action);\n }\n\n const hasi18nEnabled = get(type, ['pluginOptions', 'i18n', 'localized'], false);\n\n if (hasi18nEnabled) {\n return next({\n ...action,\n payload: {\n ...action.payload,\n options: {\n pluginOptions: {\n ...(action?.payload?.options?.pluginOptions ?? {}),\n i18n: {\n localized: true,\n },\n },\n },\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n const { payload = {}, type } = action ?? {};\n\n if (\n type === 'formModal/setAttributeDataSchema' &&\n !['relation', 'component'].includes(payload.attributeType) &&\n !payload.isEditing\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (type === 'formModal/setCustomFieldDataSchema' && !payload.isEditing) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (\n type === 'formModal/resetPropsAndSetFormForAddingAnExistingCompo' ||\n type === 'formModal/resetPropsAndSaveCurrentData'\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","uid","store","type","get","modelType","hasi18nEnabled","payload","options","pluginOptions","i18n","localized","err","includes","attributeType","isEditing"],"mappings":"
|
|
1
|
+
{"version":3,"file":"extendCTBAttributeInitialData.js","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = ({ uid }: { uid: string }) => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const type = get(store, [\n 'content-type-builder_dataManagerProvider',\n 'current',\n 'contentTypes',\n uid,\n ]);\n\n if (!type || type.modelType !== 'contentType') {\n return next(action);\n }\n\n const hasi18nEnabled = get(type, ['pluginOptions', 'i18n', 'localized'], false);\n\n if (hasi18nEnabled) {\n return next({\n ...action,\n payload: {\n ...action.payload,\n options: {\n pluginOptions: {\n ...(action?.payload?.options?.pluginOptions ?? {}),\n i18n: {\n localized: true,\n },\n },\n },\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n const { payload = {}, type } = action ?? {};\n\n if (\n type === 'formModal/setAttributeDataSchema' &&\n !['relation', 'component'].includes(payload.attributeType) &&\n !payload.isEditing\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (type === 'formModal/setCustomFieldDataSchema' && !payload.isEditing) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (\n type === 'formModal/resetPropsAndSetFormForAddingAnExistingCompo' ||\n type === 'formModal/resetPropsAndSaveCurrentData'\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","uid","store","type","get","modelType","hasi18nEnabled","payload","options","pluginOptions","i18n","localized","err","includes","attributeType","isEditing"],"mappings":";;;;;;;;AAKA,MAAMA,uCAAAA,GAGF,IAAA;AACF,IAAA,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAClB,CAACC,OACD,CAACC,MAAAA,GAAAA;AACC,gBAAA,MAAMC,aAAAA,GAAgB,CAAC,EAAEC,GAAG,EAAmB,GAAA;;;oBAG7C,IAAI;AACF,wBAAA,MAAMC,KAAAA,GAAQL,QAAAA,EAAAA;wBAEd,MAAMM,IAAAA,GAAOC,qBAAIF,KAAAA,EAAO;AACtB,4BAAA,0CAAA;AACA,4BAAA,SAAA;AACA,4BAAA,cAAA;AACAD,4BAAAA;AACD,yBAAA,CAAA;AAED,wBAAA,IAAI,CAACE,IAAAA,IAAQA,IAAAA,CAAKE,SAAS,KAAK,aAAA,EAAe;AAC7C,4BAAA,OAAOP,IAAAA,CAAKC,MAAAA,CAAAA;AACd,wBAA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A,IAAAA,KAAS,wCAAA,EACT;AACA,oBAAA,OAAOH,aAAAA,CAAc;AACnBC,wBAAAA,GAAAA,EAAKM,QAAQN;AACf,qBAAA,CAAA;AACF,gBAAA;AAEA,gBAAA,OAAOH,IAAAA,CAAKC,MAAAA,CAAAA;AACd,YAAA,CAAA;AACJ;;;;"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
var qs = require('qs');
|
|
4
4
|
var reactRouterDom = require('react-router-dom');
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
7
8
|
var n = Object.create(null);
|
|
8
9
|
if (e) {
|
|
9
10
|
Object.keys(e).forEach(function (k) {
|
|
@@ -20,7 +21,7 @@ function _interopNamespaceDefault(e) {
|
|
|
20
21
|
return Object.freeze(n);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
var qs__namespace = /*#__PURE__*/
|
|
24
|
+
var qs__namespace = /*#__PURE__*/_interopNamespace(qs);
|
|
24
25
|
|
|
25
26
|
const localeMiddleware = (ctx)=>(next)=>(permissions)=>{
|
|
26
27
|
const match = reactRouterDom.matchPath('/content-manager/:collectionType/:model?/:id', ctx.pathname);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rbac-middleware.js","sources":["../../../admin/src/middlewares/rbac-middleware.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as qs from 'qs';\nimport { matchPath } from 'react-router-dom';\n\nimport type { RBACMiddleware } from '@strapi/admin/strapi-admin';\n\nconst localeMiddleware: RBACMiddleware = (ctx) => (next) => (permissions) => {\n const match = matchPath('/content-manager/:collectionType/:model?/:id', ctx.pathname);\n\n if (!match) {\n return next(permissions);\n }\n\n const search = qs.parse(ctx.search);\n\n if (typeof search !== 'object') {\n return next(permissions);\n }\n\n if (!('plugins' in search && typeof search.plugins === 'object')) {\n return next(permissions);\n }\n\n if (\n !(\n 'i18n' in search.plugins &&\n typeof search.plugins.i18n === 'object' &&\n !Array.isArray(search.plugins.i18n)\n )\n ) {\n return next(permissions);\n }\n\n const { locale } = search.plugins.i18n;\n\n if (typeof locale !== 'string') {\n return next(permissions);\n }\n\n const revisedPermissions = permissions.filter(\n (permission) =>\n !permission.properties?.locales || permission.properties.locales.includes(locale)\n );\n\n return next(revisedPermissions);\n};\n\nexport { localeMiddleware };\n"],"names":["localeMiddleware","ctx","next","permissions","match","matchPath","pathname","search","qs","parse","plugins","i18n","Array","isArray","locale","revisedPermissions","filter","permission","properties","locales","includes"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rbac-middleware.js","sources":["../../../admin/src/middlewares/rbac-middleware.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as qs from 'qs';\nimport { matchPath } from 'react-router-dom';\n\nimport type { RBACMiddleware } from '@strapi/admin/strapi-admin';\n\nconst localeMiddleware: RBACMiddleware = (ctx) => (next) => (permissions) => {\n const match = matchPath('/content-manager/:collectionType/:model?/:id', ctx.pathname);\n\n if (!match) {\n return next(permissions);\n }\n\n const search = qs.parse(ctx.search);\n\n if (typeof search !== 'object') {\n return next(permissions);\n }\n\n if (!('plugins' in search && typeof search.plugins === 'object')) {\n return next(permissions);\n }\n\n if (\n !(\n 'i18n' in search.plugins &&\n typeof search.plugins.i18n === 'object' &&\n !Array.isArray(search.plugins.i18n)\n )\n ) {\n return next(permissions);\n }\n\n const { locale } = search.plugins.i18n;\n\n if (typeof locale !== 'string') {\n return next(permissions);\n }\n\n const revisedPermissions = permissions.filter(\n (permission) =>\n !permission.properties?.locales || permission.properties.locales.includes(locale)\n );\n\n return next(revisedPermissions);\n};\n\nexport { localeMiddleware };\n"],"names":["localeMiddleware","ctx","next","permissions","match","matchPath","pathname","search","qs","parse","plugins","i18n","Array","isArray","locale","revisedPermissions","filter","permission","properties","locales","includes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,gBAAAA,GAAmC,CAACC,GAAAA,G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;"}
|
|
@@ -18,7 +18,7 @@ interface AddLocaleToReleasesHookArgs {
|
|
|
18
18
|
declare const addLocaleToReleasesHook: ({ displayedHeaders }: AddLocaleToReleasesHookArgs) => {
|
|
19
19
|
displayedHeaders: ({
|
|
20
20
|
key: string;
|
|
21
|
-
fieldSchema: Schema.Attribute.Kind |
|
|
21
|
+
fieldSchema: Schema.Attribute.Kind | "custom";
|
|
22
22
|
metadatas: {
|
|
23
23
|
label: {
|
|
24
24
|
id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const useGetManyDraftRelationCountQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/query").QueryDefinition<{
|
|
2
|
-
documentIds?:
|
|
3
|
-
locale?: string | string[] | null
|
|
2
|
+
documentIds?: import("@strapi/types/dist/modules/documents").ID[];
|
|
3
|
+
locale?: string | string[] | null;
|
|
4
4
|
} & {
|
|
5
5
|
model: string;
|
|
6
6
|
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "GuidedTourMeta" | "HomepageKeyStatistics" | "AiUsage" | "AiFeatureConfig" | "Locale" | "KeyStatistics" | "Settings" | "AILocalizationJobs", number, "adminApi">>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UpdateSettings } from '../../../shared/contracts/settings';
|
|
2
2
|
declare const useGetSettingsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/query").QueryDefinition<void, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "GuidedTourMeta" | "HomepageKeyStatistics" | "AiUsage" | "AiFeatureConfig" | "Locale" | "KeyStatistics" | "Settings" | "AILocalizationJobs", import("../../../shared/contracts/settings").Settings, "adminApi">>, useUpdatei18nSettingsMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
3
|
-
aiLocalizations?: boolean
|
|
3
|
+
aiLocalizations?: boolean;
|
|
4
4
|
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "GuidedTourMeta" | "HomepageKeyStatistics" | "AiUsage" | "AiFeatureConfig" | "Locale" | "KeyStatistics" | "Settings" | "AILocalizationJobs", UpdateSettings.Response, "adminApi">>;
|
|
5
5
|
export { useGetSettingsQuery, useUpdatei18nSettingsMutation };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { Schema } from '@strapi/types';
|
|
2
2
|
declare const mutateCTBContentTypeSchema: (nextSchema: {
|
|
3
|
-
pluginOptions: Schema.ContentType[
|
|
3
|
+
pluginOptions: Schema.ContentType["pluginOptions"];
|
|
4
4
|
attributes: Schema.Attribute.AnyAttribute[];
|
|
5
5
|
uid?: string;
|
|
6
6
|
}, prevSchema?: {
|
|
7
|
-
pluginOptions: Schema.ContentType[
|
|
7
|
+
pluginOptions: Schema.ContentType["pluginOptions"];
|
|
8
8
|
attributes: Schema.Attribute.AnyAttribute[];
|
|
9
9
|
uid?: string;
|
|
10
10
|
}) => {
|
|
11
|
-
pluginOptions: Schema.ContentType[
|
|
11
|
+
pluginOptions: Schema.ContentType["pluginOptions"];
|
|
12
12
|
attributes: Schema.Attribute.AnyAttribute[];
|
|
13
|
-
uid?: string
|
|
13
|
+
uid?: string;
|
|
14
14
|
} | {
|
|
15
15
|
pluginOptions: Pick<{
|
|
16
16
|
i18n: {
|
|
@@ -636,7 +636,7 @@ declare const mutateCTBContentTypeSchema: (nextSchema: {
|
|
|
636
636
|
column?: Partial<Schema.Attribute.Column> | undefined;
|
|
637
637
|
targetField?: string | undefined;
|
|
638
638
|
options?: Schema.Attribute.UIDOptions | undefined;
|
|
639
|
-
regex?:
|
|
639
|
+
regex?: RegExp["source"] | undefined;
|
|
640
640
|
configurable?: boolean | undefined;
|
|
641
641
|
default?: string | (() => string) | undefined;
|
|
642
642
|
minLength?: number | undefined;
|
|
@@ -646,6 +646,6 @@ declare const mutateCTBContentTypeSchema: (nextSchema: {
|
|
|
646
646
|
writable?: boolean | undefined;
|
|
647
647
|
visible?: boolean | undefined;
|
|
648
648
|
}, "type" | "required" | "column" | "visible" | "pluginOptions" | "conditions" | "writable" | "configurable" | "searchable">[];
|
|
649
|
-
uid?: string
|
|
649
|
+
uid?: string;
|
|
650
650
|
};
|
|
651
651
|
export { mutateCTBContentTypeSchema };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ja = {
|
|
4
|
+
"actions.delete.dialog.body": "このロケールを削除してもよろしいですか?",
|
|
5
|
+
"actions.delete.dialog.title": "確認",
|
|
6
|
+
"actions.delete.error": "ドキュメントロケールの削除中にエラーが発生しました。",
|
|
7
|
+
"actions.delete.label": "エントリーを削除({locale})",
|
|
8
|
+
"actions.select-locale": "ロケールを選択",
|
|
9
|
+
"CheckboxConfirmation.Modal.body": "無効にしますか?",
|
|
10
|
+
"CheckboxConfirmation.Modal.button-confirm": "はい、無効にする",
|
|
11
|
+
"CheckboxConfirmation.Modal.content": "ローカライゼーションを無効にすると、デフォルトロケールに関連付けられたコンテンツ(存在する場合)を除くすべてのコンテンツが削除されます。",
|
|
12
|
+
"CMEditViewAITranslation.job-completed": "AI翻訳が完了しました!",
|
|
13
|
+
"CMEditViewAITranslation.job-failed": "AI翻訳に失敗しました。もう一度お試しください。",
|
|
14
|
+
"CMEditViewAITranslation.settings-link": "{enabled, select, true {設定で無効にする} false {設定で有効にする} other {設定で有効にする}}",
|
|
15
|
+
"CMEditViewAITranslation.status-aria-label": "AI翻訳ステータス",
|
|
16
|
+
"CMEditViewAITranslation.status-description": "デフォルトロケールで変更を保存するたびに、AIがすべてのロケールのコンテンツを翻訳します。",
|
|
17
|
+
"CMEditViewAITranslation.status-title": "{enabled, select, true {AI翻訳有効} false {AI翻訳無効} other {AI翻訳無効}}",
|
|
18
|
+
"CMEditViewBulkLocale.continue-confirmation": "続行してもよろしいですか?",
|
|
19
|
+
"CMEditViewBulkLocale.draft-relation-warning": "一部のロケールは下書きエントリーに関連付けられています。公開するとアプリ内にリンク切れが発生する可能性があります。",
|
|
20
|
+
"CMEditViewBulkLocale.publication-status": "公開ステータス",
|
|
21
|
+
"CMEditViewBulkLocale.publish-title": "複数ロケールを公開",
|
|
22
|
+
"CMEditViewBulkLocale.status": "ステータス",
|
|
23
|
+
"CMEditViewBulkLocale.unpublish-title": "複数ロケールを非公開",
|
|
24
|
+
"CMEditViewCopyLocale.cancel-text": "いいえ、キャンセル",
|
|
25
|
+
"CMEditViewCopyLocale.copy-failure": "ロケールのコピーに失敗しました",
|
|
26
|
+
"CMEditViewCopyLocale.copy-success": "ロケールをコピーしました",
|
|
27
|
+
"CMEditViewCopyLocale.copy-text": "別のロケールから入力",
|
|
28
|
+
"CMEditViewCopyLocale.dialog.body": "現在のコンテンツは消去され、選択したロケールのコンテンツで上書きされます:",
|
|
29
|
+
"CMEditViewCopyLocale.dialog.field.label": "ロケール",
|
|
30
|
+
"CMEditViewCopyLocale.dialog.field.placeholder": "ロケールを選択...",
|
|
31
|
+
"CMEditViewCopyLocale.dialog.title": "確認",
|
|
32
|
+
"CMEditViewCopyLocale.submit-text": "はい、入力する",
|
|
33
|
+
"CMEditViewLocalePicker.locale.ai-translations": "AI翻訳:",
|
|
34
|
+
"CMEditViewLocalePicker.locale.create": "<bold>{locale}</bold>ロケールを作成",
|
|
35
|
+
"CMListView.popover.display-locales.label": "翻訳済みロケールを表示",
|
|
36
|
+
"CMListView.popover.display-locales.more": "{locales} + 他{count}件",
|
|
37
|
+
"components.Select.locales.not-available": "利用可能なコンテンツがありません",
|
|
38
|
+
"Field.localized": "この値は選択したロケール固有です",
|
|
39
|
+
"Field.not-localized": "この値はすべてのロケールで共通です",
|
|
40
|
+
"list-view.table.header.label": "利用可能なロケール",
|
|
41
|
+
"plugin.description.long": "管理パネルとAPIの両方から、異なる言語でコンテンツを作成・読み取り・更新できるプラグインです。",
|
|
42
|
+
"plugin.description.short": "管理パネルとAPIの両方から、異なる言語でコンテンツを作成・読み取り・更新できるプラグインです。",
|
|
43
|
+
"plugin.name": "国際化",
|
|
44
|
+
"plugin.schema.i18n.localized.description-content-type": "エントリーを異なる言語に翻訳できるようにします",
|
|
45
|
+
"plugin.schema.i18n.localized.description-field": "このフィールドは言語ごとに異なる値を持てます",
|
|
46
|
+
"plugin.schema.i18n.localized.label-content-type": "国際化",
|
|
47
|
+
"plugin.schema.i18n.localized.label-field": "このフィールドのローカライゼーションを有効にする",
|
|
48
|
+
"Settings.aiLocalizations.description": "コンテンツマネージャーで保存するたびに、AIがデフォルトロケールをもとに他のすべてのロケールを自動翻訳します。",
|
|
49
|
+
"Settings.aiLocalizations.label": "AI翻訳",
|
|
50
|
+
"Settings.list.actions.add": "新規ロケールを追加",
|
|
51
|
+
"Settings.list.actions.delete": "{name}ロケールを削除",
|
|
52
|
+
"Settings.list.actions.deleteAdditionalInfos": "アクティブなロケールバージョンが削除されます<em>(国際化)</em>",
|
|
53
|
+
"Settings.list.actions.edit": "{name}ロケールを編集",
|
|
54
|
+
"Settings.list.actions.publishAdditionalInfos": "アクティブなロケールバージョンが公開されます<em>(国際化)</em>",
|
|
55
|
+
"Settings.list.actions.unpublishAdditionalInfos": "アクティブなロケールバージョンが非公開になります<em>(国際化)</em>",
|
|
56
|
+
"Settings.list.description": "国際化プラグインの設定を構成します",
|
|
57
|
+
"Settings.list.empty.description": "これは通常の動作ではなく、データベースを手動で変更した可能性があります。Strapiを正しく使用するには、少なくとも1つのロケールがデータベースに保存されていることを確認してください。",
|
|
58
|
+
"Settings.list.empty.title": "ロケールがありません。",
|
|
59
|
+
"Settings.locales.default": "デフォルト",
|
|
60
|
+
"Settings.locales.list.sort.default": "デフォルトロケールで並べ替え",
|
|
61
|
+
"Settings.locales.list.sort.displayName": "表示名で並べ替え",
|
|
62
|
+
"Settings.locales.list.sort.id": "IDで並べ替え",
|
|
63
|
+
"Settings.locales.modal.advanced": "高度な設定",
|
|
64
|
+
"Settings.locales.modal.advanced.setAsDefault": "デフォルトロケールに設定",
|
|
65
|
+
"Settings.locales.modal.advanced.setAsDefault.hint": "デフォルトロケールは1つ必要です。変更するには別のロケールを選択してください",
|
|
66
|
+
"Settings.locales.modal.advanced.settings": "設定",
|
|
67
|
+
"Settings.locales.modal.base": "基本設定",
|
|
68
|
+
"Settings.locales.modal.create.code.error": "ロケールを選択してください",
|
|
69
|
+
"Settings.locales.modal.create.code.label": "ロケール",
|
|
70
|
+
"Settings.locales.modal.create.name.description": "ロケールは管理パネルでこの名前で表示されます",
|
|
71
|
+
"Settings.locales.modal.create.name.error.min": "ロケール表示名は50文字未満にしてください。",
|
|
72
|
+
"Settings.locales.modal.create.name.error.required": "ロケールの表示名を入力してください",
|
|
73
|
+
"Settings.locales.modal.create.name.label": "ロケール表示名",
|
|
74
|
+
"Settings.locales.modal.create.success": "ロケールを追加しました",
|
|
75
|
+
"Settings.locales.modal.delete.confirm": "はい、削除する",
|
|
76
|
+
"Settings.locales.modal.delete.message": "このロケールを削除すると、関連付けられたすべてのコンテンツが削除されます。残したいコンテンツがある場合は、先に別のロケールへ移し替えてください。",
|
|
77
|
+
"Settings.locales.modal.delete.secondMessage": "このロケールを削除しますか?",
|
|
78
|
+
"Settings.locales.modal.delete.success": "ロケールを削除しました",
|
|
79
|
+
"Settings.locales.modal.edit.confirmation": "完了",
|
|
80
|
+
"Settings.locales.modal.edit.success": "ロケールを編集しました",
|
|
81
|
+
"Settings.locales.modal.edit.tab.label": "I18Nの基本設定と高度な設定の切り替え",
|
|
82
|
+
"Settings.locales.modal.title": "設定",
|
|
83
|
+
"Settings.locales.row.default-locale": "デフォルトロケール",
|
|
84
|
+
"Settings.locales.row.displayName": "表示名",
|
|
85
|
+
"Settings.locales.row.id": "ID",
|
|
86
|
+
"Settings.permissions.loading": "権限を読み込み中",
|
|
87
|
+
"Settings.permissions.read.denied.description": "これを閲覧するには、システム管理者にお問い合わせください。",
|
|
88
|
+
"Settings.permissions.read.denied.title": "このコンテンツにアクセスする権限がありません。"
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
module.exports = ja;
|
|
92
|
+
//# sourceMappingURL=ja.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ja.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var ja = {
|
|
2
|
+
"actions.delete.dialog.body": "このロケールを削除してもよろしいですか?",
|
|
3
|
+
"actions.delete.dialog.title": "確認",
|
|
4
|
+
"actions.delete.error": "ドキュメントロケールの削除中にエラーが発生しました。",
|
|
5
|
+
"actions.delete.label": "エントリーを削除({locale})",
|
|
6
|
+
"actions.select-locale": "ロケールを選択",
|
|
7
|
+
"CheckboxConfirmation.Modal.body": "無効にしますか?",
|
|
8
|
+
"CheckboxConfirmation.Modal.button-confirm": "はい、無効にする",
|
|
9
|
+
"CheckboxConfirmation.Modal.content": "ローカライゼーションを無効にすると、デフォルトロケールに関連付けられたコンテンツ(存在する場合)を除くすべてのコンテンツが削除されます。",
|
|
10
|
+
"CMEditViewAITranslation.job-completed": "AI翻訳が完了しました!",
|
|
11
|
+
"CMEditViewAITranslation.job-failed": "AI翻訳に失敗しました。もう一度お試しください。",
|
|
12
|
+
"CMEditViewAITranslation.settings-link": "{enabled, select, true {設定で無効にする} false {設定で有効にする} other {設定で有効にする}}",
|
|
13
|
+
"CMEditViewAITranslation.status-aria-label": "AI翻訳ステータス",
|
|
14
|
+
"CMEditViewAITranslation.status-description": "デフォルトロケールで変更を保存するたびに、AIがすべてのロケールのコンテンツを翻訳します。",
|
|
15
|
+
"CMEditViewAITranslation.status-title": "{enabled, select, true {AI翻訳有効} false {AI翻訳無効} other {AI翻訳無効}}",
|
|
16
|
+
"CMEditViewBulkLocale.continue-confirmation": "続行してもよろしいですか?",
|
|
17
|
+
"CMEditViewBulkLocale.draft-relation-warning": "一部のロケールは下書きエントリーに関連付けられています。公開するとアプリ内にリンク切れが発生する可能性があります。",
|
|
18
|
+
"CMEditViewBulkLocale.publication-status": "公開ステータス",
|
|
19
|
+
"CMEditViewBulkLocale.publish-title": "複数ロケールを公開",
|
|
20
|
+
"CMEditViewBulkLocale.status": "ステータス",
|
|
21
|
+
"CMEditViewBulkLocale.unpublish-title": "複数ロケールを非公開",
|
|
22
|
+
"CMEditViewCopyLocale.cancel-text": "いいえ、キャンセル",
|
|
23
|
+
"CMEditViewCopyLocale.copy-failure": "ロケールのコピーに失敗しました",
|
|
24
|
+
"CMEditViewCopyLocale.copy-success": "ロケールをコピーしました",
|
|
25
|
+
"CMEditViewCopyLocale.copy-text": "別のロケールから入力",
|
|
26
|
+
"CMEditViewCopyLocale.dialog.body": "現在のコンテンツは消去され、選択したロケールのコンテンツで上書きされます:",
|
|
27
|
+
"CMEditViewCopyLocale.dialog.field.label": "ロケール",
|
|
28
|
+
"CMEditViewCopyLocale.dialog.field.placeholder": "ロケールを選択...",
|
|
29
|
+
"CMEditViewCopyLocale.dialog.title": "確認",
|
|
30
|
+
"CMEditViewCopyLocale.submit-text": "はい、入力する",
|
|
31
|
+
"CMEditViewLocalePicker.locale.ai-translations": "AI翻訳:",
|
|
32
|
+
"CMEditViewLocalePicker.locale.create": "<bold>{locale}</bold>ロケールを作成",
|
|
33
|
+
"CMListView.popover.display-locales.label": "翻訳済みロケールを表示",
|
|
34
|
+
"CMListView.popover.display-locales.more": "{locales} + 他{count}件",
|
|
35
|
+
"components.Select.locales.not-available": "利用可能なコンテンツがありません",
|
|
36
|
+
"Field.localized": "この値は選択したロケール固有です",
|
|
37
|
+
"Field.not-localized": "この値はすべてのロケールで共通です",
|
|
38
|
+
"list-view.table.header.label": "利用可能なロケール",
|
|
39
|
+
"plugin.description.long": "管理パネルとAPIの両方から、異なる言語でコンテンツを作成・読み取り・更新できるプラグインです。",
|
|
40
|
+
"plugin.description.short": "管理パネルとAPIの両方から、異なる言語でコンテンツを作成・読み取り・更新できるプラグインです。",
|
|
41
|
+
"plugin.name": "国際化",
|
|
42
|
+
"plugin.schema.i18n.localized.description-content-type": "エントリーを異なる言語に翻訳できるようにします",
|
|
43
|
+
"plugin.schema.i18n.localized.description-field": "このフィールドは言語ごとに異なる値を持てます",
|
|
44
|
+
"plugin.schema.i18n.localized.label-content-type": "国際化",
|
|
45
|
+
"plugin.schema.i18n.localized.label-field": "このフィールドのローカライゼーションを有効にする",
|
|
46
|
+
"Settings.aiLocalizations.description": "コンテンツマネージャーで保存するたびに、AIがデフォルトロケールをもとに他のすべてのロケールを自動翻訳します。",
|
|
47
|
+
"Settings.aiLocalizations.label": "AI翻訳",
|
|
48
|
+
"Settings.list.actions.add": "新規ロケールを追加",
|
|
49
|
+
"Settings.list.actions.delete": "{name}ロケールを削除",
|
|
50
|
+
"Settings.list.actions.deleteAdditionalInfos": "アクティブなロケールバージョンが削除されます<em>(国際化)</em>",
|
|
51
|
+
"Settings.list.actions.edit": "{name}ロケールを編集",
|
|
52
|
+
"Settings.list.actions.publishAdditionalInfos": "アクティブなロケールバージョンが公開されます<em>(国際化)</em>",
|
|
53
|
+
"Settings.list.actions.unpublishAdditionalInfos": "アクティブなロケールバージョンが非公開になります<em>(国際化)</em>",
|
|
54
|
+
"Settings.list.description": "国際化プラグインの設定を構成します",
|
|
55
|
+
"Settings.list.empty.description": "これは通常の動作ではなく、データベースを手動で変更した可能性があります。Strapiを正しく使用するには、少なくとも1つのロケールがデータベースに保存されていることを確認してください。",
|
|
56
|
+
"Settings.list.empty.title": "ロケールがありません。",
|
|
57
|
+
"Settings.locales.default": "デフォルト",
|
|
58
|
+
"Settings.locales.list.sort.default": "デフォルトロケールで並べ替え",
|
|
59
|
+
"Settings.locales.list.sort.displayName": "表示名で並べ替え",
|
|
60
|
+
"Settings.locales.list.sort.id": "IDで並べ替え",
|
|
61
|
+
"Settings.locales.modal.advanced": "高度な設定",
|
|
62
|
+
"Settings.locales.modal.advanced.setAsDefault": "デフォルトロケールに設定",
|
|
63
|
+
"Settings.locales.modal.advanced.setAsDefault.hint": "デフォルトロケールは1つ必要です。変更するには別のロケールを選択してください",
|
|
64
|
+
"Settings.locales.modal.advanced.settings": "設定",
|
|
65
|
+
"Settings.locales.modal.base": "基本設定",
|
|
66
|
+
"Settings.locales.modal.create.code.error": "ロケールを選択してください",
|
|
67
|
+
"Settings.locales.modal.create.code.label": "ロケール",
|
|
68
|
+
"Settings.locales.modal.create.name.description": "ロケールは管理パネルでこの名前で表示されます",
|
|
69
|
+
"Settings.locales.modal.create.name.error.min": "ロケール表示名は50文字未満にしてください。",
|
|
70
|
+
"Settings.locales.modal.create.name.error.required": "ロケールの表示名を入力してください",
|
|
71
|
+
"Settings.locales.modal.create.name.label": "ロケール表示名",
|
|
72
|
+
"Settings.locales.modal.create.success": "ロケールを追加しました",
|
|
73
|
+
"Settings.locales.modal.delete.confirm": "はい、削除する",
|
|
74
|
+
"Settings.locales.modal.delete.message": "このロケールを削除すると、関連付けられたすべてのコンテンツが削除されます。残したいコンテンツがある場合は、先に別のロケールへ移し替えてください。",
|
|
75
|
+
"Settings.locales.modal.delete.secondMessage": "このロケールを削除しますか?",
|
|
76
|
+
"Settings.locales.modal.delete.success": "ロケールを削除しました",
|
|
77
|
+
"Settings.locales.modal.edit.confirmation": "完了",
|
|
78
|
+
"Settings.locales.modal.edit.success": "ロケールを編集しました",
|
|
79
|
+
"Settings.locales.modal.edit.tab.label": "I18Nの基本設定と高度な設定の切り替え",
|
|
80
|
+
"Settings.locales.modal.title": "設定",
|
|
81
|
+
"Settings.locales.row.default-locale": "デフォルトロケール",
|
|
82
|
+
"Settings.locales.row.displayName": "表示名",
|
|
83
|
+
"Settings.locales.row.id": "ID",
|
|
84
|
+
"Settings.permissions.loading": "権限を読み込み中",
|
|
85
|
+
"Settings.permissions.read.denied.description": "これを閲覧するには、システム管理者にお問い合わせください。",
|
|
86
|
+
"Settings.permissions.read.denied.title": "このコンテンツにアクセスする権限がありません。"
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export { ja as default };
|
|
90
|
+
//# sourceMappingURL=ja.json.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ja.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var has = require('lodash/has');
|
|
4
4
|
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var has__default = /*#__PURE__*/_interopDefault(has);
|
|
8
|
+
|
|
5
9
|
const LOCALIZED_FIELDS = [
|
|
6
10
|
'biginteger',
|
|
7
11
|
'boolean',
|
|
@@ -24,7 +28,7 @@ const LOCALIZED_FIELDS = [
|
|
|
24
28
|
'text',
|
|
25
29
|
'time'
|
|
26
30
|
];
|
|
27
|
-
const doesPluginOptionsHaveI18nLocalized = (opts)=>
|
|
31
|
+
const doesPluginOptionsHaveI18nLocalized = (opts)=>has__default.default(opts, [
|
|
28
32
|
'i18n',
|
|
29
33
|
'localized'
|
|
30
34
|
]);
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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,gBAAAA,GAAmB;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,kCAAAA,GAAqC,CACzCC,IAAAA,GAC6CC,oBAAAA,CAAID,IAAAA,EAAM;AAAC,QAAA,MAAA;AAAQ,QAAA;AAAY,KAAA;;;;;"}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
var omit = require('lodash/omit');
|
|
4
4
|
var fields = require('./fields.js');
|
|
5
5
|
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var omit__default = /*#__PURE__*/_interopDefault(omit);
|
|
9
|
+
|
|
6
10
|
/* -------------------------------------------------------------------------------------------------
|
|
7
11
|
* mutateCTBContentTypeSchema
|
|
8
12
|
* -----------------------------------------------------------------------------------------------*/ // TODO: refactor for CTB refactors
|
|
@@ -30,7 +34,7 @@ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
|
|
|
30
34
|
}
|
|
31
35
|
// Remove the i18n object from the pluginOptions
|
|
32
36
|
if (!isNextSchemaLocalized) {
|
|
33
|
-
const pluginOptions =
|
|
37
|
+
const pluginOptions = omit__default.default(nextSchema.pluginOptions, 'i18n');
|
|
34
38
|
const attributes = disableAttributesLocalisation(nextSchema.attributes);
|
|
35
39
|
return {
|
|
36
40
|
...nextSchema,
|
|
@@ -66,7 +70,7 @@ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
|
|
|
66
70
|
* disableAttributesLocalisation
|
|
67
71
|
* -----------------------------------------------------------------------------------------------*/ const disableAttributesLocalisation = (attributes)=>{
|
|
68
72
|
return attributes.map((currentAttribute)=>{
|
|
69
|
-
return
|
|
73
|
+
return omit__default.default(currentAttribute, 'pluginOptions.i18n');
|
|
70
74
|
});
|
|
71
75
|
};
|
|
72
76
|
|
|
@@ -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\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":"
|
|
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;AAGlG,MAAMA,0BAAAA,GAA6B,CACjCC,UAAAA,EAKAC,UAAAA,GAAAA;AAMA,IAAA,IAAI,CAACA,UAAAA,EAAY;QACf,OAAOD,UAAAA;AACT,IAAA;;AAGA,IAAA,IAAI,CAACE,yCAAAA,CAAmCF,UAAAA,CAAWG,aAAa,CAAA,EAAG;QACjE,OAAOH,UAAAA;AACT,IAAA;AAEA,IAAA,MAAMI,wBAAwBJ,UAAAA,CAAWG,aAAa,CAACE,IAAI,CAAC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A;AACT,IAAA,CAAA,CAAA;AACF,CAAA;AAEA;;qGAIA,MAAMF,gCAAgC,CAACH,UAAAA,GAAAA;IACrC,OAAOA,UAAAA,CAAWI,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,OAAOH,sBAAKG,gBAAAA,EAAkB,oBAAA,CAAA;AAChC,IAAA,CAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -6,7 +6,8 @@ var index = require('../utils/index.js');
|
|
|
6
6
|
var locales = require('../validation/locales.js');
|
|
7
7
|
var locale = require('../domain/locale.js');
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
10
11
|
var n = Object.create(null);
|
|
11
12
|
if (e) {
|
|
12
13
|
Object.keys(e).forEach(function (k) {
|
|
@@ -23,7 +24,7 @@ function _interopNamespaceDefault(e) {
|
|
|
23
24
|
return Object.freeze(n);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
var utils__namespace = /*#__PURE__*/
|
|
27
|
+
var utils__namespace = /*#__PURE__*/_interopNamespace(utils);
|
|
27
28
|
|
|
28
29
|
const { setCreatorFields } = utils__namespace;
|
|
29
30
|
const { ApplicationError } = utils__namespace.errors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.js","sources":["../../../server/src/controllers/locales.ts"],"sourcesContent":["import * as utils from '@strapi/utils';\nimport { pick } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\nimport { getService } from '../utils';\nimport { validateCreateLocaleInput, validateUpdateLocaleInput } from '../validation/locales';\nimport { formatLocale } from '../domain/locale';\n\nconst { setCreatorFields } = utils;\nconst { ApplicationError } = utils.errors;\n\nconst sanitizeLocale = (locale: any) => {\n const model = strapi.getModel('plugin::i18n.locale');\n\n return strapi.contentAPI.sanitize.output(locale, model);\n};\n\nconst controller: Core.Controller = {\n async listLocales(ctx) {\n const localesService = getService('locales');\n\n const locales = await localesService.find();\n const sanitizedLocales = await sanitizeLocale(locales);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocales);\n },\n\n async createLocale(ctx) {\n const { user } = ctx.state;\n const body = ctx.request.body as any;\n const { isDefault, ...localeToCreate } = body;\n\n await validateCreateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findByCode(body.code);\n if (existingLocale) {\n throw new ApplicationError('This locale already exists');\n }\n\n const localeToPersist = setCreatorFields({ user })(formatLocale(localeToCreate));\n\n const locale = await localesService.create(localeToPersist);\n\n if (isDefault) {\n await localesService.setDefaultLocale(locale);\n }\n\n const sanitizedLocale = await sanitizeLocale(locale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async updateLocale(ctx) {\n const { user } = ctx.state;\n const { id } = ctx.params;\n const body = ctx.request.body as any;\n const { isDefault, ...updates } = body;\n\n await validateUpdateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const allowedParams = ['name'];\n const cleanUpdates = setCreatorFields({ user, isEdition: true })(pick(allowedParams, updates));\n\n const updatedLocale = await localesService.update({ id }, cleanUpdates);\n\n if (isDefault) {\n await localesService.setDefaultLocale(updatedLocale);\n }\n\n const sanitizedLocale = await sanitizeLocale(updatedLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async deleteLocale(ctx) {\n const { id } = ctx.params;\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const defaultLocaleCode = await localesService.getDefaultLocale();\n if (existingLocale.code === defaultLocaleCode) {\n throw new ApplicationError('Cannot delete the default locale');\n }\n\n await localesService.delete({ id });\n\n const sanitizedLocale = await sanitizeLocale(existingLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n};\n\nexport default controller;\n"],"names":["setCreatorFields","utils","ApplicationError","errors","sanitizeLocale","locale","model","strapi","getModel","contentAPI","sanitize","output","controller","listLocales","ctx","localesService","getService","locales","find","sanitizedLocales","body","setIsDefault","createLocale","user","state","request","isDefault","localeToCreate","validateCreateLocaleInput","existingLocale","findByCode","code","localeToPersist","formatLocale","create","setDefaultLocale","sanitizedLocale","updateLocale","id","params","updates","validateUpdateLocaleInput","findById","notFound","allowedParams","cleanUpdates","isEdition","pick","updatedLocale","update","deleteLocale","defaultLocaleCode","getDefaultLocale","delete"],"mappings":"
|
|
1
|
+
{"version":3,"file":"locales.js","sources":["../../../server/src/controllers/locales.ts"],"sourcesContent":["import * as utils from '@strapi/utils';\nimport { pick } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\nimport { getService } from '../utils';\nimport { validateCreateLocaleInput, validateUpdateLocaleInput } from '../validation/locales';\nimport { formatLocale } from '../domain/locale';\n\nconst { setCreatorFields } = utils;\nconst { ApplicationError } = utils.errors;\n\nconst sanitizeLocale = (locale: any) => {\n const model = strapi.getModel('plugin::i18n.locale');\n\n return strapi.contentAPI.sanitize.output(locale, model);\n};\n\nconst controller: Core.Controller = {\n async listLocales(ctx) {\n const localesService = getService('locales');\n\n const locales = await localesService.find();\n const sanitizedLocales = await sanitizeLocale(locales);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocales);\n },\n\n async createLocale(ctx) {\n const { user } = ctx.state;\n const body = ctx.request.body as any;\n const { isDefault, ...localeToCreate } = body;\n\n await validateCreateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findByCode(body.code);\n if (existingLocale) {\n throw new ApplicationError('This locale already exists');\n }\n\n const localeToPersist = setCreatorFields({ user })(formatLocale(localeToCreate));\n\n const locale = await localesService.create(localeToPersist);\n\n if (isDefault) {\n await localesService.setDefaultLocale(locale);\n }\n\n const sanitizedLocale = await sanitizeLocale(locale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async updateLocale(ctx) {\n const { user } = ctx.state;\n const { id } = ctx.params;\n const body = ctx.request.body as any;\n const { isDefault, ...updates } = body;\n\n await validateUpdateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const allowedParams = ['name'];\n const cleanUpdates = setCreatorFields({ user, isEdition: true })(pick(allowedParams, updates));\n\n const updatedLocale = await localesService.update({ id }, cleanUpdates);\n\n if (isDefault) {\n await localesService.setDefaultLocale(updatedLocale);\n }\n\n const sanitizedLocale = await sanitizeLocale(updatedLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async deleteLocale(ctx) {\n const { id } = ctx.params;\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const defaultLocaleCode = await localesService.getDefaultLocale();\n if (existingLocale.code === defaultLocaleCode) {\n throw new ApplicationError('Cannot delete the default locale');\n }\n\n await localesService.delete({ id });\n\n const sanitizedLocale = await sanitizeLocale(existingLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n};\n\nexport default controller;\n"],"names":["setCreatorFields","utils","ApplicationError","errors","sanitizeLocale","locale","model","strapi","getModel","contentAPI","sanitize","output","controller","listLocales","ctx","localesService","getService","locales","find","sanitizedLocales","body","setIsDefault","createLocale","user","state","request","isDefault","localeToCreate","validateCreateLocaleInput","existingLocale","findByCode","code","localeToPersist","formatLocale","create","setDefaultLocale","sanitizedLocale","updateLocale","id","params","updates","validateUpdateLocaleInput","findById","notFound","allowedParams","cleanUpdates","isEdition","pick","updatedLocale","update","deleteLocale","defaultLocaleCode","getDefaultLocale","delete"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,gBAAAA;AAC7B,MAAM,EAAEC,gBAAgB,EAAE,GAAGD,iBAAME,MAAM;AAEzC,MAAMC,iBAAiB,CAACC,MAAAA,GAAAA;IACtB,MAAMC,K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AAA,EAAW;YACb,MAAMX,cAAAA,CAAeoB,gBAAgB,CAACa,aAAAA,CAAAA;AACxC,QAAA;QAEA,MAAMZ,eAAAA,GAAkB,MAAMhC,cAAAA,CAAe4C,aAAAA,CAAAA;AAE7ClC,QAAAA,GAAAA,CAAIM,IAAI,GAAG,MAAML,cAAAA,CAAeM,YAAY,CAACe,eAAAA,CAAAA;AAC/C,IAAA,CAAA;AAEA,IAAA,MAAMc,cAAapC,GAAG,EAAA;AACpB,QAAA,MAAM,EAAEwB,EAAE,EAAE,GAAGxB,IAAIyB,MAAM;AAEzB,QAAA,MAAMxB,iBAAiBC,gBAAAA,CAAW,SAAA,CAAA;AAElC,QAAA,MAAMa,cAAAA,GAAiB,MAAMd,cAAAA,CAAe2B,QAAQ,CAACJ,EAAAA,CAAAA;AACrD,QAAA,IAAI,CAACT,cAAAA,EAAgB;YACnB,OAAOf,GAAAA,CAAI6B,QAAQ,CAAC,iBAAA,CAAA;AACtB,QAAA;QAEA,MAAMQ,iBAAAA,GAAoB,MAAMpC,cAAAA,CAAeqC,gBAAgB,EAAA;QAC/D,IAAIvB,cAAAA,CAAeE,IAAI,KAAKoB,iBAAAA,EAAmB;AAC7C,YAAA,MAAM,IAAIjD,gBAAAA,CAAiB,kCAAA,CAAA;AAC7B,QAAA;QAEA,MAAMa,cAAAA,CAAesC,MAAM,CAAC;AAAEf,YAAAA;AAAG,SAAA,CAAA;QAEjC,MAAMF,eAAAA,GAAkB,MAAMhC,cAAAA,CAAeyB,cAAAA,CAAAA;AAE7Cf,QAAAA,GAAAA,CAAIM,IAAI,GAAG,MAAML,cAAAA,CAAeM,YAAY,CAACe,eAAAA,CAAAA;AAC/C,IAAA;AACF;;;;"}
|
package/dist/server/register.js
CHANGED
|
@@ -6,10 +6,18 @@ var graphql = require('./graphql.js');
|
|
|
6
6
|
var index = require('./utils/index.js');
|
|
7
7
|
var aiLocalizationJob = require('./models/ai-localization-job.js');
|
|
8
8
|
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var ___default = /*#__PURE__*/_interopDefault(_);
|
|
12
|
+
|
|
9
13
|
var register = (async ({ strapi })=>{
|
|
10
14
|
strapi.get('models').add(aiLocalizationJob.aiLocalizationJob);
|
|
11
15
|
extendContentTypes(strapi);
|
|
12
16
|
addContentManagerLocaleMiddleware(strapi);
|
|
17
|
+
strapi.hook('strapi::content-types.afterSync').register(({ oldContentTypes, contentTypes })=>index.getService('permissions').actions.repairPermissionsForNewlyLocalizedTypes({
|
|
18
|
+
oldContentTypes,
|
|
19
|
+
contentTypes
|
|
20
|
+
}));
|
|
13
21
|
});
|
|
14
22
|
// TODO: v5 if implemented in the CM => delete this middleware
|
|
15
23
|
/**
|
|
@@ -38,14 +46,14 @@ var register = (async ({ strapi })=>{
|
|
|
38
46
|
Object.values(strapi.contentTypes).forEach((contentType)=>{
|
|
39
47
|
const { attributes } = contentType;
|
|
40
48
|
const isLocalized = isLocalizedContentType(contentType);
|
|
41
|
-
|
|
49
|
+
___default.default.set(attributes, 'locale', {
|
|
42
50
|
writable: true,
|
|
43
51
|
private: !isLocalized,
|
|
44
52
|
configurable: false,
|
|
45
53
|
visible: false,
|
|
46
54
|
type: 'string'
|
|
47
55
|
});
|
|
48
|
-
|
|
56
|
+
___default.default.set(attributes, 'localizations', {
|
|
49
57
|
type: 'relation',
|
|
50
58
|
relation: 'oneToMany',
|
|
51
59
|
target: contentType.uid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\nimport { aiLocalizationJob } from './models/ai-localization-job';\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.get('models').add(aiLocalizationJob);\n\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","get","add","aiLocalizationJob","extendContentTypes","addContentManagerLocaleMiddleware","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","
|
|
1
|
+
{"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\nimport { aiLocalizationJob } from './models/ai-localization-job';\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.get('models').add(aiLocalizationJob);\n\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n\n strapi\n .hook('strapi::content-types.afterSync')\n .register(({ oldContentTypes, contentTypes }: any) =>\n getService('permissions').actions.repairPermissionsForNewlyLocalizedTypes({\n oldContentTypes,\n contentTypes,\n })\n );\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","get","add","aiLocalizationJob","extendContentTypes","addContentManagerLocaleMiddleware","hook","register","oldContentTypes","contentTypes","getService","actions","repairPermissionsForNewlyLocalizedTypes","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","Object","values","forEach","contentType","attributes","isLocalized","_","set","writable","private","configurable","visible","type","relation","target","uid","unstable_virtual","joinColumn","name","referencedColumn","referencedTable","db","metadata","identifiers","getTableName","collectionName","on","results","id","$notIn","map","r","plugin","graphqlProvider"],"mappings":";;;;;;;;;;;;AAQA,eAAe,CAAA,OAAO,EAAEA,MAAM,EAA2B,GAAA;AACvDA,IAAAA,MAAAA,CAAOC,GAAG,CAAC,QAAA,CAAA,CAAUC,GAAG,CAACC,mCAAAA,CAAAA;IAEzBC,kBAAAA,CAAmBJ,MAAAA,CAAAA;IACnBK,iCAAAA,CAAkCL,MAAAA,CAAAA;AAElCA,IAAAA,MAAAA,CACGM,IAAI,CAAC,iCAAA,CAAA,CACLC,QAAQ,CAAC,CAAC,EAAEC,eAAe,EAAEC,YAAY,EAAO,GAC/CC,gBAAAA,CAAW,eAAeC,OAAO,CAACC,uCAAuC,CAAC;AACxEJ,YAAAA,eAAAA;AACAC,YAAAA;AACF,SAAA,CAAA,CAAA;AAEN,CAAA;AAEA;AACA;;;IAIA,MAAMJ,oCAAoC,CAACL,MAAAA,GAAAA;IACzCA,MAAAA,CAAOa,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,0CAAA,EAA4C,CAACC,GAAAA,EAAKC,IAAAA,GAAAA;AACzE,QAAA,IAAID,IAAIE,MAAM,KAAK,UAAUF,GAAAA,CAAIE,MAAM,KAAK,KAAA,EAAO;AACjD,YAAA,OAAOC,uBAA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OAAAA,EAAS,KAAA;YACTK,gBAAAA,EAAkB,IAAA;YAClBC,UAAAA,EAAY;gBACVC,IAAAA,EAAM,aAAA;gBACNC,gBAAAA,EAAkB,aAAA;gBAClBC,eAAAA,EAAiBzC,MAAAA,CAAO0C,EAAE,CAACC,QAAQ,CAACC,WAAW,CAACC,YAAY,CAACrB,WAAAA,CAAYsB,cAAc,CAAA;;gBAEvFC,EAAAA,CAAAA,CAAG,EAAEC,OAAO,EAAsB,EAAA;oBAChC,OAAO;wBACLC,EAAAA,EAAI;AACFC,4BAAAA,MAAAA,EAAQF,QAAQG,GAAG,CAAC,CAACC,CAAAA,GAAMA,EAAEH,EAAE;AACjC;AACF,qBAAA;AACF,gBAAA;AACF;AACF,SAAA,CAAA;AACF,IAAA,CAAA,CAAA;IAEA,IAAIjD,MAAAA,CAAOqD,MAAM,CAAC,SAAA,CAAA,EAAY;;QAE5BC,OAAAA,CAAgB;AAAEtD,YAAAA;AAAO,SAAA,CAAA,CAAGO,QAAQ,EAAA;AACtC,IAAA;AACF,CAAA;;;;"}
|
package/dist/server/register.mjs
CHANGED
|
@@ -8,6 +8,10 @@ var register = (async ({ strapi })=>{
|
|
|
8
8
|
strapi.get('models').add(aiLocalizationJob);
|
|
9
9
|
extendContentTypes(strapi);
|
|
10
10
|
addContentManagerLocaleMiddleware(strapi);
|
|
11
|
+
strapi.hook('strapi::content-types.afterSync').register(({ oldContentTypes, contentTypes })=>getService('permissions').actions.repairPermissionsForNewlyLocalizedTypes({
|
|
12
|
+
oldContentTypes,
|
|
13
|
+
contentTypes
|
|
14
|
+
}));
|
|
11
15
|
});
|
|
12
16
|
// TODO: v5 if implemented in the CM => delete this middleware
|
|
13
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\nimport { aiLocalizationJob } from './models/ai-localization-job';\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.get('models').add(aiLocalizationJob);\n\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","get","add","aiLocalizationJob","extendContentTypes","addContentManagerLocaleMiddleware","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","
|
|
1
|
+
{"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\nimport { aiLocalizationJob } from './models/ai-localization-job';\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.get('models').add(aiLocalizationJob);\n\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n\n strapi\n .hook('strapi::content-types.afterSync')\n .register(({ oldContentTypes, contentTypes }: any) =>\n getService('permissions').actions.repairPermissionsForNewlyLocalizedTypes({\n oldContentTypes,\n contentTypes,\n })\n );\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","get","add","aiLocalizationJob","extendContentTypes","addContentManagerLocaleMiddleware","hook","register","oldContentTypes","contentTypes","getService","actions","repairPermissionsForNewlyLocalizedTypes","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","Object","values","forEach","contentType","attributes","isLocalized","_","set","writable","private","configurable","visible","type","relation","target","uid","unstable_virtual","joinColumn","name","referencedColumn","referencedTable","db","metadata","identifiers","getTableName","collectionName","on","results","id","$notIn","map","r","plugin","graphqlProvider"],"mappings":";;;;;;AAQA,eAAe,CAAA,OAAO,EAAEA,MAAM,EAA2B,GAAA;AACvDA,IAAAA,MAAAA,CAAOC,GAAG,CAAC,QAAA,CAAA,CAAUC,GAAG,CAACC,iBAAAA,CAAAA;IAEzBC,kBAAAA,CAAmBJ,MAAAA,CAAAA;IACnBK,iCAAAA,CAAkCL,MAAAA,CAAAA;AAElCA,IAAAA,MAAAA,CACGM,IAAI,CAAC,iCAAA,CAAA,CACLC,QAAQ,CAAC,CAAC,EAAEC,eAAe,EAAEC,YAAY,EAAO,GAC/CC,UAAAA,CAAW,eAAeC,OAAO,CAACC,uCAAuC,CAAC;AACxEJ,YAAAA,eAAAA;AACAC,YAAAA;AACF,SAAA,CAAA,CAAA;AAEN,CAAA;AAEA;AACA;;;IAIA,MAAMJ,oCAAoC,CAACL,MAAAA,GAAAA;IACzCA,MAAAA,CAAOa,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,0CAAA,EAA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