@sanity/document-internationalization 3.0.1 → 3.2.0
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.
- package/README.md +8 -1
- package/dist/_chunks-cjs/resources.js +8 -0
- package/dist/_chunks-cjs/resources.js.map +1 -0
- package/dist/_chunks-es/resources.mjs +9 -0
- package/dist/_chunks-es/resources.mjs.map +1 -0
- package/dist/_legacy/resources.esm.js +9 -0
- package/dist/_legacy/resources.esm.js.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +586 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +584 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +586 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/actions/DuplicateWithTranslationsAction.tsx +252 -0
- package/src/components/DocumentInternationalizationMenu.tsx +7 -1
- package/src/components/LanguageManage.tsx +76 -10
- package/src/constants.ts +1 -0
- package/src/hooks/useOpenInNewPane.tsx +1 -1
- package/src/i18n/index.ts +21 -0
- package/src/i18n/resources.ts +7 -0
- package/src/index.ts +1 -0
- package/src/plugin.tsx +5 -0
- package/src/types.ts +1 -0
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ All new rewrite exclusively for Sanity Studio v3
|
|
|
11
11
|
- [Basic configuration](#basic-configuration)
|
|
12
12
|
- [Advanced configuration](#advanced-configuration)
|
|
13
13
|
- [Language field](#language-field)
|
|
14
|
+
- [Excluding fields](#excluding-fields)
|
|
14
15
|
- [Querying translations](#querying-translations)
|
|
15
16
|
- [Querying with GROQ](#querying-with-groq)
|
|
16
17
|
- [Querying with GraphQL](#querying-with-graphql)
|
|
@@ -118,6 +119,7 @@ export const createConfig({
|
|
|
118
119
|
],
|
|
119
120
|
// ...or a function that takes the client and returns a promise of an array of supported languages
|
|
120
121
|
// MUST return an "id" and "title" as strings
|
|
122
|
+
// Note: Async language configuration cannot create templates for new documents
|
|
121
123
|
// supportedLanguages: (client) => client.fetch(`*[_type == "language"]{id, title}`),
|
|
122
124
|
|
|
123
125
|
// Required
|
|
@@ -146,7 +148,12 @@ export const createConfig({
|
|
|
146
148
|
// Optional
|
|
147
149
|
// Define API Version for all queries
|
|
148
150
|
// https://www.sanity.io/docs/api-versioning
|
|
149
|
-
apiVersion: '2023-05-22'
|
|
151
|
+
apiVersion: '2023-05-22',
|
|
152
|
+
|
|
153
|
+
// Optional
|
|
154
|
+
// Enable "manage translations" button without creating a translated version. Helpful if you have
|
|
155
|
+
// pre-existing documents that you need to tie together through the metadata document
|
|
156
|
+
allowCreateMetaDoc: true // defaults to false
|
|
150
157
|
})
|
|
151
158
|
]
|
|
152
159
|
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var resources = {
|
|
3
|
+
"action.duplicate.label": "Duplicate with translations",
|
|
4
|
+
"action.duplicate.disabled.missing-metadata": "The document cannot be duplicated because the metadata document is missing",
|
|
5
|
+
"action.duplicate.disabled.multiple-metadata": "The document cannot be duplicated because there are multiple metadata documents"
|
|
6
|
+
};
|
|
7
|
+
exports.default = resources;
|
|
8
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sources":["../../src/i18n/resources.ts"],"sourcesContent":["export default {\n 'action.duplicate.label': 'Duplicate with translations',\n 'action.duplicate.disabled.missing-metadata':\n 'The document cannot be duplicated because the metadata document is missing',\n 'action.duplicate.disabled.multiple-metadata':\n 'The document cannot be duplicated because there are multiple metadata documents',\n}\n"],"names":[],"mappings":";AAAA,IAAe,YAAA;AAAA,EACb,0BAA0B;AAAA,EAC1B,8CACE;AAAA,EACF,+CACE;AACJ;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var resources = {
|
|
2
|
+
"action.duplicate.label": "Duplicate with translations",
|
|
3
|
+
"action.duplicate.disabled.missing-metadata": "The document cannot be duplicated because the metadata document is missing",
|
|
4
|
+
"action.duplicate.disabled.multiple-metadata": "The document cannot be duplicated because there are multiple metadata documents"
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
resources as default
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=resources.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.mjs","sources":["../../src/i18n/resources.ts"],"sourcesContent":["export default {\n 'action.duplicate.label': 'Duplicate with translations',\n 'action.duplicate.disabled.missing-metadata':\n 'The document cannot be duplicated because the metadata document is missing',\n 'action.duplicate.disabled.multiple-metadata':\n 'The document cannot be duplicated because there are multiple metadata documents',\n}\n"],"names":[],"mappings":"AAAA,IAAe,YAAA;AAAA,EACb,0BAA0B;AAAA,EAC1B,8CACE;AAAA,EACF,+CACE;AACJ;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var resources = {
|
|
2
|
+
"action.duplicate.label": "Duplicate with translations",
|
|
3
|
+
"action.duplicate.disabled.missing-metadata": "The document cannot be duplicated because the metadata document is missing",
|
|
4
|
+
"action.duplicate.disabled.multiple-metadata": "The document cannot be duplicated because there are multiple metadata documents"
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
resources as default
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=resources.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.esm.js","sources":["../../src/i18n/resources.ts"],"sourcesContent":["export default {\n 'action.duplicate.label': 'Duplicate with translations',\n 'action.duplicate.disabled.missing-metadata':\n 'The document cannot be duplicated because the metadata document is missing',\n 'action.duplicate.disabled.multiple-metadata':\n 'The document cannot be duplicated because there are multiple metadata documents',\n}\n"],"names":[],"mappings":"AAAA,IAAe,YAAA;AAAA,EACb,0BAA0B;AAAA,EAC1B,8CACE;AAAA,EACF,+CACE;AACJ;"}
|
package/dist/index.d.mts
CHANGED
|
@@ -29,6 +29,8 @@ export declare interface DocumentInternationalizationSchemaOpts {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export declare const DuplicateWithTranslationsAction: DocumentActionComponent
|
|
33
|
+
|
|
32
34
|
export declare type Language = {
|
|
33
35
|
id: Intl.UnicodeBCP47LocaleIdentifier
|
|
34
36
|
title: string
|
|
@@ -48,6 +50,7 @@ export declare type PluginConfig = {
|
|
|
48
50
|
bulkPublish?: boolean
|
|
49
51
|
metadataFields?: FieldDefinition[]
|
|
50
52
|
apiVersion?: string
|
|
53
|
+
allowCreateMetaDoc?: boolean
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
export declare type PluginConfigContext = Required<PluginConfig> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export declare interface DocumentInternationalizationSchemaOpts {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export declare const DuplicateWithTranslationsAction: DocumentActionComponent
|
|
33
|
+
|
|
32
34
|
export declare type Language = {
|
|
33
35
|
id: Intl.UnicodeBCP47LocaleIdentifier
|
|
34
36
|
title: string
|
|
@@ -48,6 +50,7 @@ export declare type PluginConfig = {
|
|
|
48
50
|
bulkPublish?: boolean
|
|
49
51
|
metadataFields?: FieldDefinition[]
|
|
50
52
|
apiVersion?: string
|
|
53
|
+
allowCreateMetaDoc?: boolean
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
export declare type PluginConfigContext = Required<PluginConfig> & {
|