WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.67k stars 1.02k forks source link

Resolve merge conflicts automatically #13163

Open stokito opened 3 days ago

stokito commented 3 days ago

Describe the problem

When source code changed and the same line was changed in the Weblate too then it will result in merge conflict:

Rebasing (1/2)
Auto-merging info_ar.po
CONFLICT (content): Merge conflict in info_ar.po
error: could not apply af2fe15d36... Translated using Weblate
hint: Resolve all conflicts manually, mark them as resolved with

Then the Weblate is blocking in maintenance mode. This is highly inconvenient but also forces users to always use the Weblate.

Describe the solution you would like

In most cases the Weblate can do the merging itself: take the source string but the existing translation move to draft and notify a translator.

Describe alternatives you have considered

No response

Screenshots

No response

Additional context

https://github.com/openwrt/luci/pull/7434

nijel commented 2 days ago

When possible, Weblate already does this thanks to the built-in Gettext PO merge driver (see https://github.com/WeblateOrg/weblate/issues/55 for discussions about that).

Anything can be improved, so if you have any specific idea how to make it work better, please share it.

Meanwhile, you might want to implement an approach to avoid such conflicts in the first place, see https://docs.weblate.org/en/latest/admin/continuous.html#avoid-merge-conflicts (I've just tried to better structure that in https://github.com/WeblateOrg/weblate/pull/13167).

Generally speaking, squashing makes resolving conflicts always a bit harder because Git might not be able to see that a certain commit is already applied if it was squashed with another commit that changes the same block.

rcc1101 commented 17 hours ago

Hi,

I have the same issue. First of all why should merge happen? Isnt weblate few commits behind the source branch and it should just update itself? Like the same case when we try to update using git pull <> doesnt land into conflicts.