Scroll to top
© 2024, Lunarbyte LLC

Directus Content Translations

How to Setup Directus Content Translations

In this blog, our team at Lunarbyte will show you how to setup content translations in Directus. The objectives are:

  • Create an Article collection with title and body

  • Create a translations collection for the articles collection

We assume you already have a Directus instance setup and running. This tutorial was written using Directus version 9. If you need install Directus follow their installation guide.

Step 1

Create a new collection called articles. There is nothing special about this collection. You can use the collection default options and save.

Step 2

Within this collection create a new field and select “Translations” from the dropdown.

Step 3

After clicking the translations option, rename the translations table to “article_translations”. This is our naming convention preference to keep translation tables associated to each collection. Click “Auto Generate”

Step 4

At this point, you should have three different data models listed under your “Data Model” tab. This includes: articles, languages, and articles_translations. We will use articles_translations to create any fields that need translations.

Step 5

Now lets create some fields that we would like to be translated within the articles. In this case we will setup a standard field for title and another standard field for body.

Step 6

At this point we are ready to create an article with fields that can be translated. Head over to the collections tab -> articles and create a new article.

Step 7

In the new article interface you will see the Article Translations relationship at the bottom. You can click on each language you would like to provide a translation for.

Step 8

After clicking on a specific language, you will see a drawer popup. This will allow you to input the specific language for those fields. You will need to provide values for each specific language you want to support.

Step 9

You are done with translations. Now you can enable the permissions for accessing articles and articles_translations via the API. You can adjust permissions based on your needs.

Congrats, you have finished setting up content translations with Directus!

Related posts

Post a Comment

Your email address will not be published. Required fields are marked *