translations and replacing deprecated "use-stock" gtk property

Caolán McNamara caolanm at redhat.com
Wed Jan 13 17:01:51 UTC 2021


With an eye to clearing deprecated properties used by our current gtk3
version which won't exist in gtk4 I'd like to remove our use of
deprecated "use-stock" labels for GtkButtons. This is mostly "gtk-ok",
"gtk-cancel" and "gtk-help" where the recommended replacement is
translatable "Ok", "Cancel" and "Help" labels
(https://developer.gnome.org/gtk3/stable/gtk3-Stock-Items.html)

I've added a script bin/ui-converter-skeleton.py which is able to load
our .ui files and write them again without causing any change to the
output .ui. So this can be used to modify our .ui files without adding
extra unwanted cosmetic changes.

But just replacing each use-stock gtk-FOO label with the suggested
replacement translation using our current scheme of having a different
context for each .ui string would result in over a thousand extra
translations of the same limited set of stock labels.

What I'm thinking to do instead, to reduce translation work, is
https://gerrit.libreoffice.org/c/core/+/108812/5
where f.e. a gtk-cancel changes from

<property name="label">gtk-cancel</property>

to

<property name="label" translatable="yes"
context="stock">_Cancel</property>

where they all have the same context "stock" but to filter out all
labels in uiex using a "stock" context from .ui files so that all these
duplicates are not recorded in the modules messages.po that uiex
extracts them to (which our tooling would flag as an error). And
instead in l10ntools/source/localize.cxx (which is what calls uiex)
output one set of the stock labels to the messages.po so "Ok",
"Cancel", "Help" only has to be translated once per module.



More information about the LibreOffice mailing list