Normally you have a single DTD (Document Type Definition) to localize a specific XUL file. But there are situations where you want to use multiple DTDs, for example to localize common widgets used in all your XUL files, additionally to the ones specific to the file.
Single DTD
To make strings in your XUL file localizable, you normally add a DTD declaration at the beginning of the file like this:
<!DOCTYPE window SYSTEM "chrome://myextension/locale/mainwindow.dtd">
where "window
" is the local name of the document (root) element.
Assuming you have an entity called <tt>someButton.label</tt> defined in <tt>mainwindow.dtd</tt>, you can access the entity like this:
<button id="somebutton" label="&someButton.label">
Multiple DTDs
If you want to use multiple DTDs with your XUL file, you can simply list all of the DTDs inside your DTD declaration:
<!DOCTYPE window [ <!ENTITY % commonDTD SYSTEM "chrome://myextensions/locale/common.dtd"> %commonDTD; <!ENTITY % mainwindowDTD SYSTEM "chrome://myextension/locale/mainwindow.dtd"> %mainwindowDTD; ]>
You can now access the entities declared in the DTDs as shown above. Assume you have an entity <tt>okButton.label</tt> defined in file <tt>common.dtd</tt>. Then accessing entities from both DTDs would look like this:
<button id="somebutton" label="&someButton.label"> ... <button id="okbutton" label="&okButton.label">
Note that there is no such thing as namespaces with multiple DTDs. You have to make sure by yourself that the entities defined in the various DTDs do not clash.