Document Internationalization Plugin: Missing Base Language and Extra Create Option

6 replies
Last updated: Jun 1, 2023
Hi, so I tested the new version of the @sanity/document-internationalization plugin. However, I’m kinda confused. Where did the base language go, and why do I have 3 “Create” options when creating a new document? I have only configured 2 languages in the supportedLanguages config.
AI Update

Great question! The new version of @sanity/document-internationalization (v2+) has made some significant architectural changes that explain what you're seeing.

What Changed: No More "Base Language"

In the previous version, the plugin used a base language concept where one language was the "source" and others were translations. The new version completely removed this concept in favor of a more flexible approach where all languages are treated equally.

Why You're Seeing 3 Create Options

When you configure 2 languages in supportedLanguages, you're actually getting 3 creation options:

  1. Default document template (language-agnostic)
  2. Language 1 template (e.g., "Spanish")
  3. Language 2 template (e.g., "English")

The plugin now creates document templates for each configured language, plus the default schema template still exists. This is intentional behavior to give you flexibility in how you create documents.

How It Works Now

Instead of storing translations as references on the documents themselves (which required a base language), the new version uses a separate translation.metadata document that links all language versions together. This means:

  • No language is "special" or the base
  • All language versions are independent documents
  • They're connected through a metadata document with references to each version
  • You can create a document in any language first

If You Want Only 2 Options

If you find the default template confusing, you can remove the default template from your schema configuration. This is covered in the plugin's documentation.

The key thing to understand is that the new architecture is more flexible and scalable, but it does mean letting go of the "base language" mental model. Each language version is now a first-class document that gets linked to others through the metadata system.

Show original thread
6 replies
I just wanted to add that I understand the new concepts and why the base language is gone. But I still do not know why I have 3 “Create” options in the menu.
Hey Bjørn!
Base language is removed in the new version as that was the #1 feature request for the existing version. It was very limiting for teams that wanted to start a document in any language first and add translations later. This is explained in the readme I believe, but perhaps could be clearer.

Those “new” options are because the plug-in registers templates to start a document with the language field populated — but does not remove the default one. You could find instructions to remove the default new document template in the docs.

Let me know if you have any other feedback, thanks!
Hi Simeon and thanks for your reply. I tried searching for information on how to remove the default new document entry, but I could not find it. I assume it has something to do with modifying initial value templates, but I could not get any further that this:

export const SiteTemplatesNorway = (prev) => [
    ...prev
]
This, as you know, just returns whatever is there from before. What more do I need to do here?

Also, while on topic of value templates:
My “Article” document has a reference to another document called “Topic”. The “Topic” document also has document translation. Say I create a new Norwegian Article, select a “Topic” and hit publish. Then I go to the Translations button and create a English translation of this article. I now see the content from the Norwegian article copied over. This is fine. But is it possible to have the reference field use the english reference automatically, if that exists? That way the editor does not manually have to remove the Norwegian reference and re-add the English translated reference?
1. You’d need to filter that
prev
array of templates to remove the default ones. I might add a page to the plugin docs to describe it.2. This plugin won’t be able to solve this question of “reference inheritance”, but what you could do is apply a validation rule to the document to ensure that the language of the
topic
field matches the language of the
article
field so the author must replace that reference in order to publish it.
1. Think I managed to solve it by:
export const SiteTemplatesNorway = (prev) => {
    const schemas = TranslationSchemaTypesNorway;
    return prev.filter((obj) => !schemas.includes(obj.id));
};
Basically, ‘TranslationSchemaTypesNorway’ is the array of schemaTypes that is also defined in your plugin config. That way its always in sync.
2. Thanks. I’ll check that out.
Looks like you’ve got it sorted but I did write an extra guide for how to remove the default template:

https://github.com/sanity-io/document-internationalization/blob/main/docs/06-remove-default-new-document-template.md

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?