You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/weblate.md
+18-8Lines changed: 18 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,11 @@
2
2
3
3
Weblate is our translation platform which we self-host at https://translate.couchershq.org. It provides a UI for translators to consume our `locales/en.json` files and produce `locales/<not-en>.json` files for every locale we support.
4
4
5
-
Weblate maintains a clone of the `git` repo. It appends commits with translation changes to its `develop` branch, and periodically opens pull requests to merge its `develop` branch into GitHub's. Sometimes conflicts can happen where this merge operation fails, at which point Weblate locks up until we resolve it.
5
+
## Weblate's git clone
6
6
7
-
Although all Weblate components share the same `git` repo clone, the [web-app-auth](https://translate.couchershq.org/git/couchers/web-app-auth) component is configured to own the clone, and other components are configured to refence it. As such, all Weblate repo maintenance operations are on the `web-app-auth` component.
7
+
Weblate maintains a clone of the GitHub repo. It keeps up-to-date with new commits in GitHub's `develop` branch, while appending commits with translation changes to its own `develop` branch, and maintaining a GitHub pull request to merge them back into GitHub's. Sometimes conflicts can happen where this merge operation fails, at which point Weblate locks up until we resolve it.
8
+
9
+
Although all Weblate components share the same git repo clone, the [web-app-auth](https://translate.couchershq.org/git/couchers/web-app-auth) component is configured to own the clone, and other components are configured to refence it. As such, all Weblate repo maintenance operations are on the `web-app-auth` component.
8
10
9
11
You can add Weblate's repo clone for read-only access as any other remote. We usually call it `weblate`:
Weblate conflicts occur when it fails to reconciliate GitHub's `develop` branch with its own `develop` branch, meaning that a translation file was modified in GitHub and differently in Weblate. Surprisingly, conflicts are also likely when merging Weblate PRs using the `squash` strategy, since Weblate's won't find its commits in upstream, and its individual commits might conflict with the final squashed commit in GitHub, even if they lead to the same file state.
22
+
17
23
## Avoiding conflicts
18
24
19
25
- ✅ DO: Always merge Weblate PRs using the `merge` strategy. To make this easier, the [weblate-automerge.yml](.github/weblate-automerge.yml) GitHub workflow will mark new Weblate PRs as auto-merging with the `merge` strategy.
@@ -39,23 +45,27 @@ If you're confident that your string's translations and its viscinity are not be
39
45
1. Refactor the string keys, open a PR and merge it.
40
46
1. Unlock the Weblate component.
41
47
42
-
## Why conflicts occur
43
-
44
-
Weblate conflicts occur when it fails to reconciliate GitHub's `develop` branch with its own `develop`, meaning that a translation file was modified in GitHub and differently in Weblate. Surprisingly, conflicts are also likely when merging Weblate PRs using the `squash` strategy, since Weblate's won't find its commits in upstream, and its individual commits might conflict with the final squashed commit in GitHub, even if they lead to the same file state. For this reason, Webl
45
-
46
48
## Resolving conflicts
47
49
48
-
The goal of conflict resolution is to allow Weblate to reconciliate its queued commits with what's already in GitHub. Weblate gives a few tools to modify its `develop` branch, but those are fraught (big scary red buttons), so the better approach is to merge Weblate's queued commits into GitHub, after which it will automatically clear its queue. Follow the steps below, and make sure to merge your PR with the `merge` strategy!
50
+
The goal of conflict resolution is to allow Weblate to reconciliate its queued commits with what's already in GitHub. Weblate gives a few tools to modify its `develop` branch, but those are fraught (big scary red buttons), so the better approach is to merge Weblate's queued commits into GitHub, after which it will automatically clear its queue.
51
+
52
+
First merge the two latest `develop` branches:
49
53
50
54
```sh
51
55
git fetch origin develop
52
56
git checkout origin/develop
53
57
54
58
git fetch weblate develop
55
59
git merge weblate/develop
60
+
```
56
61
57
-
# <resolve any conflictsand commit the resolution>
62
+
If any there are any conflicts, resolve them and commit the resolution. Note that sometimes the merge is a no-op because the state of the files are the same in the two branches, but the commits leading to there can still be different and this confuses Weblate, so keep going.
58
63
64
+
Then, create a branch and push it to GitHub:
65
+
66
+
```sh
59
67
git checkout -b i18n/merge-weblate
60
68
git push
61
69
```
70
+
71
+
Finally, create a pull request, get it reviewed and merge it, but **make sure to use the `merge` strategy**!
0 commit comments