Skip to content

Message files

Pu Chen edited this page Oct 16, 2017 · 2 revisions

Let's define some messages first.

Labels.xml

This file is the "root" message file that contains the reference to all of the other files to import. Labels.xml is the default name. If you want to use other name instead of labels.xml, please refer to Configure Grammaticus section of Getting started.

Message XML is backed by labels.dtd.

<!--=================== Root element =====================================-->
<!ELEMENT iniFile ((section)*, (import)*)>

The root element is iniFile. Followed by the import markup to import individual message files.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE iniFile SYSTEM "labels.dtd">
<iniFile>
   <import file="alt.xml" />
   <import file="global.xml" />
</iniFile>

Message files

The imported message files should contain the real message definitions. The DTD is as below.

<!--=================== Standard section/param element ===================-->
<!ELEMENT section (param|image)*>
<!ATTLIST section
  name          NMTOKEN     #REQUIRED
  public        %BOOLEAN;   "false"
  all_languages %BOOLEAN;   #IMPLIED
  dnt           %BOOLEAN;   #IMPLIED
  >

<!ELEMENT param (#PCDATA | entity | Entity | modifier)*>
<!ATTLIST param
  name          NMTOKEN     #REQUIRED
  %alias;                   #IMPLIED
  %entityRef;               #IMPLIED
  %case;                    #IMPLIED
  all_languages %BOOLEAN;   #IMPLIED
  dnt           %BOOLEAN;   #IMPLIED
  >
Markup Description
section a group name for set of messages.
parameter message name

The message will be retrieved by section.parameter by Grammaticus. Following is an example for message file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE motif SYSTEM "labels.dtd">
<iniFile>
   <section name="Icons">
      <param name="colorPicker">Choose a Color</param>
      <param name="englishOnly">English only</param>
   </section>
</iniFile>

Clone this wiki locally