The plugin supports more than just EN (as default) and DE. But the Toolbox is limited to these locales.

Audience
Level of Experience

It is possible to add additional localization files to the plugin to make it support more locales than just EN and DE. But the projectdoc Toolbox currently only supports these two locales. This short tutorial shows nonetheless how the plugin supports the use of additional locales.

Use Localization in Descriptor Files

The plugin checks the supported locales on the first declared category in the Add-on Descriptor. The list of supported locales for this category is the list of expected locales for each space and doctype.

First Category defines supported Locales
<add-on
  xmlns="http://smartics.de/xsd/projectdoc/add-on/1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <categories>
    <category id="default">
      <resource-bundle>
        <l10n>
          <name plural="My Main Categories">My Main Category</name>
        </l10n>
        <l10n locale="de">
          <name plural="Meine Hauptkategorien">Meine Hauptkategorie</name>
        </l10n>
      </resource-bundle>
    </category>
    <category ...>
       ...
    </category>
    ...
  </categories>
</add-on>

For spaces and doctypes locales are specified as attributes on the l10n elements within the resource-bundle element.

Sample Resource Bundle Element
 <resource-bundle>
    <l10n>
      <name>Sample Doctype</name>
      <description>
        For the page blueprint overview: A sample doctype's description.
      </description>
      <about>
        For the page wizard: Tell users what this doctype is for.
      </about>
    </l10n>
    <l10n locale="de">
      <name plural="Beispiel-Dokumenttypen">Beispiel-Dokumenttyp</name>
      <description>
        Für die Page-Blueprint-Übersicht: Die Beschreibung für den Beispiel-Dokumenttyp.
      </description>
      <about>
        Für den Page-Wizard: Erläutern Sie, welchen Zweck dieser Dokumenttyp
        erfüllt.
      </about>
      <type plural="Beispiel-Dokumenttyp-Typen">Beispiel-Dokumenttyp-Typ</type>
    </l10n>
  </resource-bundle>

Localization with Template Fragments

The localization files are provided separately for each space or doctype base template. If a locale is not supported, the resource for the default locale is returned.

Spaces

The localized resources for doctypes are stored per locale in the project folder at

src/main/resources/spaces/[id of space descriptor]/l10n_[locale].properties
Properties File for the default Locale
# Space Wizard for ${space.name} ##############################################

${package}.blueprints.space.blueprint.name=${space.name}
${package}.blueprints.blueprint.description=${space.description}

${package}.blueprints.blueprint.dialog.choose.title=Create a ${space.name}
${package}.blueprints.blueprint.dialog.choose.heading=${space.name}
${package}.blueprints.blueprint.dialog.choose.description=${space.about}

${package}.blueprints.space.blueprint.def.name=${space.name} Definition
 

Currently only one space per generated add-on project is supported.

Doctypes

The localized resources for doctypes are stored per locale in the project folder at

src/main/resources/doctypes/[id of the base template]/fragments/l10n_[locale].properties
Properties File for the default Locale
## ${doctypeNameLabel} ............................................................

### Documentation URLs
projectdoc.url.${doctypeId}=${doctypeNameLabel.urlPart}
projectdoc.url.${doctypeId}.label=${doctypeNameLabel}
projectdoc.url.${doctypeId}.title=Documentation on the ${doctypeNameLabel} doctype

### Home and Index Pages
projectdoc.doctype.${doctypeId}.home=${doctypeNameLabel.plural}
projectdoc.content.${doctypeId}.home.title=${doctypeNameLabel.plural}
projectdoc.content.${doctypeId}.home.description=Homepage of ${doctypeNameLabel.plural.lower}
projectdoc.content.${doctypeId}.home.roots-only.title=${doctypeNameLabel.plural}
projectdoc.content.${doctypeId}.home.roots-only.desc=List of central ${doctypeNameLabel.plural.lower}.
projectdoc.content.${doctypeId}.index.all.title=All ${doctypeNameLabel.plural}
projectdoc.content.${doctypeId}.index.all.desc=List of all ${doctypeNameLabel.plural.lower}.

### Template
projectdoc.${doctypeId}.template.title=${doctypeNameLabel}

projectdoc.doctype.${doctypeId}.children=Subordinate ${doctypeNameLabel.plural}
### Blueprint
${package}.blueprint.${doctypeId}.title=${doctypeNameLabel}
${package}.blueprint.${doctypeId}.create-link.title=${doctypeNameLabel}
${package}.blueprint.${doctypeId}.create.label=Create ${doctypeNameLabel}

${package}.blueprint.wizard.${doctypeId}.page1.title=Create a ${doctypeNameLabel}
${package}.blueprint.wizard.${doctypeId}.page1.desc.header=About ${doctypeNameLabel.plural}

Resources

Localization
Using projectdoc with a non-supported locale (language) works, but lacks some of its features. This short topic provides some details on this matter.