I would recommend that we support both versions of the xml:lang attribute. The UtilProperties class and the Label Manager application can be updated to read either version and write the correct version.

That way we will have an upgrade path without breaking backward compatibility.

-Adrian

On 2/29/2012 4:17 AM, Anne wrote:
The schema at framework/base/dtd/ofbiz-properties.xsd is intended for
the labels xml files. Currently those files do not to refer to a
schema. So I tried to change that.

However the ofbiz-properties.xsd itself wouldn't validate, so I fixed
that, and then added it as the schema to a sample labels.xml file for
testing.

Now I have a different problem relating to the xml:lang attribute. I
need a solution or there is no point me submitting a patch.

The existing code in UtilProperties compares the string generated by
Locale's toString() with the value of the xml:lang attribute. An
example string generated by Locale's toString() is "pt_BR". Therefore
that is the format of the string currently used with xml:lang in the
labels.xml files.

The xml:lang attribute definition (according to both the xml standard
and the relevant xsd) states the value must be of the form "pt-BR".
That is, a - and not a _. This is incompatible with current usage in
OFBiz.

If I apply a schema to an existing labels.xml file, the xml will not
validate. If I fix the xml so it validates, it of course won't work in
OFBiz unless I also change UtilProperties.

One solution would be to change UtilProperties: stop using Locale's
toString(), and instead create a string with a '-' using Locale's
getCountry() and getLanguage() methods (is the Locale variant used
anywhere?). Then all the labels.xml files would need to have their
value of xml:lang updated to use '-' instead of '_'.

What is the community's preferred solution?

Cheers,
Anne.



Reply via email to