@sanity/document-internationalization 0.0.1-beta.2 → 0.0.1-beta.6
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/CHANGELOG.md +15 -0
- package/README.md +28 -11
- package/config.dist.json +1 -1
- package/lib/actions/PublishWithi18nAction.d.ts +2 -2
- package/lib/actions/index.js +194 -129
- package/lib/actions/index.js.map +1 -1
- package/lib/badges/index.js +10 -10
- package/lib/badges/index.js.map +1 -1
- package/lib/constants/ReferenceBehavior.d.ts +1 -1
- package/lib/constants/UiMessages.d.ts +1 -0
- package/lib/constants/index.js +6 -1
- package/lib/constants/index.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/useDelayedFlag.d.ts +1 -0
- package/lib/structure/components/LangCultureFlagsBlock/LangCultureFlagsBlock.d.ts +8 -0
- package/lib/structure/components/LangCultureFlagsBlock/SingleFlag.d.ts +7 -0
- package/lib/structure/components/{Flag → LangCultureFlagsBlock}/allEmojiFlagCodes.d.ts +0 -0
- package/lib/structure/components/LangCultureFlagsBlock/index.d.ts +1 -0
- package/lib/structure/components/MaintenanceTab/MaintenanceTab.d.ts +3 -1
- package/lib/structure/components/MaintenanceTab/MaintenanceTabContent.d.ts +2 -0
- package/lib/structure/index.d.ts +1 -1
- package/lib/structure/index.js +389 -252
- package/lib/structure/index.js.map +1 -1
- package/lib/utils/createSanityReference.d.ts +1 -1
- package/lib/utils/getTranslationsForId.d.ts +1 -1
- package/lib/utils/index.js +52 -44
- package/lib/utils/index.js.map +1 -1
- package/lib/validators/index.js +5 -5
- package/lib/validators/index.js.map +1 -1
- package/package.json +4 -1
- package/lib/structure/components/Flag/Flag.d.ts +0 -6
- package/lib/structure/components/Flag/index.d.ts +0 -1
- package/lib/structure/utils/fixReferenceBehaviorMismatch.d.ts +0 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## v1.0.0
|
|
4
|
+
* Migrated original plugin code
|
|
5
|
+
* Removed object level translations
|
|
6
|
+
* Added additional GROQ examples
|
|
7
|
+
* Added a slug uniqueness validator for document level translations (`import { isSlugUnique } from '@sanity/document-internationalization/lib/validators`)
|
|
8
|
+
* Fixed issue with `fixIdStructureMismatchDocuments` maintenance function
|
|
9
|
+
* `delimiter` is now the default ID structure
|
|
10
|
+
* Added maintenance function to add base document ref to translated documents
|
|
11
|
+
* Removed the option for overriding UI messages
|
|
12
|
+
* Updated language configuration to use "id" field instead of "name"
|
|
13
|
+
* Updated studio parts to use new plugin name
|
|
14
|
+
* Renamed "hard" to "strong" for configuring the reference behavior
|
|
15
|
+
* The references from the base document to the translated ones will now receive the language code as their key
|
package/README.md
CHANGED
|
@@ -2,21 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@sanity/document-internationalization)
|
|
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
10
|
|
|
11
|
-
- **Document-level translation**
|
|
12
|
-
-
|
|
11
|
+
- **Document-level translation**
|
|
12
|
+
- A unique document version for every language
|
|
13
|
+
- Joined together by references and/or a predictable `_id`
|
|
14
|
+
- Best for documents that have unique, language-specific fields and no common content across languages
|
|
15
|
+
- Best for translating content using Portable Text
|
|
16
|
+
- **Field-level translation**
|
|
17
|
+
- A single document with many languages of content
|
|
18
|
+
- Achieved by mapping over languages on each field, to create an object
|
|
19
|
+
- Best for documents that have a mix of language-specific and common fields
|
|
20
|
+
- Not recommended for Portable Text
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
This plugin adds features to the Studio to improve handling **document-level translations**.
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
- A View Pane to create language versions of each Document
|
|
25
|
+
- Document Actions to update base and translated documents to ensure references stay in tact
|
|
26
|
+
- Document Badges to highlight the language version of a document
|
|
17
27
|
|
|
18
28
|
For **field-level translations** you should use the [@sanity/language-filter plugin](https://www.npmjs.com/package/@sanity/language-filter).
|
|
19
29
|
|
|
30
|
+
### Many projects use both!
|
|
31
|
+
|
|
32
|
+
An example of document-level translation could be a `lesson` schema, the `title`, `slug` and `content` fields would be unique in every language.
|
|
33
|
+
|
|
34
|
+
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
|
+
|
|
20
36
|
## Installation
|
|
21
37
|
|
|
22
38
|
With the [Sanity CLI installed](https://www.sanity.io/docs/getting-started-with-sanity-cli), from the same directory as the Studio run:
|
|
@@ -40,12 +56,13 @@ The plugin is now installed, but you will need to complete the following steps t
|
|
|
40
56
|
|
|
41
57
|
## Other documentation
|
|
42
58
|
|
|
43
|
-
1. [
|
|
44
|
-
2. [
|
|
45
|
-
3. [
|
|
46
|
-
4. [
|
|
47
|
-
5. [
|
|
48
|
-
6. [
|
|
59
|
+
1. [Known Caveats](docs/known-caveats.md)
|
|
60
|
+
2. [Data structure](docs/datastructure-intl-doc.md)
|
|
61
|
+
3. [Translation Maintenance](docs/translation-maintenance.md)
|
|
62
|
+
4. [GraphQL support](docs/graphql-intl-doc.md)
|
|
63
|
+
5. [Advanced languages](docs/advanced-languages.md)
|
|
64
|
+
6. [Usage with custom publish action](docs/usage-with-custom-publish.md)
|
|
65
|
+
7. [GROQ query examples](/docs/groq-query-examples.md)
|
|
49
66
|
|
|
50
67
|
## Migrating from sanity-plugin-intl-input
|
|
51
68
|
|
package/config.dist.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IResolverProps } from '../types';
|
|
3
3
|
export declare const PublishWithi18nAction: ({ type, id, onComplete }: IResolverProps) => {
|
|
4
|
-
disabled:
|
|
4
|
+
disabled: boolean;
|
|
5
5
|
label: string;
|
|
6
|
-
icon: React.ForwardRefExoticComponent<Pick<React.SVGProps<SVGSVGElement>, "string" | "id" | "lang" | "name" | "type" | "className" | "color" | "height" | "max" | "media" | "method" | "min" | "style" | "target" | "width" | "role" | "tabIndex" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "alignmentBaseline" | "allowReorder" | "
|
|
6
|
+
icon: React.ForwardRefExoticComponent<Pick<React.SVGProps<SVGSVGElement>, "string" | "fr" | "id" | "lang" | "name" | "path" | "type" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "className" | "color" | "height" | "max" | "media" | "method" | "min" | "style" | "target" | "width" | "role" | "tabIndex" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "alignmentBaseline" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "azimuth" | "baseFrequency" | "baselineShift" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clip" | "clipPath" | "clipPathUnits" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "colorProfile" | "colorRendering" | "contentScriptType" | "contentStyleType" | "cursor" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "direction" | "display" | "divisor" | "dominantBaseline" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "end" | "exponent" | "externalResourcesRequired" | "fill" | "fillOpacity" | "fillRule" | "filter" | "filterRes" | "filterUnits" | "floodColor" | "floodOpacity" | "focusable" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphOrientationVertical" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "href" | "imageRendering" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "letterSpacing" | "lightingColor" | "limitingConeAngle" | "local" | "markerEnd" | "markerHeight" | "markerMid" | "markerStart" | "markerUnits" | "markerWidth" | "mask" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "offset" | "opacity" | "operator" | "order" | "orient" | "orientation" | "origin" | "overflow" | "overlinePosition" | "overlineThickness" | "paintOrder" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "pointerEvents" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rotate" | "rx" | "ry" | "scale" | "seed" | "shapeRendering" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "stopColor" | "stopOpacity" | "strikethroughPosition" | "strikethroughThickness" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textAnchor" | "textDecoration" | "textLength" | "textRendering" | "to" | "transform" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeBidi" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "values" | "vectorEffect" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "visibility" | "vMathematical" | "widths" | "wordSpacing" | "writingMode" | "x1" | "x2" | "x" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "y" | "yChannelSelector" | "z" | "zoomAndPan" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<SVGSVGElement>>;
|
|
7
7
|
shortcut: string | null;
|
|
8
8
|
onHandle: () => void;
|
|
9
9
|
};
|