@sanity/document-internationalization 0.3.1 → 1.0.0-v3-studio.2
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 +26 -6
- package/lib/cjs/index.js +3329 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/esm/index.js +3320 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/types/index.d.ts +83 -15
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +48 -74
- package/sanity.json +3 -27
- package/src/actions/DeleteWithi18nAction.tsx +118 -0
- package/src/actions/DuplicateWithi18nAction.tsx +71 -0
- package/src/actions/PublishWithi18nAction.ts +124 -0
- package/src/actions/index.ts +43 -0
- package/src/badges/LanguageBadge.tsx +24 -0
- package/src/constants/I18nDelimiter.ts +1 -0
- package/src/constants/I18nPrefix.ts +1 -0
- package/src/constants/IdStructure.ts +4 -0
- package/src/constants/LanguageCultures.ts +902 -0
- package/src/constants/ReferenceBehavior.ts +5 -0
- package/src/constants/SupportedEmojiFlagCodes.ts +251 -0
- package/src/constants/UiMessages.ts +49 -0
- package/src/constants/index.ts +7 -0
- package/src/documentI18n.tsx +31 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useConfig.ts +22 -0
- package/src/hooks/useDelayedFlag.ts +31 -0
- package/src/index.tsx +6 -0
- package/src/language-select/components/LanguageSelect/LanguageConfigContext.tsx +4 -0
- package/src/language-select/components/LanguageSelect/LanguageSelect.tsx +188 -0
- package/src/language-select/components/LanguageSelect/LanguageSelectContext.ts +16 -0
- package/src/language-select/components/LanguageSelect/LanguageSelectLabel.tsx +12 -0
- package/src/language-select/components/LanguageSelect/LanguageSelectList.tsx +84 -0
- package/src/language-select/components/LanguageSelect/LanguageSelectListItem.tsx +244 -0
- package/src/language-select/components/LanguageSelect/index.tsx +26 -0
- package/src/language-select/components/SingleFlag/SingleFlag.tsx +44 -0
- package/src/language-select/components/SingleFlag/allEmojiFlagCodes.ts +251 -0
- package/src/language-select/components/SingleFlag/index.ts +1 -0
- package/src/language-select/components/SplitPaneIcon/SplitPaneIcon.tsx +25 -0
- package/src/language-select/components/SplitPaneIcon/index.ts +1 -0
- package/src/language-select/components/index.ts +2 -0
- package/src/language-select/hooks/index.ts +1 -0
- package/src/language-select/hooks/useLanguages.ts +37 -0
- package/src/language-select/hooks/useListeningQuery.ts +66 -0
- package/{lib/structure/IDefaultDocumentNodeStructureProps.d.ts → src/structure/IDefaultDocumentNodeStructureProps.ts} +2 -2
- package/src/structure/components/MaintenanceTab/MaintenanceTab.tsx +13 -0
- package/src/structure/components/MaintenanceTab/MaintenanceTabContent.tsx +168 -0
- package/src/structure/components/MaintenanceTab/index.ts +1 -0
- package/src/structure/components/MaintenanceTabResult/MaintenanceTabResult.tsx +40 -0
- package/src/structure/components/MaintenanceTabResult/index.ts +1 -0
- package/src/structure/components/MaintenanceTabTypeSelector/MaintenanceTabTypeSelector.tsx +57 -0
- package/src/structure/components/MaintenanceTabTypeSelector/index.ts +1 -0
- package/src/structure/hooks/index.ts +1 -0
- package/src/structure/hooks/useDocumentsInformation.ts +117 -0
- package/src/structure/index.tsx +120 -0
- package/src/structure/utils/fixBaseDocumentRefs.ts +29 -0
- package/src/structure/utils/fixBaseLanguageMismatch.ts +22 -0
- package/src/structure/utils/fixIdStructureMismatchDocuments.ts +73 -0
- package/src/structure/utils/fixLanguageFields.ts +30 -0
- package/src/structure/utils/fixOrphanedDocuments.ts +15 -0
- package/src/structure/utils/fixTranslationRefs.ts +49 -0
- package/src/structure/utils/index.ts +6 -0
- package/src/types/IEditState.ts +6 -0
- package/src/types/IExtendedLanguageObject.ts +6 -0
- package/{lib/types/ILanguageObject.d.ts → src/types/ILanguageObject.ts} +2 -2
- package/src/types/ILanguageQuery.ts +13 -0
- package/src/types/IResolverProps.ts +10 -0
- package/src/types/ITranslationRef.ts +6 -0
- package/src/types/IType.ts +40 -0
- package/src/types/IUseDocumentOperationResult.ts +11 -0
- package/src/types/TFieldNamesConfig.ts +5 -0
- package/src/types/TLanguage.ts +3 -0
- package/src/types/TLanguagesOption.ts +4 -0
- package/src/types/TSchema.ts +6 -0
- package/src/types/Ti18nConfig.ts +33 -0
- package/src/types/Ti18nDocument.ts +13 -0
- package/src/types/Ti18nSchema.ts +6 -0
- package/src/types/index.ts +15 -0
- package/src/utils/applyConfig.ts +43 -0
- package/src/utils/baseToTop.ts +5 -0
- package/src/utils/batch.ts +11 -0
- package/src/utils/buildDocId.ts +8 -0
- package/src/utils/createSanityReference.ts +11 -0
- package/src/utils/getBaseIdFromId.ts +20 -0
- package/src/utils/getBaseLanguage.ts +6 -0
- package/src/utils/getFlag.ts +38 -0
- package/src/utils/getLanguageFromId.ts +13 -0
- package/src/utils/getLanguagesFromOption.ts +40 -0
- package/src/utils/getTranslationsForId.ts +39 -0
- package/src/utils/index.ts +14 -0
- package/src/utils/makeObjectKey.ts +3 -0
- package/src/utils/normalizeLanguageList.ts +26 -0
- package/src/utils/serializePath.ts +11 -0
- package/src/utils/updateIntlFieldsForDocument.ts +78 -0
- package/src/utils/useSanityClient.ts +8 -0
- package/src/validators/index.ts +1 -0
- package/src/validators/isSlugUnique.ts +56 -0
- package/src/withDocumentI18nPlugin.ts +24 -0
- package/v2-incompatible.js +11 -0
- package/CHANGELOG.md +0 -42
- package/config.dist.json +0 -5
- package/lib/actions/DeleteWithi18nAction.d.ts +0 -2
- package/lib/actions/DuplicateWithi18nAction.d.ts +0 -2
- package/lib/actions/PublishWithi18nAction.d.ts +0 -2
- package/lib/actions/index.d.ts +0 -9
- package/lib/actions/index.js +0 -2442
- package/lib/actions/index.js.map +0 -1
- package/lib/badges/LanguageBadge.d.ts +0 -5
- package/lib/badges/index.d.ts +0 -5
- package/lib/badges/index.js +0 -119
- package/lib/badges/index.js.map +0 -1
- package/lib/constants/I18nDelimiter.d.ts +0 -1
- package/lib/constants/I18nPrefix.d.ts +0 -1
- package/lib/constants/IdStructure.d.ts +0 -4
- package/lib/constants/LanguageCultures.d.ts +0 -4
- package/lib/constants/ReferenceBehavior.d.ts +0 -5
- package/lib/constants/SupportedEmojiFlagCodes.d.ts +0 -1
- package/lib/constants/UiMessages.d.ts +0 -46
- package/lib/constants/index.d.ts +0 -7
- package/lib/constants/index.js +0 -759
- package/lib/constants/index.js.map +0 -1
- package/lib/hooks/index.d.ts +0 -1
- package/lib/hooks/useDelayedFlag.d.ts +0 -1
- package/lib/language-select/components/LanguageSelect/LanguageSelect.d.ts +0 -9
- package/lib/language-select/components/LanguageSelect/LanguageSelectContext.d.ts +0 -10
- package/lib/language-select/components/LanguageSelect/LanguageSelectLabel.d.ts +0 -2
- package/lib/language-select/components/LanguageSelect/LanguageSelectList.d.ts +0 -9
- package/lib/language-select/components/LanguageSelect/LanguageSelectListItem.d.ts +0 -8
- package/lib/language-select/components/LanguageSelect/index.d.ts +0 -1
- package/lib/language-select/components/SingleFlag/SingleFlag.d.ts +0 -8
- package/lib/language-select/components/SingleFlag/allEmojiFlagCodes.d.ts +0 -1
- package/lib/language-select/components/SingleFlag/index.d.ts +0 -1
- package/lib/language-select/components/SplitPaneIcon/SplitPaneIcon.d.ts +0 -2
- package/lib/language-select/components/SplitPaneIcon/index.d.ts +0 -1
- package/lib/language-select/components/index.d.ts +0 -2
- package/lib/language-select/hooks/index.d.ts +0 -1
- package/lib/language-select/hooks/useLanguages.d.ts +0 -3
- package/lib/language-select/hooks/useListeningQuery.d.ts +0 -12
- package/lib/language-select/index.d.ts +0 -10
- package/lib/language-select/index.js +0 -1981
- package/lib/language-select/index.js.map +0 -1
- package/lib/structure/components/MaintenanceTab/MaintenanceTab.d.ts +0 -4
- package/lib/structure/components/MaintenanceTab/MaintenanceTabContent.d.ts +0 -2
- package/lib/structure/components/MaintenanceTab/index.d.ts +0 -1
- package/lib/structure/components/MaintenanceTabResult/MaintenanceTabResult.d.ts +0 -10
- package/lib/structure/components/MaintenanceTabResult/index.d.ts +0 -1
- package/lib/structure/components/MaintenanceTabTypeSelector/MaintenanceTabTypeSelector.d.ts +0 -8
- package/lib/structure/components/MaintenanceTabTypeSelector/index.d.ts +0 -1
- package/lib/structure/hooks/index.d.ts +0 -1
- package/lib/structure/hooks/useDocumentsInformation.d.ts +0 -20
- package/lib/structure/index.d.ts +0 -11
- package/lib/structure/index.js +0 -2843
- package/lib/structure/index.js.map +0 -1
- package/lib/structure/utils/fixBaseDocumentRefs.d.ts +0 -2
- package/lib/structure/utils/fixBaseLanguageMismatch.d.ts +0 -2
- package/lib/structure/utils/fixIdStructureMismatchDocuments.d.ts +0 -2
- package/lib/structure/utils/fixLanguageFields.d.ts +0 -2
- package/lib/structure/utils/fixOrphanedDocuments.d.ts +0 -2
- package/lib/structure/utils/fixTranslationRefs.d.ts +0 -2
- package/lib/structure/utils/index.d.ts +0 -6
- package/lib/types/IEditState.d.ts +0 -5
- package/lib/types/IExtendedLanguageObject.d.ts +0 -5
- package/lib/types/ILanguageQuery.d.ts +0 -10
- package/lib/types/IResolverProps.d.ts +0 -9
- package/lib/types/ITranslationRef.d.ts +0 -6
- package/lib/types/IType.d.ts +0 -38
- package/lib/types/IUseDocumentOperationResult.d.ts +0 -11
- package/lib/types/TFieldNamesConfig.d.ts +0 -5
- package/lib/types/TLanguage.d.ts +0 -2
- package/lib/types/TLanguagesOption.d.ts +0 -3
- package/lib/types/TSchema.d.ts +0 -6
- package/lib/types/Ti18nConfig.d.ts +0 -10
- package/lib/types/Ti18nDocument.d.ts +0 -10
- package/lib/types/Ti18nSchema.d.ts +0 -5
- package/lib/utils/baseToTop.d.ts +0 -2
- package/lib/utils/batch.d.ts +0 -1
- package/lib/utils/buildDocId.d.ts +0 -1
- package/lib/utils/createSanityReference.d.ts +0 -6
- package/lib/utils/getAllSchemas.d.ts +0 -2
- package/lib/utils/getBaseIdFromId.d.ts +0 -1
- package/lib/utils/getBaseLanguage.d.ts +0 -2
- package/lib/utils/getConfig.d.ts +0 -6
- package/lib/utils/getFlag.d.ts +0 -2
- package/lib/utils/getLanguageFromId.d.ts +0 -1
- package/lib/utils/getLanguagesFromOption.d.ts +0 -3
- package/lib/utils/getSanityClient.d.ts +0 -1
- package/lib/utils/getSchema.d.ts +0 -2
- package/lib/utils/getTranslationsForId.d.ts +0 -2
- package/lib/utils/index.d.ts +0 -16
- package/lib/utils/index.js +0 -1230
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/makeObjectKey.d.ts +0 -1
- package/lib/utils/normalizeLanguageList.d.ts +0 -6
- package/lib/utils/serializePath.d.ts +0 -2
- package/lib/utils/updateIntlFieldsForDocument.d.ts +0 -2
- package/lib/validators/index.d.ts +0 -1
- package/lib/validators/index.js +0 -109
- package/lib/validators/index.js.map +0 -1
- package/lib/validators/isSlugUnique.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Document Internationalization Plugin for Sanity.io
|
|
2
2
|
|
|
3
|
+
> **NOTE**
|
|
4
|
+
>
|
|
5
|
+
> This is the **Sanity Studio v3 version** of sanity-plugin-latex-input.
|
|
6
|
+
>
|
|
7
|
+
> For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/latex-input).
|
|
8
|
+
|
|
3
9
|
[](https://www.npmjs.com/package/@sanity/document-internationalization)
|
|
4
10
|
|
|
5
11
|

|
|
@@ -27,27 +33,40 @@ This plugin adds features to the Studio to improve handling **document-level tra
|
|
|
27
33
|
|
|
28
34
|
For **field-level translations** you should use the [@sanity/language-filter plugin](https://www.npmjs.com/package/@sanity/language-filter).
|
|
29
35
|
|
|
36
|
+
*Studio V3 note*: language-filter is not available for V3 yet.
|
|
37
|
+
|
|
30
38
|
### Many projects use both!
|
|
31
39
|
|
|
40
|
+
*Studio V3 note*: language-filter is not available for V3 yet.
|
|
41
|
+
|
|
32
42
|
An example of document-level translation could be a `lesson` schema, the `title`, `slug` and `content` fields would be unique in every language.
|
|
33
43
|
|
|
34
44
|
A good use of field-level translation could be a `person` schema. It could have the same `name` and `image` in every language, but only the `biography` would need translating.
|
|
35
45
|
|
|
46
|
+
## Studio V3 known issues
|
|
47
|
+
|
|
48
|
+
Studio V3 does not implement language-filter yet. This means that the language button has moved into the document editor flow for the time being.
|
|
49
|
+
We will be looking to restore the button placement during Studio V3 dev-preview.
|
|
50
|
+
|
|
36
51
|
## Installation
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
From the same directory as the Studio run:
|
|
39
54
|
|
|
55
|
+
```sh
|
|
56
|
+
npm install --save @sanity/document-internationalization@studio-v3
|
|
40
57
|
```
|
|
41
|
-
|
|
58
|
+
|
|
59
|
+
or
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
yarn add @sanity/document-internationalization@studio-v3
|
|
42
63
|
```
|
|
43
64
|
|
|
44
|
-
Ensure that `@sanity/document-internationalization` is listed in `plugins` inside `sanity.json`.
|
|
45
65
|
|
|
46
66
|
The plugin is now installed, but you will need to complete the following steps to see the Document Translation UI:
|
|
47
67
|
|
|
48
68
|
## Setup next steps
|
|
49
|
-
|
|
50
|
-
1. [Configuration options](docs/configuration-options.md)
|
|
69
|
+
1. [Enabling and configuring the plugin](docs/enabling-and-configuring.md)
|
|
51
70
|
To declare available Languages and other settings
|
|
52
71
|
2. [Activating internationalization on schema](docs/activating-internationalization-on-schema.md)
|
|
53
72
|
To enable all the above features on schema
|
|
@@ -62,7 +81,8 @@ The plugin is now installed, but you will need to complete the following steps t
|
|
|
62
81
|
4. [GraphQL support](docs/graphql-intl-doc.md)
|
|
63
82
|
5. [Advanced languages](docs/advanced-languages.md)
|
|
64
83
|
6. [Usage with custom publish action](docs/usage-with-custom-publish.md)
|
|
65
|
-
7. [
|
|
84
|
+
7. [If you don't see the plugin document actions](docs/usage-with-custom-publish.md#add-additional-actions)
|
|
85
|
+
8. [GROQ query examples](/docs/groq-query-examples.md)
|
|
66
86
|
|
|
67
87
|
## Migrating from sanity-plugin-intl-input
|
|
68
88
|
|