sanity-plugin-studio-smartling 4.0.6-beta → 4.0.7-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +10 -30
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -16,6 +16,8 @@ We're proud to be partnered with Smartling and their [official connector](https:
16
16
 
17
17
  This is a separate plugin, and differs in that it provides editors a visual progress bar for ongoing translations and a way to import translations back into your content at either the document or field level. Feel free to try it out and see which solution works for you!
18
18
 
19
+ _Recent updates for v4:_ We've added support for the new document internationalization plugin pattern. Please read the [Document level translations](#document-level-translations) section for more information.
20
+
19
21
  # Table of Contents
20
22
 
21
23
  - [Quickstart](#quickstart)
@@ -80,6 +82,9 @@ If you have concerns about this being exposed to authenticated users of your stu
80
82
  import {DefaultDocumentNodeResolver} from 'sanity/desk'
81
83
  //...your other desk structure imports...
82
84
  import {TranslationsTab, defaultDocumentLevelConfig} from 'sanity-plugin-studio-smartling'
85
+ //if you are using field-level translations, you can import the field-level config instead:
86
+ //import {TranslationsTab, defaultFieldLevelConfig} from 'sanity-plugin-studio-smartling'
87
+ //if you're not sure which, please look at the document-level and field-level sections below
83
88
 
84
89
  export const defaultDocumentNode: DefaultDocumentNodeResolver = (S, {schemaType}) => {
85
90
  if (schemaType === 'myTranslatableDocumentType') {
@@ -87,6 +92,8 @@ export const defaultDocumentNode: DefaultDocumentNodeResolver = (S, {schemaType}
87
92
  S.view.form(),
88
93
  //...my other views -- for example, live preview, document pane, etc.,
89
94
  S.view.component(TranslationsTab).title('Smartling').options(defaultDocumentLevelConfig)
95
+ //again, if you're using field-level translations, you can use the field-level config instead:
96
+ //S.view.component(TranslationsTab).title('Smartling').options(defaultFieldLevelConfig)
90
97
  ])
91
98
  }
92
99
  return S.document()
@@ -101,7 +108,7 @@ To use the default config mentioned above, we assume that you are following the
101
108
 
102
109
  ### Field-level translations
103
110
 
104
- If you are using field-level translation, we assume any fields you want translated exist in the multi-locale object form we recommend.
111
+ If you are using field-level translation and the `defaultFieldLevelConfig` configuration, we assume any fields you want translated exist in the multi-locale object form we recommend.
105
112
  For example, a non-localizable "title" field will be a flat string: `title: 'My title is here.'` For a field you want to include many languages for, your title may look like
106
113
  `
107
114
  {
@@ -116,37 +123,10 @@ _Important_: Smartling's locale representation includes hyphens, like `fr-FR`. T
116
123
 
117
124
  ### Document level translations
118
125
 
119
- Since we often find users want to use the [Document internationalization plugin](https://www.sanity.io/plugins/document-internationalization) if they're using document-level translations, we assume that any documents you want in different languages will follow the pattern `{id-of-base-language-document}__i18n_{locale}`
120
-
121
- ### Final note
122
-
123
- It's okay if your data doesn't follow these patterns and you don't want to change them! You will simply have to override how the plugin gets and patches back information from your documents. Please see [Overriding defaults](#overriding-defaults).
124
-
125
-
126
- ## Assumptions
127
-
128
- To use the default config mentioned above, we assume that you are following the conventions we outline in [our documentation on localization](https://www.sanity.io/docs/localization).
129
-
130
- ### Field-level translations
131
-
132
- If you are using field-level translation, we assume any fields you want to be translated exist in the multi-locale object form we recommend.
133
-
134
- For example, on a document you don't want to be translated, you may have a "title" field that's a flat string: `title: 'My title is here.'` For a field you want to include many languages for your title may look like:
135
-
136
- ```javascript
137
- {
138
- //...other document fields,
139
- title: {
140
- en: 'My title is here.',
141
- es: 'Mi título está aquí.',
142
- etc...
143
- }
144
- }
145
- ```
126
+ Since we often find users want to use the [Document internationalization plugin](https://www.sanity.io/plugins/document-internationalization) if they're using document-level translations, we assume that any documents you want in different languages will be present in a `translation.metadata` document.
146
127
 
147
- ### Document level translations
128
+ _Important_: The above is true if you are using the Document Internationalization Plugin at version 2 or above. If you are using version 1 please use the `legacyDocumentLevelConfig` configuration exported from this plugin. This configuration assumes your translations follow the pattern `{id-of-base-language-document}__i18n_{locale}`
148
129
 
149
- Since we often find users want to use the [Document internationalization plugin](https://www.sanity.io/plugins/document-internationalization) if they're using document-level translations, we assume that any documents you want in different languages will follow the pattern `{id-of-base-language-document}__i18n_{locale}`
150
130
 
151
131
  ### Final note
152
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-studio-smartling",
3
- "version": "4.0.6-beta",
3
+ "version": "4.0.7-beta",
4
4
  "description": "!smartling gif",
5
5
  "keywords": [
6
6
  "sanity",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@sanity/incompatible-plugin": "^1.0.4",
51
- "sanity-translations-tab": "^4.0.4-beta"
51
+ "sanity-translations-tab": "^4.0.5-beta"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@commitlint/cli": "^17.4.4",