The rule
Every write says what it is based on: a version, or the copy the last pull left. If the server's text is no longer that, the write is refused. Nothing is overwritten unless you ask for it by name, with a flag or a choice in the app.
In the editor and the API
A save names the version of the translation it replaces. If someone else saved the same translation meanwhile, your save is not written. The editor keeps your text and offers Use theirs, Keep mine and Compare.
The API works the same way. A single write sends the version in If-Match. A bulk write names a base_version per item (0 for a text not there yet), and each item succeeds or fails on its own. See the API reference.
On a push
Source files
Your repository is the source of the source texts, so a push of source files is not checked against the server: the file wins. When a source text changes, the key's translations stay, and show as source changed until someone confirms or rewrites them. They no longer count as fresh.
Translation files
push --translations compares each translation file three ways: your file, the copy the last pull left in .localeasy/base/, and the server.
- Only the texts you changed since that pull are sent.
- If the server's text also changed since that pull, it is a conflict. The CLI checks every translation file before it writes anything, so one conflict stops the whole push, with exit 4.
- A file with no pulled copy cannot be compared. The push stops with exit 64 and names the command that imports it.
To get past a conflict, pull, redo your change, and push again.
--strategy overwrite --force skips the comparison: the files replace the server's translations wherever they differ. Use it for a first import.
Approved translations
A push does not replace an approved translation. It keeps the approved text, warns, and still exits 0:
! Warning 1 approved translation kept; the files would replace it and lose Approved
payment.pay_now sv
→ Add --allow-downgrade to accept thisWith --allow-downgrade the file's text is written and the translation is no longer approved. A status of approved in a file counts only when the pusher's role may approve.
On a pull
pull does not overwrite a translation file you changed and never pushed. It keeps the file and warns. Push it with push --translations, or take the server's with pull --force.
When a branch is merged
A branch holds only what it changed. A merge compares three states of each changed key and text: main as it was when the branch first changed it (the base), main now, and the branch.
| Main since the base | Branch | What the merge does |
|---|---|---|
| Unchanged | Branch: Changed | What the merge does: Writes the branch's side to main. |
| Changed the same way | Branch: Changed | What the merge does: Nothing: main already has it. |
| Any | Branch: Changed and changed back | What the merge does: Nothing: the branch has nothing to merge. |
| Changed only the status | Branch: Changed the text | What the merge does: Writes the branch's text and status. The text wins. |
| Changed the text | Branch: Changed only the status | What the merge does: Keeps main's text and status. The text wins. |
| Changed differently | Branch: Changed | What the merge does: A conflict. |
- States are compared, not edits. A text main changed and changed back has not changed.
- A merge is all or nothing. With one conflict left, nothing is written and the answer lists the conflicts, up to a limit.
merge --dry-rundoes the same comparison and writes nothing.- A project merges one branch at a time. A merge that meets another one under way is refused, with exit 4. Run it again when the first is done.
--expect-headrefuses the merge if the branch changed after you looked at it, also with exit 4.
The CLI prints each text conflict with both sides, main first:
$ localeasy merge feature/checkout-v2 --dry-run
· storefront · feature/checkout-v2 into main · dry run, nothing is written
· 148 changed translations on the branch · 131 merge cleanly · 14 already match main
✗ Error 3 conflicts, changed on both sides since the branch was made
checkout:payment.pay_now · sv
main Betala {$amount} nu
branch Betala {$amount} direkt
checkout:payment.pay_now · de
main Jetzt {$amount} zahlen
branch {$amount} jetzt bezahlen
checkout:summary.total · sv
main Summa
branch Totalt
→ Resolve with --strategy main, branch or newest, or in the app under Branches
· Exit 4 · Run 4bf92f3577b34da6a3ce929d0e0e4736 · http://api.test/docs/cli/exit-4Kinds of merge conflict
A conflict is on a text, or on the key itself: its removal (key), its name (name) or its details (meta). The API's answer names the kind and the part.
| Kind | On | What happened |
|---|---|---|
cell.both_modified | On: A text | What happened: Main and the branch both changed a text since the branch first changed it, and the two differ. |
cell.add_add | On: A text | What happened: Main and the branch both added the key, and their translations in one language differ. |
key.add_add | On: meta | What happened: Main and the branch both added the key, with different source texts or different details. The source text's conflict is a text's; the details' is on meta. |
key.deleted_on_main_modified_in_branch | On: key | What happened: Main deleted the key. The branch changed its name, its details or one of its texts. |
key.deleted_in_branch_modified_on_main | On: key | What happened: The branch deleted the key. Main changed it or one of its texts after the branch first touched it. |
key.rename_rename | On: name | What happened: Main and the branch renamed the key to different names. |
key.name_taken | On: name | What happened: The branch renamed the key to a name another key on main has. Only main's side settles it: the other key keeps its name. |
key.both_modified | On: meta | What happened: Main and the branch both changed the key's details (description, placeholders, length limit), differently. |
The branch's changes to a key it deleted are never merged, whatever happens to the key.
Settling merge conflicts
Settle conflicts in the app, on the branch's merge page under Branches, or with flags on localeasy merge. A side is main (keep main's), branch (take the branch's) or newest (the side changed last). fail leaves the conflict.
The most specific flag that names a conflict settles it:
--strategy-text key@locale=sidefor one text, or--strategy-part key@part=sidefor one conflict on the key itself.--strategy-key key=sidefor everything on one key.--on-deleted-key droporrecreatefor keys main deleted and the branch changed.--strategy-locale locale=sidefor one language's texts. It settles no conflict on a key itself.--strategy sidefor everything else.
# Take the branch's Swedish, keep main's for one key, and fail on anything else.
localeasy merge feature/checkout-v2 \
--strategy-locale sv=branch \
--strategy-key checkout:summary.total=main- A key is written
namespace:key, with(context)after a key that has one. - Settling a conflict on a key's removal as deleted drops the branch's texts of that key.
- In the API the sides are
oursfor main andtheirsfor the branch, in the merge'sstrategyobject.