From 08537add35463c4911fe3131fe063d8af206e0ec Mon Sep 17 00:00:00 2001 From: trivernis Date: Fri, 5 Jul 2024 23:22:25 +0200 Subject: [PATCH] Add i18n --- .../content-types/blog-collection/schema.json | 27 ++++++- .../content-types/blog-post/schema.json | 20 ++++- src/api/tag/content-types/tag/schema.json | 13 +++- types/generated/contentTypes.d.ts | 78 +++++++++++++++++-- 4 files changed, 123 insertions(+), 15 deletions(-) diff --git a/src/api/blog-collection/content-types/blog-collection/schema.json b/src/api/blog-collection/content-types/blog-collection/schema.json index 65dda29..17ae276 100644 --- a/src/api/blog-collection/content-types/blog-collection/schema.json +++ b/src/api/blog-collection/content-types/blog-collection/schema.json @@ -10,12 +10,21 @@ "options": { "draftAndPublish": true }, - "pluginOptions": {}, + "pluginOptions": { + "i18n": { + "localized": true + } + }, "attributes": { "name": { "type": "string", "required": true, - "unique": true + "unique": false, + "pluginOptions": { + "i18n": { + "localized": true + } + } }, "slug": { "type": "uid", @@ -30,10 +39,20 @@ "files", "videos", "audios" - ] + ], + "pluginOptions": { + "i18n": { + "localized": true + } + } }, "description": { - "type": "text" + "type": "text", + "pluginOptions": { + "i18n": { + "localized": true + } + } }, "posts": { "type": "relation", diff --git a/src/api/blog-post/content-types/blog-post/schema.json b/src/api/blog-post/content-types/blog-post/schema.json index 8359650..60a5b90 100644 --- a/src/api/blog-post/content-types/blog-post/schema.json +++ b/src/api/blog-post/content-types/blog-post/schema.json @@ -10,7 +10,11 @@ "options": { "draftAndPublish": true }, - "pluginOptions": {}, + "pluginOptions": { + "i18n": { + "localized": true + } + }, "attributes": { "slug": { "type": "uid", @@ -19,7 +23,12 @@ }, "title": { "type": "string", - "required": true + "required": true, + "pluginOptions": { + "i18n": { + "localized": true + } + } }, "author": { "type": "relation", @@ -32,7 +41,12 @@ "content.gallery", "content.image", "content.text-markdown" - ] + ], + "pluginOptions": { + "i18n": { + "localized": true + } + } }, "tags": { "type": "relation", diff --git a/src/api/tag/content-types/tag/schema.json b/src/api/tag/content-types/tag/schema.json index 5579012..4f1399a 100644 --- a/src/api/tag/content-types/tag/schema.json +++ b/src/api/tag/content-types/tag/schema.json @@ -10,11 +10,20 @@ "options": { "draftAndPublish": true }, - "pluginOptions": {}, + "pluginOptions": { + "i18n": { + "localized": true + } + }, "attributes": { "name": { "type": "string", - "required": true + "required": true, + "pluginOptions": { + "i18n": { + "localized": true + } + } }, "slug": { "type": "uid", diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index f17a67d..de70516 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -874,11 +874,32 @@ export interface ApiBlogCollectionBlogCollection extends Schema.CollectionType { options: { draftAndPublish: true; }; + pluginOptions: { + i18n: { + localized: true; + }; + }; attributes: { - name: Attribute.String & Attribute.Required & Attribute.Unique; + name: Attribute.String & + Attribute.Required & + Attribute.SetPluginOptions<{ + i18n: { + localized: true; + }; + }>; slug: Attribute.UID<'api::blog-collection.blog-collection', 'name'>; - picture: Attribute.Media<'images' | 'files' | 'videos' | 'audios'>; - description: Attribute.Text; + picture: Attribute.Media<'images' | 'files' | 'videos' | 'audios'> & + Attribute.SetPluginOptions<{ + i18n: { + localized: true; + }; + }>; + description: Attribute.Text & + Attribute.SetPluginOptions<{ + i18n: { + localized: true; + }; + }>; posts: Attribute.Relation< 'api::blog-collection.blog-collection', 'oneToMany', @@ -899,6 +920,12 @@ export interface ApiBlogCollectionBlogCollection extends Schema.CollectionType { 'admin::user' > & Attribute.Private; + localizations: Attribute.Relation< + 'api::blog-collection.blog-collection', + 'oneToMany', + 'api::blog-collection.blog-collection' + >; + locale: Attribute.String; }; } @@ -913,10 +940,21 @@ export interface ApiBlogPostBlogPost extends Schema.CollectionType { options: { draftAndPublish: true; }; + pluginOptions: { + i18n: { + localized: true; + }; + }; attributes: { slug: Attribute.UID<'api::blog-post.blog-post', 'title'> & Attribute.Required; - title: Attribute.String & Attribute.Required; + title: Attribute.String & + Attribute.Required & + Attribute.SetPluginOptions<{ + i18n: { + localized: true; + }; + }>; author: Attribute.Relation< 'api::blog-post.blog-post', 'oneToOne', @@ -924,7 +962,12 @@ export interface ApiBlogPostBlogPost extends Schema.CollectionType { >; content: Attribute.DynamicZone< ['content.gallery', 'content.image', 'content.text-markdown'] - >; + > & + Attribute.SetPluginOptions<{ + i18n: { + localized: true; + }; + }>; tags: Attribute.Relation< 'api::blog-post.blog-post', 'oneToMany', @@ -950,6 +993,12 @@ export interface ApiBlogPostBlogPost extends Schema.CollectionType { 'admin::user' > & Attribute.Private; + localizations: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToMany', + 'api::blog-post.blog-post' + >; + locale: Attribute.String; }; } @@ -964,8 +1013,19 @@ export interface ApiTagTag extends Schema.CollectionType { options: { draftAndPublish: true; }; + pluginOptions: { + i18n: { + localized: true; + }; + }; attributes: { - name: Attribute.String & Attribute.Required; + name: Attribute.String & + Attribute.Required & + Attribute.SetPluginOptions<{ + i18n: { + localized: true; + }; + }>; slug: Attribute.UID<'api::tag.tag', 'name'>; createdAt: Attribute.DateTime; updatedAt: Attribute.DateTime; @@ -974,6 +1034,12 @@ export interface ApiTagTag extends Schema.CollectionType { Attribute.Private; updatedBy: Attribute.Relation<'api::tag.tag', 'oneToOne', 'admin::user'> & Attribute.Private; + localizations: Attribute.Relation< + 'api::tag.tag', + 'oneToMany', + 'api::tag.tag' + >; + locale: Attribute.String; }; }