4.2.1 • Published 11 months ago
@kaliber/sanity-plugin-multi-language v4.2.1
Kaliber Sanity Multi Language Plugin
Document level translations.
Installation
> yarn add @kaliber/sanity-plugin-multi-languageUsage
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,
...
},
...
},
...
}Config
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'
}
},
}Development
In this plugin:
> yarn
> yarn linkIn your project:
> yarn link @kaliber/sanity-plugin-multi-language Publish
yarn publish
git push
git push --tags
4.2.1
11 months ago
4.1.0
1 year ago
4.2.0
1 year ago
4.0.0
2 years ago
2.2.0-beta1
2 years ago
2.2.0
2 years ago
3.2.0
2 years ago
3.1.0
2 years ago
3.0.0
2 years ago
2.0.2
2 years ago
2.0.1-beta.0
2 years ago
2.0.1-beta.1
2 years ago
2.1.0
2 years ago
2.0.1
2 years ago
2.0.0
3 years ago
1.1.0
3 years ago
1.0.0
4 years ago
0.0.1
4 years ago