Issue with document-internationalization plugin and inability to add a page in a language other than the base language.

9 replies
Last updated: Mar 3, 2023
Hi, I'm using the document-internationalization plugin which out of the box works great!
I've been looking through the channel for answers on a question of mine but couldn't find an answer, although I guess it's been discussed before:

One need from clients of our's is to be able to publish content in one language only,
which is not the base language.
If I add a new page, and wants to select
English instead of Swedish (base), the dropdown is broken and I'm unavailable to add a page only in English.
Is there any solution to this?

My config looks like this:

documentI18n({
  languages: i18n.languages,
  "idStructure": "delimiter",
  "referenceBehavior": "weak",
  "withTranslationsMaintenance": false,
    "fieldNames": {
      "lang": "__i18n_lang",
      "references": "__i18n_refs",
      "baseReference": "__i18n_base"
  },
  customFlagComponents: {
    'sv': () => '🇸🇪',
    'en': () => '🇬🇧',
  }
}),
Mar 2, 2023, 10:14 AM
This is one of the main challenges that the next version of the plug-in addresses. It’s available in beta at the moment if you’d like to try it out.
It offers a very different way of storing the translated references. So you would need to make some schema changes. Take a look at the readme:


https://github.com/sanity-io/document-internationalization/tree/studio-v3-plugin-v2
Mar 2, 2023, 12:00 PM
Magical! Thanks
user T
, will try that out for sure 👌 🎉
Mar 2, 2023, 12:24 PM
Tried out the new version during the afternoon, it worked really well and it enables us to do exactly what we want! Amazing job, feels like this version will improve the experience for both editors and developers👏 👏 👏
Mar 2, 2023, 7:24 PM
Thanks Henrik!
Mar 2, 2023, 7:24 PM
If you have any other feedback while using it please let me know 🙂
Mar 2, 2023, 7:25 PM
Yes, will do! Will use it more in depth in the coming days so I’ll shout if I bump into something 😀
Mar 2, 2023, 7:31 PM
One thing I was thinking of
user T
that there might already be a solution for:
We would like to add something like a "completion rate" for our editors in the list previews, for example
• Page exists in Swedish and English, but not Norwegian, and display that in the list subtitle (if we for example wants to filter out and show only one language in the lists)
• In the V3 version we had access to the current language-refs and could accomplish that by checking that field
Is there a way to do something similar in the coming version?

The groq query for getting languages worked perfect:

"_translations": *[_type == "translation.metadata" && references(^._id)].translations[].value->{
  title,
  slug,
  language
}
Is it/would it possible to fetch those values inside a
page.tsx
schema document for example?
Mar 3, 2023, 7:04 AM
The only way to do an async call that shows in document list views is to put a custom component inside the ‘media’ key. So you’d need to create a sort of custom icon which would indicate that all translations have been completed.
Mar 3, 2023, 2:41 PM
Thanks, will try that 🙂
Mar 3, 2023, 2:53 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?