NLS Enabled XML
Original Publication Date: 2003-Sep-24
Included in the Prior Art Database: 2003-Sep-24
A better way to handle NLS with XML.
NLS Enabled XML
XML has become a very popular format to store and retrieve data for another application to use. Examples of how XML is used in a Java application can include the definitions of a portfolio or user settings. Often times, the text that is stored in an XML file must correlate to text in either another XML file or a Final Static Constant in a Java class. One of the reasons that programmers use Java properties files to store text data instead of storing it in XML is NLS. XML does not currently provide a way to automatically include translated text.
There are many ways in which programmer work around XML's lack of NLS capability. One way is to create an XML file for each language. For example, the XML file, which contains an application's portfolio links, would be translated to a different file for each language. This solution has several problems. One problem is that an XML file may only have a small portion that needs to be translated but we need to duplicate the rest of the tags into several files for the purpose of NLS. Another problem is the fact that the Java application would need to handle sorting the different XML files based on the current locale. This is almost rewriting the idea of properties files. And yet another problem is that you have many versions of essentially the same file that you need to maintain.
Another current solution is to use XML Entities. These are "XML constants", which can be defined in the DTD and then used in the XML that is based off the DTD. You could create a DTD for each language with translated entity constants. This approach would have many problems as well. It would require you to maintain a separate DTD for each language. The DTD contains much more information than constants; it provides the instructions on how to build the XML file. Another major problem is that you could only use these constants with one XML language based on one DTD.
Another solution to the "XML NLS problem" requires a java resource bundle name and its corresponding tag in its portfolio.xml file. T...