Bulk translation of new " stock" strings

Hi

1) The recent additions of LibreOffice UI has some "stock" strings
repeated in many files. For example

https://translations.documentfoundation.org/translate/libo_ui-master/dbaccessmessages/pt_BR/?q=state:<translated

_Add
_Cancel
_Delete
_OK
...
Up to 13 new strings like these above.

Is there a way to apply a translated string to all occurrences of these
"stock" strings in the many weblate projects?

So far I had to go one by one and it is dull.

2) even adding a translation to say, "_Yes", my translated string is not
offered in the memory translation for the next occurrence of "_Yes".

TM does not seem record new translations recently (for the given stock
strings)

Thanks

Hi,
I have translated these off-line using the potrans.py script available
at https://github.com/milossramek/translation-scripts (the weblate
subdirectory), it took maybe 20 minutes (500 strings)

the workflow:
1. get the script and configure your environment (described in
documentation)
2. download translation files to a local repository: "./potrans.py -p ui
download"
3. export untranslated to csv: "./potrans.py -p ui -u export >
untranslated.csv"  (without the -u switch all strings are exported)
4. translate the csv in libreoffice, save as translated.csv (sort the
table according the column Source, translation of numerous identical
strings is then very fast. Not all string need be translated this way)
5. import to the local repository: "./potrans.py -p ui -c translated.csv
import"
5a. Check what has changed in the repository: "./potrans.py -p ui diff"
6. upload to the server "./potrans.py -p ui upload"
 
I am currently its only user and I would appreciate your comments :), thanks
Milos

Hi Olivier,

1) The recent additions of LibreOffice UI has some "stock" strings
repeated in many files. For example

https://translations.documentfoundation.org/translate/libo_ui-master/dbaccessmessages/pt_BR/?q=state:<translated

_Add
_Cancel
_Delete
_OK
...
Up to 13 new strings like these above.

Is there a way to apply a translated string to all occurrences of these
"stock" strings in the many weblate projects?

Well, yes and no..
Stock weblate would handle this by going to the "other occurrences"
tab and using the "apply translation to all propagated strings".
However we modified the part that determines how to propagate strings
(across projects) - so doesn't work that way, as for that to work the
component name needs to be the same.

I did just modify it to also deal with context "stock" differently, so
that then is the way to do it in weblate.

And then there of course is scripted way for advanced users.

ciao
Christian

Ah Excellent!

Problem solved in 13 clicks instead of several hundreds!

Thank you!
Olivier

Thanks, that worked well for me too :slight_smile:

Question: Is there a way to something similar with failing checks?

The Welsh translation has between 706 and 1387 failing checks each across 6.3 to 7.1 and master. These were mainly introduced with the transfer to Weblate. Clearing them would be a nice to do, most of them are not errors and the don't appear to impact the translation. I could just leave them I suppose.

Any suggestions?

Rhos

Ar 25/01/2021 14:21, ysgrifennodd Olivier Hallot:

No easy answer on that one. Some checks might be false positives, but
others probably are not.

In your case it seems all failing checks are "unchanged translation" -
so those are OK to just ignore.

I can patch weblate to never apply the check for Welsh/cy if you think
it makes sense..
https://github.com/WeblateOrg/weblate/blob/fa5108b0847428529e003bc45a8a32c7f4faa2d6/weblate/checks/same.py#L212

ciao
Christian

Thanks, I think I'll just ignore them.

:slight_smile:

Ar 27/01/2021 13:36, ysgrifennodd Christian Lohmaier:

Hello all,

What are these "stock" strings for anyway? And why isn't there a more meaningful context string?

BR,
Tuomas

Christian Lohmaier kirjoitti 25.1.2021 15:40:

This is from
https://lists.freedesktop.org/archives/libreoffice/2021-January/086638.html
where previously all the ok, cancel, help buttons didn't have
translatable strings but used "stock" names like gtk-ok, gtk-cancel,
gtk-help. These "stock" names are deprecated in gtk3 and gone in gtk4
so we will need to provide our own translations for them in each
module.mo.

The attempted compromise was to use a context of "stock" for those
translations so each set would only appear once in each module.

I see, thanks. I'm not subcribed to that list.

Tuomas

Caolán McNamara kirjoitti 18.2.2021 22:23: