xml2po and attributes with namespaces

View: New views
4 Messages — Rating Filter:   Alert me  

xml2po and attributes with namespaces

by Carsten Senger-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I'm working on an im-/export of translations so plone can be used as the
cms for www.gnome.org.
My current prototype exports the translatable content as html files and
works with xml2po's xhtml mode.
For the import I need to carry some more information inside the html files.
First I thought about encoding them into xhtml's id attribute, but using
custom attributes with a namespace is cleaner.

So currently the exported markup looks like this:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:translation="http://gnome.org/namespaces/wgotranslation"
      xmlns="http://www.w3.org/1999/xhtml">
  <head />
  <body>
    <div translation:handler="ATField"
         translation:uid="66be431c98adabc42d86a09f52f94258"
         translation:name="description">
      Translatable Text, maybe with xhtml markup
    </div>
  ...

Creating the pot file and merging the messagestrings back works, but xml2po
strips the namespace prefix from the attribute:

?xml version="1.0" encoding="utf-8"?>
<html xmlns:translation="http://gnome.org/namespaces/wgotranslation"
      xmlns="http://www.w3.org/1999/xhtml">
  <head/>
  <body xml:lang="DE">
    <div handler="ATField" uid="66be431c98adabc42d86a09f52f94258"
name="description">
        ....

While it's not essential for the import (there will be no conflict with
valid attributes for <div>) it would be nice if xml2po could preserve the
namespace prefix like it preserved the prefix definition.
I've looked at the xml parsing code of xml2po, but I've never worked with
libxml and have no clue how to fix it.

Cheers,

..Carsten
_______________________________________________
gnome-web-list mailing list
gnome-web-list@...
http://mail.gnome.org/mailman/listinfo/gnome-web-list

Re: xml2po and attributes with namespaces

by Claude Paroz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le jeudi 24 septembre 2009 à 13:20 +0200, Carsten Senger a écrit :

> Hi all,
>
> I'm working on an im-/export of translations so plone can be used as the
> cms for www.gnome.org.
> My current prototype exports the translatable content as html files and
> works with xml2po's xhtml mode.
> For the import I need to carry some more information inside the html files.
> First I thought about encoding them into xhtml's id attribute, but using
> custom attributes with a namespace is cleaner.
>
> So currently the exported markup looks like this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <html xmlns:translation="http://gnome.org/namespaces/wgotranslation"
>       xmlns="http://www.w3.org/1999/xhtml">
>   <head />
>   <body>
>     <div translation:handler="ATField"
>          translation:uid="66be431c98adabc42d86a09f52f94258"
>          translation:name="description">
>       Translatable Text, maybe with xhtml markup
>     </div>
>   ...
>
> Creating the pot file and merging the messagestrings back works, but xml2po
> strips the namespace prefix from the attribute:
>
> ?xml version="1.0" encoding="utf-8"?>
> <html xmlns:translation="http://gnome.org/namespaces/wgotranslation"
>       xmlns="http://www.w3.org/1999/xhtml">
>   <head/>
>   <body xml:lang="DE">
>     <div handler="ATField" uid="66be431c98adabc42d86a09f52f94258"
> name="description">
> ....
>
> While it's not essential for the import (there will be no conflict with
> valid attributes for <div>) it would be nice if xml2po could preserve the
> namespace prefix like it preserved the prefix definition.
> I've looked at the xml parsing code of xml2po, but I've never worked with
> libxml and have no clue how to fix it.

Please enter a bug with sample files in Bugzilla xml2po product.
I'm currently in the process of partially rewriting xml handling in
xml2po, so it might be a good time to add this sort of bug/requirement.

Claude

_______________________________________________
gnome-web-list mailing list
gnome-web-list@...
http://mail.gnome.org/mailman/listinfo/gnome-web-list

Re: xml2po and attributes with namespaces

by grakic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

У чет, 24. 09 2009. у 13:30 +0200, Claude Paroz пише:

> Please enter a bug with sample files in Bugzilla xml2po product.
> I'm currently in the process of partially rewriting xml handling in
> xml2po, so it might be a good time to add this sort of bug/requirement.

I have a patch for xml2po I used to handle ODF documents that enable
preserving XML namespaces. I will dig this up and upload to the bugzilla
once the bug is filled.

Goran


_______________________________________________
gnome-web-list mailing list
gnome-web-list@...
http://mail.gnome.org/mailman/listinfo/gnome-web-list

Re: xml2po and attributes with namespaces

by Claude Paroz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le samedi 26 septembre 2009 à 16:55 +0200, Goran Rakic a écrit :
> У чет, 24. 09 2009. у 13:30 +0200, Claude Paroz пише:
>
> > Please enter a bug with sample files in Bugzilla xml2po product.
> > I'm currently in the process of partially rewriting xml handling in
> > xml2po, so it might be a good time to add this sort of bug/requirement.
>
> I have a patch for xml2po I used to handle ODF documents that enable
> preserving XML namespaces. I will dig this up and upload to the bugzilla
> once the bug is filled.

As Carsten didn't seem to have the time to enter a bug report, I did it
myself: https://bugzilla.gnome.org/show_bug.cgi?id=597476

I already have a patch based on the partial xml2po rewrite I've recently
done, but I would be very interested to see how you resolved this issue
for ODF documents.
BTW, it would be nice to have a regression test with a sample ODF
document.

Cheers,

Claude

_______________________________________________
gnome-web-list mailing list
gnome-web-list@...
http://mail.gnome.org/mailman/listinfo/gnome-web-list