(Spanish) Language troubles

From gvSIG CE Wiki

Jump to: navigation, search

The code base is currently sparsely commented. Often, comments are in Spanish or broken English. There are also hard-coded Spanish messages and GUI strings littered all over the code.

If you are not running gvSIG on a Spanish system and you come across language problems, please try report it or fix directly as detailed below. They are among the most important issues that we need to take care of to keep gvSIG CE a sustainable software project.

Below, you can learn about how translations work in gvSIG CE and how to help out improving the non-Spanish versions of the software as either a developer or user-level contributor.

Translation files

Internally, gvSIG does not produce literal messages and GUI labels (but see notes for developers below). Instead , it uses string identifier names (in effect place holders) which are then resolved in a text_*.properties translation file on program start-up. All extensions come with such files, but the most important ones are the master translation files in com.iver.cit.gvsig, as they take priority over all other translation files.

The gvSIG CE project manages its own master translation files in "overlays/com.iver.cit.gvsig". Add your the file(s) for your own language(s) there if they are missing. These files have to be copied into the "com.iver.cit.gvsig" subfolder of an existing gvSIG binary distribution in order to take precedence over any other translation files.

There is one translation file for each language that gvSIG supports. If your language is not among them, you can easily create a new translation by copying an existing file and editing it. If you choose to do so, copy com.iver.cit.gvsig/text_en.properties to com.iver.cit.gvsig/text_AA.properties (with "AA" representing your country's language code) and edit the copy.

Each translation file contains one translation per line. On the left, you see the original string identifier while on the right you get the actual text as it is displayed by gvSIG. As an example, you can see the first few lines from the German master translations file below.

 #Translations for language [de]
 #Mon Sep 21 10:01:57 CEST 2009
 (escala_maxima)=(gr\u00f6\u00dfter Ma\u00dfstab)
 (escala_minima)=(kleinster Ma\u00dfstab)
 10_paginas_delante=10 Seiten vor
 _(Simbolo_unico)=(Einmaliges Symbol)
 __proyeccion_actual=Aktuelle Projektion\:
 __redimensionar_texto_escala=Textgr\u00f6\u00dfe an den Ansichtsma\u00dfstab anpassen
 __seleccion_de_fuente=Auswahl der Schriftart

A few notes about the format of these files:

  • There is one translation per line. If you need to wrap lines, use the line break sequence (\n).
  • Beware: Some gvSIG strings actually use HTML mark-up. In those cases, a line break is achieved with the HTML line break marker (
  • The identifier token is on the left, followed by an equal (=) sign and the translation on the right.
  • They are UTF-8 files. To encode your language's special characters with a simple ASCII editor, use UTF-8 backslash sequences (e.g. in the example above, the German umlaut "o" is encoded as \u00f6).
  • Lines starting with a hash mark (#) are comment lines and will be ignored.
  • Colons (:) are written with a preceding backslash: \:.

For historical reasons, gvSIG CE uses Spanish as a reference language. This is the default language for all strings and stored in the translation base file text.properties (therefore, there is no 'text_es.properties'). However, in gvSIG CE, we use English as our "gold standard". The English translations have priority and act as references for all other languages.

Instead of a text editor, you can also use a dedicated application to edit the translation files. In fact, Eclipse already comes with a built-in editor that does a decent job with .properties files.

For more flexibility, install this Eclipse plugin. Simply download the ZIP file and unpack its contents into your Eclipse plugin directory, then restart Eclipse. Right-click on a .properties and choose "Open With -> ResourceBundle Editor". You can now edit all translations at the same time. Choose "Windows -> Preferences" from Eclipse's main menu and swith to the "ResourceBundle Editor" page to configure the editor.

Hints for users

If you are a registered user on our bug tracker, then you can report Spanish messages that pop up on your non-Spanish system using the dedicated bug category.

Otherwise, send an email to the developers list in case you need help.

Hints for developers

As a developer, please commit some time to improving translations and source code comments during your work.

In order to make a Java string translatable, it has to be set via the gvSIG API function PluginServices.getText(). This function does not take the literal string. If you come across a message string that does not at some point get passed to PluginServices.getText(), then chances are it needs to be fixed. In that case, you need to add a PluginServices.getText() and add the new string to the text_*.properties files. When you choose a new identifier, make sure to choose a unique one, e.g. one that reflects the name of the extension and function, such as CAD_Editing_Add_Vertex. There are huge problems with existing identifiers with overlapping names that clash, because they have slightly different translations in different contexts. We don't want to add to these. Also, do not use a period (.) in your identifier name, as that character is used as a grouping symbol in the translation files!