New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sanity-plugin-tos

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanity-plugin-tos

> This is a **Sanity Studio v3** plugin.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
decreased by-71.87%
Maintainers
0
Weekly downloads
 
Created
Source

tos-plugin-sanity

This is a Sanity Studio v3 plugin.

Installation

npm install sanity-plugin-tos

Usage

Please note that this plugin requires the document-internationalization plugin to be enabled in your Sanity Studio. Add it as a plugin in sanity.config.ts (or .js):

import {defineConfig} from 'sanity'
import {StructureBuilder} from "sanity/structure";
import {tosPlugin} from 'sanity-plugin-tos'

const languages = [
  {id: 'es-ES', title: 'Spanish'},
  {id: 'en-US', title: 'English'},
  {id: 'de-DE', title: 'German'},
  {id: 'fr-FR', title: 'French'}
];

export default defineConfig({
  //...
  plugins: [
    // ...
    documentInternationalization({
      supportedLanguages: languages,
      schemaTypes: ['eventType'],
      weakReferences: true,
    }),
    structureTool({
      //...
      defaultDocumentNode: (S: StructureBuilder) => {
          return S.document()
            .views([
              S.view.form(),
              tosPlugin(S, {
                env: 'staging' | 'sandbox' | 'production',
                apiKey: TOS_API_TOKEN,
                sourceLanguage: 'en-US',
                supportedLanguages: languages
              })
            ])
        }
    })
  ],
})

TOS plugin options in Sanity Studio's schema

TOS plugin options can be set in the schema definition of a field. The following options are available, both optional:

defineField({
  name: 'eventTitle',
  type: 'string',
  title: 'Event title',
  options: {
    tosProperties: {
      exclude: true,
      charLimit: 100,
    }
  }
})

You can exclude the field from being translated by the TOS plugin, or set a charLimit for the field's translation (currently charLimit is not available).

What is translated by default

The plugin will translate all fields of the document that are of type string, array or block. For sure, the plugin will not translate fields that are set to exclude in the schema definition and fields that are not of the mentioned types, like boolean, date, reference, image, etc.

Keywords

FAQs

Package last updated on 02 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc