Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / docs / i18n-weblate.md

i18n-weblate.md2.8 KiBRenderedCodeRaw
1# Translations (Hosted Weblate)
2
3## Flow
4
5- Instance: https://hosted.weblate.org/projects/modern-apps/ — one
6 component per app module, file mask
7 `<module>/src/main/res/values-*/strings.xml`, source template
8 `<module>/src/main/res/values/strings.xml`.
9- Components read branch `main` of
10 `https://git.maproj.org/Modern-Apps.git`, commit translations on
11 Weblate's local `main`, and push to the `translate` branch
12 (`push_branch=translate`, `merge_style=rebase`,
13 `push_on_commit=true`). Linked components share the repository of
14 their link target, so one repository error locks every component in
15 the group.
16- Translations reach the apps when `translate` is merged into `main`
17 in this repo. Until that merge happens, Weblate's rebased
18 translation commits are not ancestors of the remote `translate`
19 tip, so its hourly push is rejected as non-fast-forward. Merging
20 `translate` promptly is part of the flow, not an optional cleanup.
21
22## Merging translations
23
24Merge `origin/translate` (or cherry-pick the pending commits from
25the Weblate git exporter,
26`https://hosted.weblate.org/git/modern-apps/calendar/`) into `main`.
27Resolve per key, in this order:
28
29- A key deleted from the English source is deleted from every
30 locale; a translator edit to such a key is dropped, never
31 reintroduced (it would be an orphan `ExtraTranslation`).
32- A key whose English text changed keeps the main-side source; the
33 translation is retranslated against it in Weblate.
34- Otherwise the translator's value wins.
35- End-of-file appends on both sides keep both additions; do not
36 duplicate a key main already carries elsewhere in the file.
37
38## Lock recovery
39
40A `MergeFailure` alert auto-locks all linked components and leaves
41Weblate's clone mid-rebase. Recovery, in the Weblate UI for one
42repository-holding component (Calendar covers the calendar-linked
43group; Backup covers its group):
44
451. Integrate the pending translation commits into `main` as above,
46 so nothing translators did is lost.
472. Repository maintenance → **Reset**. This discards Weblate's local
48 commits and mid-rebase state and re-syncs from `main`. Do not
49 retry the rebase first: it replays the same commits onto the same
50 conflict.
513. Unlock the component; the linked components unlock with it.
524. Confirm the `MergeFailure` / `RepositoryOutdated` alerts clear
53 and a repository push succeeds.
54
55## Server-side settings (Weblate project admin)
56
57- With `merge_style=rebase` and a separate `translate` push branch,
58 enable force push for the component VCS (`git_force_push`) so a
59 rebased push to `translate` succeeds between merges into `main`;
60 without it every rebase after `main` moves is a non-fast-forward
61 rejection and pending commits pile up until one conflicts.
62- Keep `push_on_commit` on so translated strings are committed in
63 Weblate immediately; the pending-commit list is the recovery
64 source when a lock happens.