Translatable XML files
Jasper Huijsmans
jasper at xfce.org
Thu Feb 17 15:08:32 CET 2005
On Thu, Feb 17, 2005 at 01:22:56PM +0100, Benedikt Meurer wrote:
> Jasper Huijsmans wrote:
> >>>Well, as far as .desktop files are concerned, I'd like to translate
> >>>it in PO file (with intltool), in this case of course, translation
> >>>so far is discarded, but it'll reduce where translation needs, also
> >>>it can be said XML file. To keep XML file sync'd, I think it's better
> >>>each languages'll be treated one file with tag e.g.
> >>>
> >>><tag xml:lang="en">Hello world!</tag>
> >>>
> >>>is it bad idea? it also needs .xml.in files tough.
> >>
> >>great idea as beeny pointed out and if you've some work done submit a
hehe, 'beeny' -- have you been talking to kelnos lately? ;)
> >>patch to benny, he is our autotools guru ;)
> >
> >It's a good idea, but it requires not only autotools cahnges, but also
> >changes to the xml parsing, please correct me if I'm wrong. If someone
> >wants
> >to have a look at it for 4.4, I'll gladly take patches for the panel ;-)
>
> Thats exactly the point (the autotools changes are more or less
> trivial). Instead of having one .xml file per language, you'd have all
> languages in one .xml file (using the standardized xml:lang attribute), e.g.
>
> <?xml version="1.0"?>
> <Xfce>
> <Panel orientation="0" size="1" popupposition="1">
> </Panel>
> <Groups>
> <Group>
> <Popup/>
> <Control id="-2" popup="0">
> <Command term="0" sn="0">Terminal</Command>
> <Tooltip>Terminal</Tooltip>
> <Tooltip xml:lang="de">Befehlszeile</Tooltip>
> <Icon id="12"/>
> </Control>
> </Group>
> </Groups>
> </Xfce>
>
Yeah, we could even get away with only reading it for the system config file
and just write in user's locale, just like we do now and just like what
happens when you add your own launchers. Ah, well, we'll see about that; I'll
have a look at this some time in the near future (intentionally vague ;).
> This is pretty trivial for the panel, as there's only the <Tooltip> and
> the <Caption> tags that need translations, but for the menu.xml file,
> this won't work, because it has translatable strings as attribute
> values, rather than TEXT elements. On the other hand, this won't matter
> if we implement the XDG menu-spec for 4.4 (the .menu files don't contain
> translatable strings, but the translatable strings are located in
> standard .desktop and .directory files).
>
As a side note, I'm really looking forward to the menu system upgrade.
> So, the menu.xml and xfce-registered-categories.xml files will go away,
> and will be replaced with a single xfce4.menu w/o translatable strings
> and a bunch of .directory files, that can be handled by intltool just
> like .desktop files.
>
> So, afterall, we only have the panel's contents.xml file left for 4.4
> then. As said above, this is pretty easy; all you need to do is to check
> for translated <Tooltip>'s and <Caption>'s, and then find the best match
> using xfce_locale_match(). A sample GLib-based parser for the MIME info
> files, which includes translatable <comment> tags, is available at
>
> http://thunar.xfce.org/wiki/implementation:mime-info-parser
>
> that should give you a basic idea.
>
Thanks ;)
> > Jasper
>
> Benedikt
>
> PS: Discuss this on xfce4-dev rather than xfce-i18n?
Agreed ;)
More information about the Xfce4-dev
mailing list