Re: i18n of app menus



On Mon, 2012-01-23 at 09:11 -0500, Shaun McCance wrote:
> On Mon, 2012-01-23 at 06:36 -0500, Matthias Clasen wrote:
> > On Sun, Jan 22, 2012 at 3:13 PM, Olav Vitters <olav vitters nl> wrote:
> > > How can those app menus be translated? Is anyone on the gnome-i18n
> > > mailing list?
> > 
> > The same way gtkbuilder xml files can be translated. Specify the
> > domain when loading the xml file, and put the strings into your mo
> > file.
> > You can use intltool with the usual _-prefixing convention for attribute names.
> 
> That's not the way GtkBuilder XML files have been translated. The
> strings were extracted using intltool's glade mode, not xml mode.
> This extracts the contents of any element with translatable="yes".
> But now instead of translatable strings being in the contents of
> marked elements, they're in attribute values. From epiphany:
> 
> http://git.gnome.org/browse/epiphany/plain/data/ui/epiphany-application-menu.ui

So I just read this:

http://developer.gnome.org/gio/2.31/gio-GMenu-Markup.html

It turns out this:

  <item label='_New Window' action='app.new' accel='&lt;Primary>n'/>

is really shorthand for this:

  <item>
    <attribute name='label'>_New Window</attribute>
    <attribute name='action'>app.new</attribute>
    <attribute name='accel'>&lt;Primary>n</attribute>
  </item>

or presumably this:

  <item action='app.new' accel='&lt;Primary>n'>
    <attribute name='label'>_New Window</attribute>
  </item>

And attribute elements can have the translatable attribute, so
we really ought to be writing this like this:

  <item action='app.new' accel='&lt;Primary>n'>
    <attribute name='label' translatable='yes'>_New Window</attribute>
  </item>

And then we can use intltool's glade mode and not do terrible hacks
to our XML files.

--
Shaun




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]