Question about file download/upload on Weblate

I have a question regarding updating the translations on Weblate using the file downloading/uploading method.

I usually just use the web interface of Weblate, and I appreciate the feature of linking the "6.4 UI" and "master UI" translations together so that the changes I did in one branch is automatically copied to the other as long as the source strings are the same (maybe the translated strings need to be the same as well? I am not sure).

But occasionally I use the file downloading and uploading method to give a certain component an overall change, covering quite a few strings at the same time. However, if I do this to the "6.4 UI" branch, the changes are not propagated to "master UI" automatically. For example, the changes I made in
https://translations.documentfoundation.org/translate/libo_ui-6-4/instsetoo_nativeinc_openofficewindowsmsi_languages/zh_Hans/?checksum=50716ed40498e6c7#history
are not carried over:
https://translations.documentfoundation.org/translate/libo_ui-master/instsetoo_nativeinc_openofficewindowsmsi_languages/zh_Hans/?checksum=50716ed40498e6c7#history

Is there any option or procedure that can enable automatic propagation between branches? Or do I have to upload the file twice, one for each branch?

Thanks in advance,
Ming

Hi Ming,

I have a question regarding updating the translations on Weblate using the file downloading/uploading method.

I usually just use the web interface of Weblate, and I appreciate the feature of linking the "6.4 UI" and "master UI" translations together so that the changes I did in one branch is automatically copied to the other as long as the source strings are the same (maybe the translated strings need to be the same as well? I am not sure).

But occasionally I use the file downloading and uploading method to give a certain component an overall change, covering quite a few strings at the same time. However, if I do this to the "6.4 UI" branch, the changes are not propagated to "master UI" automatically. For example, the changes I made in
https://translations.documentfoundation.org/translate/libo_ui-6-4/instsetoo_nativeinc_openofficewindowsmsi_languages/zh_Hans/?checksum=50716ed40498e6c7#history
are not carried over:
https://translations.documentfoundation.org/translate/libo_ui-master/instsetoo_nativeinc_openofficewindowsmsi_languages/zh_Hans/?checksum=50716ed40498e6c7#history

Is there any option or procedure that can enable automatic propagation between branches? Or do I have to upload the file twice, one for each branch?

I asked Christian to have a look and will get back to you asap
Cheers
Sophie

Hi Ming, *,

I have a question regarding updating the translations on Weblate using the file downloading/uploading method.

I usually just use the web interface of Weblate, and I appreciate the feature of linking the "6.4 UI" and "master UI" translations together so that the changes I did in one branch is automatically copied to the other as long as the source strings are the same (maybe the translated strings need to be the same as well? I am not sure).

Yes. translation must also be same for it to propagate

But occasionally I use the file downloading and uploading method to give a certain component an overall change, covering quite a few strings at the same time. […]

Is there any option or procedure that can enable automatic propagation between branches?

Propagation of translations on file upload has been explicitly
disabled by weblate authors:
https://github.com/WeblateOrg/weblate/commit/c31b7e9f48dd828e1d63a9c81118b4ec204e64db

Could be reenabled again on our instance if majority of translators agree.

Or do I have to upload the file twice, one for each branch?

Please don't use the same file twice. Please download the files for
both branches separately and locally merge your changes before
reuploading

ciao
Christian

Hi Christian,

Thanks for the detailed explanation.

------------------ Original ------------------

Hi Ming, *,

[…]
>
> Please don't use the same file twice. Please download the files for
> both branches separately and locally merge your changes before
> reuploading

Yes I understand PO files are a bit tricky. I tried "msgmerge -o new-master.po -N 6-4.po master.po" a while ago when I tried to rectify the discrepancy caused by my file upload, but the result new-master.po contained too many unrelated changes and I ended up discarding it and manually edited the master.po file instead. I'll ask on this list if I need to do this again in the future and can't figure it out myself.

The tools from the translate-toolkit are better suited for work like
this than the plain gettext commands (esp. when dealing with multiple
files at once, since you can use directories with it)/a multi step
process is better suited.

http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pomerge.html

so let's say you edited the 6.4 files, and you want all identical
source strings to be the same translation (not only those you
touched), you could use:

pomerge --mergeblanks=no --mergefuzzy=no -t master.po -i 6-4.po -o
updated_master.po
(can also directrly specify master.po in the outfile, but likely
better to do in separate file first to compare/sanity check :-))

Since pomerge doesn't have a --no-wrap switch, long lines get split up
into multiple lines in the output, and that makes comparing it to the
original harder, so add another step:

msgcat --no-wrap updated_master.po > final_master.po

the you can easily diff master.po to final_master.po with your
favorite diffing tool to double-check the changes.

The main difference between using pomerge and msgmerge is that pomerge
hs the --mergeblanks=no switch.
Of course can also be wanted to have strings untranslated in the
target as well, but if it is you can enable it :slight_smile: pomerge will
"complain" about different units though (if a unit just is in one
file) - but will do its job nevertheless.

ciao
Christian

ciao
Christian