@sanity/language-filter 2.24.3-pte.128 → 2.25.1-feature-image-file-input-refactor.150
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 +30 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
# Field-level translation filter Plugin for Sanity.io
|
|
2
2
|
|
|
3
3
|
A Sanity plugin that supports filtering localized fields by language
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## What this plugin solves
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
There are two popular methods of internationalization in Sanity Studio:
|
|
10
|
+
|
|
11
|
+
- **Field-level translation**
|
|
12
|
+
- A single document with many languages of content
|
|
13
|
+
- Achieved by mapping over languages on each field, to create an object
|
|
14
|
+
- Best for documents that have a mix of language-specific and common fields
|
|
15
|
+
- Not recommended for Portable Text
|
|
16
|
+
- **Document-level translation**
|
|
17
|
+
- A unique document version for every language
|
|
18
|
+
- Joined together by references and/or a predictable `_id`
|
|
19
|
+
- Best for documents that have unique, language-specific fields and no common content across languages
|
|
20
|
+
- Best for translating content using Portable Text
|
|
21
|
+
|
|
22
|
+
This plugin adds features to the Studio to improve handling **field-level translations**.
|
|
23
|
+
|
|
24
|
+
- A "Filter Languages" button to show/hide fields in an object of language-specific fields
|
|
25
|
+
- Configuration to set "default" languages which are always visible
|
|
26
|
+
|
|
27
|
+
For **document-level translations** you should use the [@sanity/document-internationalization plugin](https://www.npmjs.com/package/@sanity/document-internationalization).
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
sanity install @sanity/language-filter
|
|
33
|
+
```
|
|
10
34
|
|
|
11
35
|
Installing with `sanity install` updates your `sanity.json` to include this plugin. If installing with npm or yarn, ensure your `plugins` array includes `@sanity/language-filter`.
|
|
12
36
|
|
|
@@ -33,7 +57,7 @@ export default {
|
|
|
33
57
|
{id: 'en', title: 'English'},
|
|
34
58
|
{id: 'es', title: 'Spanish'},
|
|
35
59
|
{id: 'arb', title: 'Arabic'},
|
|
36
|
-
{id: 'pt', title: 'Portuguese'}
|
|
60
|
+
{id: 'pt', title: 'Portuguese'},
|
|
37
61
|
//...
|
|
38
62
|
],
|
|
39
63
|
// Select Norwegian (Bokmål) by default
|
|
@@ -41,7 +65,7 @@ export default {
|
|
|
41
65
|
// Only show language filter for document type `page` (schemaType.name)
|
|
42
66
|
documentTypes: ['page'],
|
|
43
67
|
filterField: (enclosingType, field, selectedLanguageIds) =>
|
|
44
|
-
!enclosingType.name.startsWith('locale') || selectedLanguageIds.includes(field.name)
|
|
68
|
+
!enclosingType.name.startsWith('locale') || selectedLanguageIds.includes(field.name),
|
|
45
69
|
}
|
|
46
70
|
```
|
|
47
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/language-filter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.1-feature-image-file-input-refactor.150+44fcdb9bd",
|
|
4
4
|
"description": "A Sanity plugin that supports filtering localized fields by language",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@sanity/icons": "^1.2.1",
|
|
19
|
-
"@sanity/types": "2.
|
|
19
|
+
"@sanity/types": "2.25.1-feature-image-file-input-refactor.150+44fcdb9bd",
|
|
20
20
|
"@sanity/ui": "^0.37.2",
|
|
21
21
|
"lodash": "^4.17.15",
|
|
22
22
|
"rxjs": "^6.5.3"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "44fcdb9bd107b5eba1ac118192512a5f1c136ad1"
|
|
43
43
|
}
|