Reputation: 104
So,
I am using a CMS platform to manage content, OpenCMS specifically but the question is generic.
Said platform uses XSD files to define its template elements and i18/message files to internationalize them.
I have achieved basic internationalization but I am stumped by my current problem.
In the following file
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:element name="PaginationDefaults" type="OpenCmsPaginationDefaults"/>
<xsd:complexType name="OpenCmsPaginationDefaults">
<xsd:sequence>
<xsd:element name="PaginationDefault" type="OpenCmsPaginationDefault" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="OpenCmsPaginationDefault">
<xsd:sequence>
<xsd:element name="ShowPagination" type="OpenCmsBoolean" />
<xsd:element name="MaxItems" type="OpenCmsString" minOccurs="0" />
<xsd:element name="ItemsPerPage" type="OpenCmsString" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale" use="optional"/>
</xsd:complexType>
<xsd:annotation>
<xsd:appinfo>
<defaults/>
<layouts/>
<validationrules>
<rule element="MaxItems" regex="\d+" message="${key.error.parse.number}" />
<rule element="ItemsPerPage" regex="\d+" message="${key.error.parse.number}" />
</validationrules>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
I can define the value of any of the named properties with no issues from any template that incorporates a PaginationDefault.
This is as basic as typing
label.PaginationDefault.property
On the key field and giving it my desired message on the value field
I am stumpted however on accessing the value of key.error.parse.number. and any time there's an error I get ????key.error.parse.number????? on the screen which just doesn't look enticing for newer clients and underwhelms them.
I have full access to the XSD. I know I can hardcode a message on the error field but there should be a way of accessing it from the message files that is currently beyond me.
Please help me if you can.
Update looking into it there are some files where it works. Said files have the structure
<rule element="ItemsPerPage" regex="\d+" message="${key.error.name}" />
If that is the case I can just put error.name as a key and assign it a value.
The issue comes with a nested XSD where no combination of error nameofnestedxsd and name of error works(tried just about every order of those words).
Upvotes: 1
Views: 125