How to translate messages of UI|
BlueQuartz uses Sausalito architechture and it holds all message descriptions separtely from the executable code such as PHP. It means you can add another langage version to your BlueQuartz system.
This document shows how to translate message files to French then install and test them.
This document is based on the artcle #11012 of coba-e mailing list. The original message had been posted by Michael Stauber then ported here by Yutaka Yasuda, Cobalt Users Group.
The language support uses regular I18n methods, so the language files reside in the /usr/share/locale/<LANG>/LC_MESSAGES/ directories:
Each software package for the GUI has its own language file:
As you'll notice, the *.mo files can't be edited directly. You need the program "gettext" to "decrypt" them back into plain text.
So how to do the translation?
First of all, copy all the /usr/share/locale/en/LC_MESSAGES/*.mo files to a new directory. Like this:
mkdir /home/my-translation cp /usr/share/locale/en/LC_MESSAGES/*.mo /home/my-translation/ rm /home/my-translation/_swupdate*
Then install "gettext":
yum install gettext
Next "decrypt" the textfiles one by one. For that you use the "msgunfmt" command like this:
msgunfmt base-user.mo -o base-user.po
This takes base-user.mo, decrypts it and stores the plain text version of it under the name base-user.po.
Then you edit base-user.po and replace the English text with French. You will have to do that for each and any of the *.po files to make it a full translation.
When you look at a *.po file you'll see that the text is usually in this format in there:
msgid "ipAddr" msgstr "IP Address" msgid "ipAddr_help" msgstr "This is the IP address of the site."
The prefix "msgid" defines an identifier and the prefix "msgstr" contains which text is to be displayed when the code for the GUI uses the "msgid".
msgid's with the suffix "_help" at the end usually denote the "Help" text that is shown in the bottom frame in the GUI when you move the mouse over an item in the GUI.
For example if you move the mouse over "IP Address" in the GUI, it will show the help text "ipAddr_help" in the helper frame at the bottom.
Eventually when all files are translated, you can turn them back into *.mo files this way:
msgfmt base-user.po -o base-user.mo
Once you've done that, you can copy all the translated *.mo files to the correct language directory:
cp /home/my-translation/*.mo /usr/share/locale/fr/LC_MESSAGES/
As you can see, that command moves them to the "fr" directory, which will be used for French.
If your target is different language, please decide the directory name
according to the ISO-639 based 2 letters language code.
Now how do you make the new language available in the GUI? After all, in "Personal Profile" / "Account" / "Language" you have only "Japanese" and "English" as choices. Well, here is how to do that:
Run this command:
That starts "cceclient" which allows you to manipulate the CODB (Cobalt Object Database), into which the GUI stores its configuration. We need to find which Object ID the class "System" has.
It will respond with this:
100 CSCP/0.80 200 READY
It will responds something like this:
104 OBJECT 1 201 OK
Now we know that Class "System" has the Object ID 1. Let us take a look at which data that Object contains:
This shows us what's stored inside:
102 DATA productBuild = "5102R" 102 DATA NAMESPACE = "" 102 DATA productIdentity = "20061012" 102 DATA CLASSVER = "1.2" 102 DATA isRegistered = "0" 102 DATA CLASS = "System" 102 DATA gateway = "192.168.0.1" 102 DATA serialNumber = "" 102 DATA domainname = "smd.net" 102 DATA productName = "BlueQuartz 5100R Series" 102 DATA productBuildString = "build 20061012 for a 5102R in en_US" 102 DATA isLicenseAccepted = "1" 102 DATA OID = "1" 102 DATA productLanguage = "en" 102 DATA productSerialNumber = "" 102 DATA console = "1" 102 DATA productVendor = "" 102 DATA dns = "&192.168.2.1&192.168.10.1&18.104.22.168&" 102 DATA hostname = "cbq" 102 DATA locales = "&ja&en&" 201 OK
The line ...
set 1 locales = "&ja&en&fr&"
When you get the response ...
... the change has been made just fine.
Now let us restart CCEd and AdmServ for good measure (just to be sure):
/etc/init.d/cced.init restart /etc/init.d/admserv restart
Now login to the GUI and under "Personal Profile" / "Account" / "Language" you should be able to choose "French" as your default language for the account that you just logged in with.
You could also change "productLanguage" from "en" to "fr", but this will require additional tweaking on the command line to make French the default language for the entire GUI. Which is a bit beyond the scope of this documentation.
After your success...
Once you have the translation done and want to contribute it to the BlueQuartz project, please let us know. We'd really appreciate that!