
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@kaliber/sanity-plugin-multi-language
Advanced tools
Document level translations.
> yarn add @kaliber/sanity-plugin-multi-language
sanity.config.js
import { addFields as addMultiLanguageFields } from '@kaliber/sanity-plugin-multi-language'
defineConfig({
plugins: [
deskTool({
defaultDocumentNode: (S, context) => {
const getClient = context.getClient.bind(context)
const views = [
S.view.form(),
typeHasLanguage(context) && S.view
.component(Translations)
.options({ multiLanguage, reportError })
.title('Translations'),
].filter(Boolean)
return S.document().views(views)
}
}),
],
schema: {
types: (prev, context) => prev
.concat(schemaTypes)
.map(addMultiLanguageFields({ multiLanguage: clientConfig.multiLanguage, reportError })),
},
})
schema/documents/page.js
export const page = {
type: 'document',
name: 'page',
title: 'Page',
options: {
kaliber: {
multiLanguage: true,
...
},
...
},
...
}
By default, new translations are created with a random UUID (drafts.{uuid}). You can customize this behavior by providing a multiLanguageNewDocumentId function in your schema options:
export const page = {
type: 'document',
name: 'page',
title: 'Page',
options: {
kaliber: {
multiLanguage: true,
multiLanguageNewDocumentId: ({ currentId, currentLanguage, newLanguage }) => {
// Example: Replace language code in the document ID
return currentId.replace(currentLanguage, newLanguage)
}
}
},
...
}
Parameters:
currentId - The ID of the source documentcurrentLanguage - The language code of the source documentnewLanguage - The language code for the new translationReturns: A string to be used as the new document ID
This is useful when you want predictable IDs based on language codes, making it easier to find related translations programmatically.
config.multiLanguage
{
defaultLanguage: 'nl',
languages: {
nl: {
title: 'Dutch',
adjective: 'dutch',
language: 'nl',
icu: 'nl_NL'
},
en: {
title: 'English',
adjective: 'english',
language: 'en',
icu: 'en_US'
}
},
}
In this plugin:
> yarn
> yarn link
In your project:
> yarn link @kaliber/sanity-plugin-multi-language
yarn publish
git push
git push --tags

FAQs
Document level translations.
We found that @kaliber/sanity-plugin-multi-language demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 19 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers