GNOME Bugzilla – Bug 454894
support gtkbuilder format for contexts
Last modified: 2010-06-25 11:54:43 UTC
the format understood by GtkBuilder is similar to the modern glade format, but it treats context a bit different. The context is not embedded in the message, but specified separately, ie <property name="foo" translatable="yes" context="context">message</property> instead of <property name="foo" translatable="yes" context="yes">context|message</property> This is less likely to cause translation errors, and maps well to the msgctxt feature that was introduced in GNU gettext 0.15. The patch I'll attach adds gettext/gtkbuilder as a new format to intltool-extract. With the patch intltool-extract will generate calls like pgettext ("context", "message"); which modern xgettext will handle out of the box. To support older and non-GNU xgettext, the patch also adds a --nomsgctxt option, which makes intltool-extract emit gettext ("context|message"); instead.
Created attachment 91437 [details] [review] the patch
Matthias, thanks for the patch. It seems it wouldn't actually work for different contexts since it allows single context or no context per message, almost exactly the problem context support is designed to solve. Of course, this is not the fault of your patch, but of whoever implemented original glade context support (might even have been me), so that's not a blocker. To not actually change too much logic in intltool-extract, I'd suggest doing something like a trick gettext is doing when generating MO files with msgctxt: separate two strings with the \002 byte, and then split them when used etc. Yes, this means we won't allow \002 to appear in the messages, but it can't appear in MO files either, so I think we are pretty safe. However, I've split this up into a separate bug #458794. Also, before we actually land support for gtkbuilder, I'd like to have a regression test for gtkbuilder support, and perhaps intltool-update changes to actually enable usage of this mode (automatic pick-up of files, and actual extraction using standard intltool.m4 scripts--eg. look for glade in intltool-update.in.in). I also upped the priority since I believe we should support it as soon as possible, since it's going to be preferred format for gtk+ UI files from now on, right?
gettext itself uses \004 to separate msgctxt from msgid in mo files, so we might just use that
Any progress on this one? It seems GtkBuilder's UI files cannot be translated at all at the moment...
...which is a problem for e.g. swfdec-gnome, which was accepted in the desktop moduleset, but cannot be (completely) translated.
> Any progress on this one? It seems GtkBuilder's UI files cannot be translated > at all at the moment... It's only when using contexts (changing the summary to that effect), you can already translate ui files using: [type: gettext/glade]data/interface.ui in the po/POTFILES.in
Swfdec-gnome was updated to use this, so please ignore comment #5.
(In reply to comment #1) > Created an attachment (id=91437) [edit] > the patch > Now when bug 517559 is fixed, and atkproperty was done properly: (property|atkproperty) should be changed to (property|col) (which I hope ignores other attributes, property has name and col id) atkaction is done differently as well, and it is not translated on the gtkbuilder side yet.
I'd also suggest to add take advantage of this to add context support for generic XML files (would be useful e.g. for libgweather Locations.xml.in), using the same "context=" attribute.
This has been quiet for very long. Is further development / testing necessary? (Perhaps I can try to help out if I have time.) Moving to GtkBuilder looks attractive, but obviously things like these will stop migration for many projects.
Now that GTK+ 2.16 with full-fledged GtkBuilder support has been released. It will be unfortunate if intltool doesn't support it. The lack of I18N support will inhibit the migration from libglade to GtkBuilder.
So this is becoming a blocker for getting rid of libglade in GNOME.
Can anyone post a simple example that exploits all the translation features available in gtkbuilder? We need something to use for regression testing, and it would help me understand the differences between it and glade much better. There's also some issues with the fact that everyone is using .ui as the file extension for gtkbuilder files, as it conflicts with the .ui extension for bonoboui description files that everyone's been using for the last 9+ years.
Created attachment 137224 [details] A sample ui file Please correct this, if I am missing something.
So, any news here?
Intltool packed up and moved elsewhere, so I wouldn't expect any news here, ever.
True - I now realize the Launchpad link, thanks.
https://bugs.launchpad.net/intltool/+bug/409781
Fixed in 0.41.1 release of intltool (2010-03-24)