Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Help needed with implementing real-time content translation in Sanity CMS

8 replies
Last updated: Mar 13, 2023
Hi Guys, Hope everyone doing great.
We got stuck in one feature of sanity, we are using sanity for the first time. So any help would be appreciated.

Use case:
We want to implement a CMS for a website and we found Sanity
🤩 and loved it. But stuck in 1 feature. The feature is we want to translate the content from english to any given language in real time means when we update the content it will automatically convert into all the defined language.
For that we find out sanity provide a handy plugin for this usecase i.e.
@sanity/document-internationalization
. We tried to follow the steps that are given in the documation . So there are 3 steps to implement that1.
Enabling and configuring the plugin 2.
Activating internationalization on schema 3.
Customise Desk Structure (Added the coded snippet of
sanity.config.ts
for the reference)
We got stuck on the 3rd step, we also tired looking on the online for possible solution or demo for this step, couldn’t able to find any. Please help us guide through the process, any help would be appreciated.



plugins: withDocumentI18nPlugin(
    (pluginConfig) => [
      deskTool({
        structure: (S, {schema}) => getDocumentList({S, schema, config: pluginConfig}),
      }),
      visionTool(),
      documentI18n({
        base: 'en-us',
        languages: [
          {
            title: 'English (US)',
            id: 'en-us',
          },
          {
            title: 'Japanese (JP)',
            id: 'ja-JP',
          },
        ],
        idStructure: IdStructure.DELIMITER,
        referenceBehavior: ReferenceBehavior.STRONG,
        withTranslationsMaintenance: true,
        fieldNames: {
          lang: '__i18n_lang',
          references: '__i18n_refs',
          baseReference: '__i18n_base',
        },
      }),
    ],
    {}
  ),

Mar 1, 2023, 9:23 AM
Just to clarify, your content won’t automatically be translated by that plugin. It just allows you an ergonomic way of switching between different translation documents. If you’d like to have translations done, you’ll need to use a third party service.
Mar 1, 2023, 6:21 PM
user M
okay understood. Do you know any services which can helps us with our usecase
Mar 2, 2023, 7:34 AM
Also we are thinking that, we can use the sanity webhook to generate the content in multiple languages and then push those data into the sanity.
Mar 2, 2023, 7:35 AM
Let me know if it can work or not. Also if you have any other good suggestion please do let me know
Mar 2, 2023, 7:35 AM
This turned up on Google -- our usual friends, and not free, but USD 0.50 per 'page' is pretty cheap for competent translation. All the needed detail seem visible from this link, if it also marketerspeaks... Google Translation Hub .
How you would sensibly distribute the results to accesible pages,
user M
or compatriots might have good ideas about, and it would be interesting to hear...best fortune, @Aman.
Mar 3, 2023, 7:50 AM
We don’t currently have any V3 compatible plugins for managing this within the Studio, but you can see a couple of V2 plugins in this search.
Mar 3, 2023, 5:31 PM
user M
Are you planning to update the Google Translation plugin to support version 3 any time soon? https://github.com/sanity-io/sanity-plugin-google-translate
Mar 11, 2023, 1:26 PM
Not that I’m aware of
Mar 13, 2023, 2:59 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?