If there are too many changes, Weblate might not be able to resolve them automatically. You will then have to fix stuff locally, to do so, follow these stetps:
Gather the commits from weblate by adding an extra remote to your local repo
git remote add weblate https://hosted.weblate.org/git/hedy/adventures/
This enables us to contact the weblate repo.
Now grab the Weblate commits
With git fetch weblate
you get all commits that exist in weblate.
Make a new branch
Switch to a fresh branch with git checkout -b newbranchname
Merge Weblate commits in
Now with git merge weblate/main
you can merge the Weblate commits into the current branch. This can lead to merge conflicts (in fact, it will, cause why otherwise would you be going trough all this trouble?) that you will have to manually fix.
Push the fixed branch
Now push newbranchname and Weblate is happy again again, because it will see that all its commits are in the repo.
Sometimes Weblate gets angry because we accidentally repeat a certain key. Since Babel does not care about that, we only see this when we have merged into main and Weblate is updated. Maybe there is a setting that can fix that but for now, this little bash magic will also tell you where the problem lies:
For the po files:
for x in */LC_MESSAGES/messages.po;do echo $x ; sort $x | uniq -c | grep "2 msgid"; done
For messages.pot
:
sort messages.pot | uniq -c | grep "2 msgid"
There are a few Weblate peculiarities that are handy to know in working with the strings. If you add a new string in the code base in English, it will be automatially copied to ll languages in English, and then shown in English in the UI. However if you update a string, the original (even if it is still the original, untranslated English one) will remain as is in Weblate, and will just be shown as #fuzzy (which is not visible to users of the Hedy site)
Installing wlc (pip install wlc) gives you some control over the Weblate environment. To use this, create a .weblate file in the root and put the following content in there:
[weblate]
url = https://hosted.weblate.org/api/
translation = hedy/adventures
key = <personal key>
The personal key can be found in your profile on Weblate.