Deprecation of stock items prevents reusing GTK’s label translations in a project also using its own translations with GtkBuilder
When using stock items, GTK+ always provides the label for the stock item in a properly localized form.
The recommended replacement for stock items is to use a named icon and a label with suggested text. Talking concretely about GTK_STOCK_OPEN
, the recommended label is _Open
. This works fine in English, and one can also obtain GTK’s translation from the gtk30
gettext domain, so everything is fine.
Except everything isn’t fine if you’re using GtkBuilder
. A whole builder only allows a single translation domain to be specified. With stock items, you could set the translation domain to frobnitzer
, add a stock Open button and a non-stock Frobnitz button, and the stock Open button would use GTK’s translation of “Open” while the non-stock button would use the application’s translation of “Frobnitz”. But with the new way, either you set the builder’s translation domain to frobnitzer
and then the Open button doesn’t get translated, or you set the builder’s translation domain to gtk30
and the Frobnitz button doesn’t get translated.
I think the documentation explaining that stock items are deprecated should explain what’s recommended in the new way—even if it’s just a line saying “you should never have done that in the first place, if you have any non-stock controls in your application then you should get your translators to translate everything instead of only the non-stock stuff”, it’s not really obvious IMO. Or if there is a way to accomplish this which my research has missed, I think it’s worth calling out more obviously in the documentation, because I haven’t found one, so to me it seems as if the recommended labels are inferior to stock items.