Re: XML properties files - brainstorm

Posted by David E Jones on
URL: http://ofbiz.116.s1.nabble.com/XML-properties-files-brainstorm-tp185922p185925.html


This is interesting and might be a good starting point, but it doesn't  
look like it helps with any of the stuff I mentioned in the email I  
just barely sent.

I'd rather use something that is more i18n oriented, and less name/
value pair (generic property) oriented.

Maybe something like:

<labels>
     <label key="foo.bar">
         <message xml:lang="en_US">American Foo Bar</message>
         <message xml:lang="en_GB">The Original Foo Bar</message>
         <message xml:lang="es">El Foo Bar en EspaƱol</message>
     </label>
</labels>

In a separate file we'd have a default local, or perhaps even a  
primary and secondary default if no label is found in the primary  
locale.

-David


On Nov 26, 2007, at 2:11 PM, Adrian Crum wrote:

> I found the answer to the XML file format - java.util.Properties  
> already supports one:
>
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html
>
>
> Adrian Crum wrote:
>
>> David Jones has suggested in the past that we start moving away  
>> from using properties files for UI labels and such, and use XML  
>> files instead. That subject has come up again in https://issues.apache.org/jira/browse/OFBIZ-1425 
>> .
>> I would be interested in helping out with the implementation, but  
>> I'd like to get input from the developer community first.
>> -----
>> Here are some of the suggestions David made:
>> "If we do something like that, here or anywhere, we should use XML  
>> and not properties files. XML is about 1E6 times better than  
>> properties files (name/value pairs) for organizing this sort of  
>> information. It is hierarchical so much easier to organize and you  
>> can use real UTF-8 characters there instead of having to encode  
>> everything and use a special tool or a translator to work on the  
>> files."
>> and
>> "In XML there are standard ways of doing this, namely using the  
>> xml:lang attribute on an element to specify the language of the  
>> content in an element."
>> -----
>> I have been thinking about this for a while, and I was picturing a  
>> refactoring of the resource handling code so that it can read xml  
>> files in addition to *.properties files. The file format would be  
>> invisible from a programmer's perspective. In other words, the  
>> method call UtilProperties.getPropertyValue("SomeResource",  
>> "SomeProperty") would still work even if the "SomeResource"  
>> resource was in an XML file.
>> Or we can just have a utility to retrieve resources from an XML file.
>> Regardless of how the properties are retrieved, we still need to  
>> come up with a strategy (or schema) for the xml file format. I'm  
>> not an XML guru, so this is one area where I could use some help.
>> Do we continue to keep each language in a separate file or should  
>> we have all properties for all languages in a single file?
>> Are there any other issues anyone can think of?
>> Comments welcome.
>> -Adrian
>


smime.p7s (3K) Download Attachment