wiki:HowToTranslate

Authors: François Prunayre, Heikki Doeleman, Jose Garcia, Jeroen Ticheler

Date previous change: 10-07-2012

Latest changes: 07-11-2013

How to translate GeoNetwork

This page describes steps necessary to include support of language other than pre-installed into existing instance of GeoNetwork and it's configuration components.

Translation of the user interface

Follow next steps to create new language.

  • Create new record in Languages table in GeoNetwork's database with new language's two-letter code.
  • In tables which name ends with Des copy all entries marked en (or any other existing language) to entries with new language code. After that it's possible to edit these fields using Web-interface.
  • In the table cswservercapabilitiesinfo add these records for the new language code:
    INSERT INTO cswservercapabilitiesinfo VALUES ('41','ro','title','');
    INSERT INTO cswservercapabilitiesinfo VALUES ('42','ro','abstract','');
    INSERT INTO cswservercapabilitiesinfo VALUES ('43','ro','fees','');
    INSERT INTO cswservercapabilitiesinfo VALUES ('44','ro','accessConstraints','');
    

Change ro value with your language code. Also the identifiers should be updated according to table contents.

  • Copy folders (all paths listed from GeoNetwork's root folder) to folders with new language code. (Any existing language could be treated as base for translation, not only English.) Then change copied values with translated strings, of course.
    • User interface
      • web/geonetwork/loc/en,
    • Metadata standards
      • web/geonetwork/xml/schemas/csw-record/loc/en,
      • web/geonetwork/xml/schemas/dublin-core/loc/en,
      • web/geonetwork/xml/schemas/fgdc-std/loc/en,
      • web/geonetwork/xml/schemas/iso19115/loc/en,
      • web/geonetwork/xml/schemas/iso19139/loc/en.
    • Profile specific folders of sandboxes like Bluenet, GéoSource or geocat.ch.
  • In all files web/geonetwork/loc/<language code>/strings.xml add tags with new language's code and it's name. These string used by GeoNetwork to list languages in interface switcher and indicate current a current one. For example, while adding Russian language identified by ru, it's necessary to include into those files <ru>Русский</ru> line. Here ru is the code for Russian and Русский is the Russian name on Russian.
  • Add new language's link in interface switcher banner at the main page.
    • Before 2.5.x Open web/geonetwork/xsl/banner.xsl for editing and find code:
      <xsl:choose>
        <xsl:when test="/root/gui/language='en'">
          <font class="banner-active"><xsl:value-of select="/root/gui/strings/en"/></font>
        </xsl:when>
        <xsl:otherwise>
          <a class="banner" href="{/root/gui/service}/en/main.home"><xsl:value-of select="/root/gui/strings/en"/></a>
        </xsl:otherwise>
      </xsl:choose>
      
      Duplicate this fragment (separating new from old using '|') and change en to the code of new language.
    • After 2.5.x : add the language code to the language list in WEB-INF/config-gui.xml

ISO19139 / Multilingual metadata

In order to have the added language supported by ISO19139 multilingual metadata records, the new language need to be added to the xml/schemas/iso19139/present/metadata-iso19139-utils.xsl file, template "getLangId" with the matching between the 2 letters code and the iso3code.

Example:

                <xsl:when test="$langGui='pt'">por</xsl:when>

Translation of metadata schema labels

Main principles

A schema element could be defined using the following structure:

<element name="elementNameWithNamespace" context="">
  <label>TheLabel</label>
  <description>TheDefinition</description>
  <condition/>
  <help/>
</element>

Required:

  • name attribute
  • label

Optional:

  • context attribute (mainly/only used for ISO and ISO profil)
  • description
  • condition
  • help

TODO : Condition should probably be replaced only by schematron warning.

ISO 19139 and ISO profil mechanism

Title of element and tooltip are created using labels.xml localisation file. For ISO 19139 record, only the web/geonetwork/xml/schemas/iso19139/loc/ directory is used using the GUI language. For ISO profil help is first searched in:

  • with context (ie. context is the class where the element is defined) in web/geonetwork/xml/schemas/iso19139.abc/loc/
  • with no context in web/geonetwork/xml/schemas/iso19139.abc/loc/
  • if not found search the iso19139 main help with context and if not without in web/geonetwork/xml/schemas/iso19139/loc/
Context mechanism

In the ISO, an element could be used in different places (eg. gmd:language is used in gmd:MD_Metadata and gmd:MD_DataIdentification). To make the label of this element depending on its context (ie. its parent), use the context attribute in the element.

    <element name="gmd:language" context="gmd:MD_Metadata" id="3.0">
        <label>Metadata language</label>
        <description>Language used for documenting metadata</description>
        <condition>conditional</condition>
    </element>
    <element name="gmd:language" context="gmd:MD_DataIdentification" id="39.0">
        <label>Language</label>
        <description>Language(s) used within the dataset</description>
        <help>language(s) used within the dataset</help>
        <_condition>Mandatory</_condition>
    </element>
    <element name="gmd:language" context="gmd:MD_FeatureCatalogueDescription" id="235.0">
        <label>Language</label>
        <description>Language(s) used within the catalogue</description>
    </element>

Propose translation for integration

You can choose one of these two ways:

  • Create a patch if your are familiar with SVN.
  • Create a ZIP archive with all needed files:
    • all loc directories with translated strings,
    • localized database content (provide SQL files).

Once done, send the translation to the devel mailing list and/or create a ticket on trac with files attached.

Translate the installer

The only file to localize is

  • packsLang.xml_deu

Check the new language is aligned with others

synch_lang

Last modified 11 years ago Last modified on 11/07/13 09:27:11
Note: See TracWiki for help on using the wiki.