1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Localization

From jedit

Revision as of 08:22, 26 March 2012 by Jojaba 67 (Talk | contribs)
Jump to: navigation, search

Contents

Introduction

jEdit now supports localization. We would he happy to have versions in every languages, but for that we need some volunteers (don't worry it is easy and fun). The informations below are related to jEdit version 5 and later releases.

How to translate jEdit Gui

If you want to translate jEdit, you need first to get jedit_en.props. You can get it when you checkout the sources of jEdit (SVN, GIT, or CVS) or get all content of the last version on that page: jedit_en.props on SCM Repositories. Once you have it, rename it to jedit_[lang].props where [lang] is the language ISO 639-1 code you want to translate in. This code can be found in the List of ISO 639-1 codes page on wikipedia or on the Registration Authority for ISO 639 codes. Below a few examples you can find in these two pages:

Language name Native name ISO 639-1 code
Chinese 中文 (Zhōngwén), 汉语, 漢語 zh
Italian Italiano it
Spanish español es
Hindi हिन्दी, हिंदी hi
Russian русский язык ru

Let's take an example to make it clearer. If you want to translate jEdit Interface into Italian, you have to rename the jedit_en.props into jedit_it.props.

Once you have done this, you can begin with the translation of the available localized strings.

Edition

While editing the jedit_[lang].props file, you have to ensure that the UTF-8 encoding of that file has been detecting by the editor. If you use jEdit (we hope you do ;p), just look on the bottom right of your window if UTF-8 is displayed. If not (for example, if you have the encoding iso-8859-1 displaying), double-click on it and change this encoding in the buffer options dialog.

The *.props file is a propertie file and contains 2 types of lines:

  • The comments lines (beginning with # that haven't to be translated).
  • The properties lines (containing a = symbol seperating the propertie key and his value).

All you have to do is to translate the string following the = symbol. For example, here is a snippet of the jedit_en.props file:

#{{{ Common strings
common.ok=OK
common.cancel=Cancel
common.close=Close
common.error=Error
common.apply=Apply
common.more=More
common.insert=Insert
common.add=Add
common.remove=Remove
common.moveUp=Move Up
common.moveDown=Move Down
common.clearAll=Clear All
common.selectAll=Select All
common.selectNone=Select None

lineSep.unix=Unix (\\n)
lineSep.windows=DOS/Windows (\\r\\n)
lineSep.mac=MacOS (\\r)
#}}}

The french translation of these lines is:

#{{{ Common strings
common.ok=OK
common.cancel=Annuler
common.close=Fermer
common.error=Erreur
common.apply=Appliquer
common.more=Plus
common.insert=Insérer
common.add=Ajouter
common.remove=Supprimer
common.moveUp=Monter
common.moveDown=Descendre
common.clearAll=Tout effacer
common.selectAll=Tout sélectionner
common.selectNone=Ne rien sélectionner

lineSep.unix=Unix (\\n)
lineSep.windows=DOS/Windows (\\r\\n)
lineSep.mac=MacOS (\\r)
#}}}

As you can see, the lines beginning with # has not been translated (this will ease the comparison of original and translated files), the only parts that have been translated are the strings after the = symbol, the values of the properties keys.

More details about these lines:

  • The {{{ and }}} marks allows you to call the folding feature. That means that if you use jEdit, you can fold the part enclosed in this two marks.
  • The properties keys are usually syntaxed as follows: section.stringSummary (section is the menu, dialog or part of the application where you can find the string identified by the stringSummary.

Some special syntax that you can encounter and that you have to handle as follows:

  • Sometimes, you will see \ or \n\ symbols at the end of a line. It stays for a next line wrapping. For example:
about.text.suffix=I'd also like to thank the users for their\n\
comments, feedback and bug reports.
  • You will also find $ chars in some strings. These symbols are accelerators (shortcuts) for menu labels. You can place them where you want in the word or remove them. Example:
view-markers.label=Vie$w Markers

could be translated in French in:

view-markers.label=A$fficher les marqueurs

The accelerator for the english version would be w and f for french translation.

  • In some labels you have some placeholders {0}, {1}, those will be replaced by some text by jEdit, so don't remove them.

Tips

  • You can comment some labels you don't want to translate (by adding a # in front of the line), partial localization is authorized.
  • Don't reorder labels to make integration and comparison easier
  • To test the localization file you can follow the next chapter about installation. If you are not a java developper, don't worry, you don't need to be, you just have to edit some text files and put them back in the jedit.jar.

Installing and testing the new translation

Now that you have translated the jedit_[lang].props file, you are ready to test it by including it into your jEdit installation. The following instructions are destinated to Windows users but can be very similar for other OS (Linux or Mac-OS).

  • Find the jedit.jar archive in the folder where you installed jEdit. Default path to this folder is (in Windows 7): C:\Program Files\jEdit.
  • Copy the jedit.jar archive and paste it in a working folder (called for example jedit-translation).
  • Extract all the content of the archive. The *.jar archives are in fact zip files, so you can use your favorite extraction software for this task. If you don't have such software, we recommend you to use 7-Zip. It's an Open source application that works pretty well. If you use 7-Zip, just right-click on the jedit.jar file and click on the "7-Zip" » "Extract Here" entry. All the content of the archive will be extracted into the jedit-translation folder. You will see two folders :
    • The org folder,
    • and the META-INF folder.
  • It's time to add your jedit_[lang].props file into the \jedit-translation\org\jedit\localization\ (this folder contains the available languages).
  • After that, you have to edit the jedit-translation\org\gjt\sp\jedit\jedit.props, find the available.lang=en fr de line (at the end of the file) and add to it your language code. For example, if your language is italian, the line will change to this: available.lang=en fr de it.
  • Next step: edit the jedit-translation\org\gjt\sp\jedit\jedit_gui.props file to add your language key in the Appearance pane section. Here's a copy of this section:
#{{{ Appearance pane
options.appearance.code=new AppearanceOptionPane();
# It is encouraged to set the following labels in their own language
# here (not in localized .props) to catch eyes of non-English users more
# friendly.
options.appearance.lang.en=English
options.appearance.lang.fr=Français
options.appearance.lang.de=Deutsch
#Japanese
options.appearance.lang.ja=日本語
#}}}

So if you want to add for example the italian translation, you have to add the following line: options.appearance.lang.it=Italiano. The section will then looks like this:

#{{{ Appearance pane
options.appearance.code=new AppearanceOptionPane();
# It is encouraged to set the following labels in their own language
# here (not in localized .props) to catch eyes of non-English users more
# friendly.
options.appearance.lang.en=English
options.appearance.lang.fr=Français
options.appearance.lang.de=Deutsch
#Japanese
options.appearance.lang.ja=日本語
options.appearance.lang.it=Italiano
#}}}

As specified in the section comment, please provide the language name in your own language, not in english.

  • All editing and pasting work has been done, you can rearchive the org folder. With 7-Zip, right-click on the \org\ folder then click on "7-Zip" » "Add to Archive…" and find the jedit.jar file by clicking on the […] button, open it then finally click on the [OK] button.
  • Last step, copy and paste the new jedit.jar file to the installation folder : C:\Program Files\jEdit (on Windows 7) start jEdit to see and test your work ;).

Localizing jEdit plugins

Localizing jEdit plugins is almost the same process than localizing jEdit Gui. You have to find the *.props at the root of the plugin *.jar file, edit it, rename it and then put it at the same level of the original *.props. Let's see step by step how to do that. We will take an example plugin to show you how to create the french translation file: Smart Open.

Extract the *.props from the *.jar

When you install (manually or using the Plugin Central), the [plugin_name].jar file can be found either in the /root_install/jedit/jars/ folder, or in the /user_folder/.jedit/jars/ folder depending on the way you setting up Plugins installation. Once you have found the [plugin_name].jar file, copy and paste it into a working folder. You can then open the *.jar archive and extract the [plugin_name].props file. So for our plugin example, you have to extract SmartOpen.props from the SmartOpen.jar file. If you use 7-Zip, you just have to right-click on the *.jar, click on the "7-Zip" » "Open Archive" menu entry, click on the SmartOpen.props file then finally click on the "Extract" toolbar button [-].

Rename the *.props

The first thing you can easily do, is renaming the *.props file in lang_[lang iso_code].props, where [lang iso_code] is the code you can find in the tables at the beginning of that page. So SmartOpen.props will become lang_fr.props.

Edit the language file

That's, of course, the main work of the localization. Please make sure first of all to edit this file using UTF-8 encoding. Two steps to follow:

  1. Removing the lines that haven't to be translated
  2. Translate the properties key values

1. Removing the unnecessary lines

Here the original SmartOpen.props file of the example plugin:

# SmartOpen jEdit Plugin
# Author: Matthieu Casanova

plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.activate=startup
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.name=SmartOpen
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.author=Matthieu Casanova
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.version=1.0.0
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.depend.0=jdk 1.6
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.depend.1=jedit 04.04.01.00
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.depend.2=plugin CommonControlsPlugin 1.4
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.depend.3=plugin projectviewer.ProjectPlugin 3.2
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.depend.4=plugin gatchan.jedit.lucene.LucenePlugin 2.8
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.description=SmartOpen will help you open your files quickly
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.usePluginHome=true
plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.docs=docs/SmartOpen.html



plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.option-pane=smartopen
options.smartopen.label=SmartOpen
options.smartopen.code=new com.kpouer.jedit.smartopen.SmartOpenOptionPane();

plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.menu=smart-open \
  							smart-open-dialog \
							- \
					    		smart-open-reindex

smart-open-reindex.label=re-index
smart-open.label=Smart Open
smart-open-dialog.label=Smart Open Dialog

options.smartopen.ExcludeDirectories=CVS .svn .git
options.smartopen.IncludeGlobs=*
options.smartopen.IncludeGlobs.label=Include only files matching:
options.smartopen.ExcludeGlobs=*.*~ *.bak *.bmp *.ico *.gif *.gif *.png *.jpg *.class *.exe  *.obj *.jar *.zip *.7z *.rar *.tar *.gz *.tgz *.wav *.mp3 *.ogg
options.smartopen.ExcludeGlobs.label=... except files matching:


options.smartopen.paths.label=Choose paths to monitor:

options.smartopen.projectindex=true
options.smartopen.projectindex.label=Index current project
options.smartopen.toolbar=false
options.smartopen.toolbar.label=Show smartopen in a toolbar
options.smartopen.memoryindex=true
options.smartopen.memoryindex.label=Use in-memory index. (very low memory footprint)

search-file.label=Search for a file :

We first remove all the lines not required for the translation: the activation status, the menu, the boolean values,... Then you can add your translator identification (for example your name or you Nickname). Here's the content of the fresh file:

# SmartOpen EN translation file
# Encoding: UTF-8
# Translator: Matthieu Casanova

plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.description=SmartOpen will help you open your files quickly

options.smartopen.label=SmartOpen

smart-open-reindex.label=re-index
smart-open.label=Smart Open
smart-open-dialog.label=Smart Open Dialog

options.smartopen.IncludeGlobs.label=Include only files matching:
options.smartopen.ExcludeGlobs.label=... except files matching:

options.smartopen.paths.label=Choose paths to monitor:

options.smartopen.projectindex.label=Index current project
options.smartopen.toolbar.label=Show smartopen in a toolbar
options.smartopen.memoryindex.label=Use in-memory index. (very low memory footprint)

search-file.label=Search for a file :

As you can see only the description of the plugin has been kept form the first lines. We recommend not to translate the plugin name.

2. Translating the remaining lines

# SmartOpen jEdit Plugin
# Author: Matthieu Casanova
# Translator : Translator warrior

plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.description=SmartOpen will help you open your files quickly

options.smartopen.label=SmartOpen

smart-open-reindex.label=re-index
smart-open.label=Smart Open
smart-open-dialog.label=Smart Open Dialog

options.smartopen.IncludeGlobs.label=Include only files matching:
options.smartopen.ExcludeGlobs.label=... except files matching:

options.smartopen.paths.label=Choose paths to monitor:

options.smartopen.projectindex.label=Index current project
options.smartopen.toolbar.label=Show smartopen in a toolbar
options.smartopen.memoryindex.label=Use in-memory index. (very low memory footprint)

search-file.label=Search for a file :

Can be translated as follows:

# SmartOpen fr translation
# Encoding: UTF-8
# Translator : Jojaba [htpp://jojaba.free.fr]

plugin.com.kpouer.jedit.smartopen.SmartOpenPlugin.description=SmartOpen vous permettra de retrouver vos fichiers rapidement.

options.smartopen.label=SmartOpen

smart-open-reindex.label=Réindexer
smart-open.label=Smart Open
smart-open-dialog.label=Boîte de dialogue Smart Open

options.smartopen.IncludeGlobs.label=N'inclure que les fichiers correspondant à :
options.smartopen.ExcludeGlobs.label=...à l'exception des fichiers correspondant à :

options.smartopen.paths.label=Choisir les chemins à explorer :

options.smartopen.projectindex.label=Indexer le projet courant
options.smartopen.toolbar.label=Afficher Smart Open dans une barre d'outils
options.smartopen.memoryindex.label=Utiliser l'indexation en mémoire (utilisation mémoire très faible)

search-file.label=Rechercher le fichier :

See jEdit Gui translation for further informations about how to handle special syntaxes.

Adding the localised file to the jar

Now you can add this new lang_fr.props file to the *.jar archive. If you use 7-Zip, right-click on the *.props file and click on the "7-Zip" » "Add to Archive…", click on the [...] button, find the *.jar file, click on it, open it and finally, click on the [OK] button. Now your lang_fr.props is included in the SmartOpen.jar archive.

Personal tools