WebTool Translations
From EnGardeWiki
Contents |
Introduction
Guardian Digital WebTool has support for languages other than English and we're always looking for people to maintain new translations. The purpose of this document is to provide you, the maintainer, with all of the information you need to begin and maintain your translation.
Setting Up Your Environment
What you'll need:
- A machine to do your translations on, with the latest version of EnGarde Secure Linux installed.
- A good understanding of the language you are translating WebTool to. It's best if you are native in this language, although not required.
Once you have all of the above you may log in as root, transition over to sysadm_r, and disable SELinux:
[root@engarde ~]# newrole -r sysadm_r Authenticating root. Password: [root@engarde ~]# setenforce 0
Next you must save a copy of the /usr/webtool directory that you can diff against later:
[root@engarde ~]# cp -a /usr/webtool/ /usr/`rpm -q webtool` [root@engarde ~]# ls -lad /usr/webtool* drwxr-xr-x 5 root root 4096 Jun 25 11:52 /usr/webtool drwxr-xr-x 5 root root 4096 Jun 25 11:52 /usr/webtool-3.14-5
When you're done translating WebTool you'll send us, Guardian Digital, a unified "diff" containing all of your changes.
Adding the Language
Next, before you can begin translating, you must configure WebTool for the new language you'll be adding. To do this you need to open the webtool.pm file and locate the enumerate_languages() subroutine, around line 156:
[root@engarde ~]# vi /usr/webtool/modules/webtool/webtool.pm
...
################################################################################
sub enumerate_languages($) {
my @self = shift;
my @rv = (
'en', 'English',
'es', 'Espaol',
'it', 'Italian',
);
return @rv;
}
Add a new set of elements to @rv with the new language you'll be adding. For example, if you were adding French (fr), @rv would look like this:
my @rv = (
'en', 'English',
'es', 'Espaol',
'fr', 'Franais',
'it', 'Italian',
);
At this point you may begin the translation process!
Doing the Translation
Each WebTool module has a lang/ subdirectory which contains all of the translations for that module.These translation files are plain-text, "key = value" type files:
[root@engarde ~]# head -20 /usr/webtool/modules/selinux/lang/en | tail -14 ################################################################################ # General # selinux_disabled = SELinux Disabled enabled = Enabled disabled = Disabled enforcing = Enforcing permissive = Permissive active = Active inactive = Inactive close_window = Close Window boolean = Boolean default = Default
Values may span lines if they are indented:
intro = Below you can edit the certificate and the interface your Secure IMAP
and Secure POP daemons use. The certificate is used for SSL (it provides
identity verification). The Interface is the IP address that the server
should listen on. Keep this field blank to have it listen on all interfaces.
Or you can just let them be one big, long line. These values may contain HTML but don't go overboard -- things such as links are frowned upon, but elements such as Bold are okay.
You first task is going to be to create all of the language files. If you are translating WebTool to French you can use the following command:
[root@engarde ~]# cd /usr/webtool/modules/ [root@engarde modules]# for i in */lang; do cp -av $i/en $i/fr; done `aide/lang/en' -> `aide/lang/fr' `apache/lang/en' -> `apache/lang/fr' ... `users/lang/en' -> `users/lang/fr' `webtool/lang/en' -> `webtool/lang/fr'
Now each module has a 'fr' file totally in English. Open up each file and translate the values, keeping the keys totally intact (don't change anything before the =!).
A few notes:
- If a given key is not translated into the running language, WebTool automatically falls back to English. This is a good way to ensure that you've translated everything -- any English you see on the page is most probably something you missed!
- Please spell check your translations before sending them to us. If you don't have a spell checker, open a bug and/or ask on the forums for some spell checkers and somebody from Guardian Digital will package one for you.
- The process of doing the translation is tedious. An improved interface is in the works... this document will be updated when it's finally integrated into WebTool.
That's about it. Using the process above you need to go thorough each module and translate it.
Submitting a Patch
When you're all done with your translation you need to send your changes to Guardian Digital. The first step is to review your changes using diff(1):
[root@engarde ~]# diff -Naur /usr/`rpm -q webtool`/ /usr/webtool/
You may want to use diffstat(1) to get a nice graphical display of your changes:
[root@engarde ~]# diff -Naur /usr/`rpm -q webtool`/ /usr/webtool/ | diffstat
When you're all done, redirect the output of diff into a file and post that file to the EnGarde Secure Linux Forum:
[root@engarde ~]# diff -Naur /usr/`rpm -q webtool`/ /usr/webtool/ > /some/patch.diff
Somebody from Guardian Digital will see your patch and either apply it to our internal CVS tree, or contact you for more information.
Staying Up To Date
When you become a maintainer you'll be subscribed to a private list run by Guardian Digital. Whenever a string changes or is added, a request will be sent to this list and you can reply back with either a patch or the translation.
Categories: Documentation | EnGarde | HOWTO | WebTool
