After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 454894 - support gtkbuilder format for contexts
support gtkbuilder format for contexts
Status: RESOLVED FIXED
Product: intltool
Classification: Deprecated
Component: general
unspecified
Other Linux
: High blocker
: ---
Assigned To: intltool maintainers
intltool maintainers
Depends on:
Blocks: 553104 572883 586536
 
 
Reported: 2007-07-08 16:37 UTC by Matthias Clasen
Modified: 2010-06-25 11:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the patch (2.84 KB, patch)
2007-07-08 16:38 UTC, Matthias Clasen
needs-work Details | Review
A sample ui file (1.01 KB, application/octet-stream)
2009-06-23 02:29 UTC, Hiroyuki Ikezoe
  Details

Description Matthias Clasen 2007-07-08 16:37:56 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.
Comment 1 Matthias Clasen 2007-07-08 16:38:49 UTC
Created attachment 91437 [details] [review]
the patch
Comment 2 Danilo Segan 2007-07-20 21:43:04 UTC
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?
Comment 3 Matthias Clasen 2007-07-24 13:36:23 UTC
gettext itself uses \004 to separate msgctxt from msgid in mo files, so we might just use that
Comment 4 Wouter Bolsterlee (uws) 2008-02-04 13:07:32 UTC
Any progress on this one? It seems GtkBuilder's UI files cannot be translated at all at the moment...
Comment 5 Wouter Bolsterlee (uws) 2008-02-04 13:17:06 UTC
...which is a problem for e.g. swfdec-gnome, which was accepted in the desktop moduleset, but cannot be (completely) translated.
Comment 6 Bastien Nocera 2008-02-04 15:23:28 UTC
> 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


Comment 7 Wouter Bolsterlee (uws) 2008-02-04 15:55:10 UTC
Swfdec-gnome was updated to use this, so please ignore comment #5.
Comment 8 Johan (not receiving bugmail) Dahlin 2008-03-02 01:34:30 UTC
(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.

Comment 9 Claude Paroz 2008-04-12 11:49:04 UTC
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. 
Comment 10 F Wolff 2009-01-05 20:33:05 UTC
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.
Comment 11 Deng Xiyue 2009-03-26 08:06:52 UTC
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.
Comment 12 André Klapper 2009-05-04 17:55:19 UTC
So this is becoming a blocker for getting rid of libglade in GNOME.
Comment 13 Rodney Dawes 2009-06-01 02:53:01 UTC
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.
Comment 14 Hiroyuki Ikezoe 2009-06-23 02:29:17 UTC
Created attachment 137224 [details]
A sample ui file

Please correct this, if I am missing something.
Comment 15 André Klapper 2009-10-05 14:45:28 UTC
So, any news here?
Comment 16 Matthias Clasen 2009-10-05 15:12:10 UTC
Intltool packed up and moved elsewhere, so I wouldn't expect any news here, ever.
Comment 17 André Klapper 2009-10-05 15:33:06 UTC
True - I now realize the Launchpad link, thanks.
Comment 18 Claude Paroz 2009-10-05 15:33:47 UTC
https://bugs.launchpad.net/intltool/+bug/409781
Comment 19 Claude Paroz 2010-06-25 11:54:43 UTC
Fixed in 0.41.1 release of intltool (2010-03-24)