Skip to content

Sanity plugin providing basic select dropdown for languages instead of multi-select.

License

Notifications You must be signed in to change notification settings

Grsmto/sanity-plugin-language-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sanity-plugin-language-switcher

Sanity plugin providing basic select dropdown for languages instead of multi-select.

Usage

sanity.json

{
  "name": "part:language-switcher/config",
  "path": "./parts/languageSwitcherConfig.js"
}

languageSwitcherConfig.js

export default {
  supportedLanguages: [{
    id: 'en',
    title: 'English',
  }, {
    id: 'fr',
    title: 'French',
  }],
  filterField: (enclosingType, field, selectedLanguageIds) => {
    return (
      !enclosingType.name.startsWith("locale") ||
      selectedLanguageIds.includes(field.name)
    )
  },
}

About

Sanity plugin providing basic select dropdown for languages instead of multi-select.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages