How to localize Scilab
The Scilab process for localization is done through Launchpad/Rosetta. Launchpad is a service developed by Canonical mainly for Ubuntu. Scilab uses it to help translate our software.
The localization is done on this URL: https://translations.launchpad.net/scilab/. Once your Launchpad account is created, you will have to join Scilab.team to submit your proposals to Scilab translations. Scilab project is under "Restricted" permission policy to ensure translation quality.
Once a localization reached a good enough level, send an email to the mailing list firstname.lastname@example.org to ask for a synchronization.
- This website is the reference of Scilab localization. Scilab localization files in the source tree as regularly synchronized from Launchpad.
- Some strings are duplicated over some modules, it is crucial that the translation is the same. Otherwise, they are not used by the software since they are considered as fuzzy.
How to translate Scilab documentation
The Scilab documentation is based on the Docbook format. Docbook is the reference to write documentation. This source files for the Scilab documentation are stored in the source tree. For example, french localization files are available:
To translate Scilab documentation, follow the steps:
Download Scilab source tree git clone git://git.scilab.org/scilab scilab.source
Go into Scilab base source tree (cd scilab.source/scilab)
For each Scilab modules modules/*/
Copy the content of modules/yyy/help/en_US to modules/yyy/help/xx_XX(xx_XX being your language code).
- Translate the files.
If you do not want to translate a file, remove it from the modules/yyy/help/xx_XX directory (english files are be automatically used when not available).
You can use various editors to update the documentation:
Localization in English
Update of the localization files
If any change has been made on any string in the source, localization files must be updated.
To facilitate this, we developed a script to do this :
Using this script is straightforward.
export SCI=/path/to/scilab/source/tree/ sh tools/localization/updateLocalizationModule.sh <module_name>
If module_name is process_all, it will regenerate all localization files of Scilab.
Thanks to gettext tools, this script is intelligent. It will detect if a string has been changed (it will then update the line in all the .po files of a module), added (it will add it) or removed.
Localization files are stored in :
For example, the French localization files of the interpolation module is modules/interpolation/locales/fr_FR/messages.po
There are one localization files per module and per language. At the moment, we have English (en_US) and French (fr_FR).
gettext is generating java classes (called ResourceBundle) which contain the localized strings. In the root Makefile.am of Scilab, we generate this class with the command: \$(MSGFMT) \$(MSGFMT_OPTS) --statistics --locale \$\$LOCALE -r org.scilab.modules.localization.Messages --java2 -d \$(top_builddir)/modules/localization/build/classes/ \$\$POFILE; which is going to generate classes into SCI/modules/localization/build/classes/org/scilab/modules/localization/Messages*class
To manage the localization, we created the class (modules/localization/src/java/org/scilab/modules/localization/Messages.java) which is in charge of:
- loading the bundle (if a switch back to english if not available in the user language)
manage the translation of a string through the getText(String) method
To translate a string, it is straightforward:
import org.scilab.modules.localization.Messages; [...} Messages.gettext("My own string");
Most of the message of the GUI are located into XML files (like modules/gui/etc/main_menubar.xml). These files are processed by 2 pass:
with a sed script, extract messages from the label tag and create a fake C file which will be processed by the updateLocalizationModule.sh script among the rest of the files.
- extract gettext("my message") from the instructions
Synchronize Launchpad => Scilab
When a language has been translated under Launchpad/Rosetta and there is the need to synchronize Scilab source tree with the latest version of the localization files.
- Unpack the archive
- Under Linux:
- export SCI=/path/to/your/source/tree
- sh \$SCI/tools/localization/dispatchLocalizationFile.sh /path/to/the/unpack/archive/
All localization files should be dispatched into the Scilab source tree.
- English : ASCII / ISO-8859
- French : ISO-8859-15