Re: [xml] Localizing the validation messages

Merci Daniel.

I can see how I could localize the error types (1871,  XML_SCHEMAV_ELEMENT_CONTENT,  "Missing child element(s)").

I have problem with what surrounds the "Missing child element(s)." part.

For instance, the « Element 'a' » and the « Expected is (c) » parts in "Element 'a': Missing child element(s). Expected is ( c )." , it looks like I will need to parse the message string to get these parts. Or are these strings available somewhere in easy localizable format? (I surmise str1, str2, str2 may perhaps contain that information, but it does not seem available in lxml ( or the libxml2 python interface I used (

P. A.

Le 2012-11-08 22:29, Daniel Veillard a écrit :
On Thu, Nov 08, 2012 at 02:16:52PM -0500, Patrick wrote:
Our technical customers do not want to see English messages when the
documents they tag do not conform to the XSD schema defined. The
tool uses lxml which I understand is a pythonic binding to libxml2.

They want the XML validation messages in their language.

So, not

Element 'b': Element content is not allowed, because the type
definition is simple.

but, for instance,

Élément 'b' : Pas de contenu d'élément permis, parce que la
définition de type est simple.
Elemento 'b': Elemento de contenido no está permitido, ya que la
definición de tipo es simple.

I believe localization of libxml2 has not been implemented, is that
still true? How hard would it be to do?
 You can localize on top of libxml2.
The structured error handler should give you everything you need
to implement your own localization.
I'm not sure I want to do this in libxml2, due to dependencies,
portability and the fact that it's a developper toolkit, not the
right level to emit user level messages.


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