@easyling/sanity-connector 1.3.0 → 1.4.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 CHANGED
@@ -7,6 +7,9 @@ A Sanity Studio plugin that enables seamless document translation workflows. It
7
7
  - **Single Document Translation**: Translate individual documents directly from the document form.
8
8
  - **Bulk Translation**: Batch process multiple documents via a dedicated tool.
9
9
  - **Smart Content Extraction**: Converts Sanity Portable Text to HTML for translation and back again.
10
+ - **Translation Collision Handling**: Intelligent detection and resolution when re-translating to the same locale.
11
+ - **Replace Mode**: Overwrite existing translated documents with new translations.
12
+ - **Create Mode**: Create new documents while managing existing ones (draft or delete).
10
13
  - **Translation Invariance**: granular control over what gets translated via "Do Not Translate" (DNT) flags.
11
14
  - **Inline Badges**: Toggle translation status for individual fields directly in the editor.
12
15
  - **Field Management**: dedicated action to manage DNT status across the whole document.
@@ -97,6 +100,35 @@ For a high-level view:
97
100
  2. Select **Manage Translation Fields**.
98
101
  3. View and toggle the translation status for all fields in the document.
99
102
 
103
+ ### Translation Collision Handling
104
+
105
+ When translating a document to a locale that already has an existing translation, the plugin detects this "collision" and offers resolution options.
106
+
107
+ **Collision Detection**
108
+ A collision is detected when a translated document already exists for the same source document and target locale. The plugin identifies existing translations by:
109
+ 1. **Parent Reference**: Documents linked via `parentDocument._ref` to the source document.
110
+ 2. **Slug + Locale**: Documents with matching slug and locale (as a fallback).
111
+
112
+ **Resolution Modes**
113
+
114
+ When a collision is detected, you can choose how to handle it:
115
+
116
+ - **Replace existing translated document**: Overwrites the existing translation with the new content. The document ID remains the same.
117
+ - **Create new translated document**: Creates a new document with a unique ID. You can also specify what happens to the existing document:
118
+ - **Set existing document to draft**: Converts the existing published translation to a draft.
119
+ - **Delete existing document**: Permanently removes the existing translation.
120
+
121
+ **Configuration**
122
+
123
+ Default collision resolution settings can be configured in the **Easyling Translation Plugin Configuration** document:
124
+
125
+ 1. Navigate to the plugin configuration document in Sanity Studio.
126
+ 2. Find the **Translation** settings group.
127
+ 3. Set the **Default Collision Resolution Mode** (Replace or Create).
128
+ 4. If using Create mode, set the **Existing Document Handling** preference (Draft or Delete).
129
+
130
+ These defaults can be overridden on a per-translation basis in the locale selection dialog.
131
+
100
132
  ## Troubleshooting
101
133
 
102
134
  **Plugin not appearing in Studio**