Skip to content

Commit

Permalink
Merge pull request strapi#17270 from strapi/fix/issue-10120
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebodin authored Jul 12, 2023
2 parents c6c9e21 + 34c2a41 commit 75b41ce
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"kind": "collectionType",
"info": {
"displayName": "Test",
"singularName": "test",
"pluralName": "tests",
"description": ""
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"type": {
"type": "string",
"required": true,
"unique": true,
"pluginOptions": {
"i18n": {
"localized": true
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@
"options": {
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"type": {
"type": "string",
"required": true,
"unique": true,
"configurable": true
"configurable": true,
"pluginOptions": {
"i18n": {
"localized": true
}
}
}
}
}
5 changes: 5 additions & 0 deletions packages/plugins/i18n/server/services/core-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ const createLocalizationRoute = (contentType) => {
const addCreateLocalizationAction = (contentType) => {
const { modelName, apiName } = contentType;

// in case we add i18N to a content type that is not in an api
if (!apiName) {
return;
}

const localizationRoute = createLocalizationRoute(contentType);

strapi.api[apiName].routes[modelName].routes.push(localizationRoute);
Expand Down

0 comments on commit 75b41ce

Please sign in to comment.