Very often a client may need to add a new language to his control panel and translate the panel. This article walks you through the steps you need to perform to add a new language, let's say Swedish, into ISPmanager.
The described method cannot be applied to the BILLmanager 6 interface.
How to add my language?
In order to add a new language into the language selection field, create the /usr/local/mgr5/etc/xml/ispmgr_msg_sv.xml file with the following contents:
<?xml version="1.0" encoding="UTF-8"?> <mgrdata> <lang name="sv"> </lang> </mgrdata>
Where sv is a value corresponding to the desired language.
To make your language to be displayed in a control panel, add the /usr/local/mgr5/etc/xml/core_mod_sv.xml file with the following contents:
<?xml version="1.0" encoding="UTF-8"?> <mgrdata> <lang name="en"> <messages name="label_langs"> <msg name="sv">Svenska</msg> </messages> </lang> </mgrdata>
Where Svenska is a language name.
After you have added two languages, restart the panel with the following command:
Therefore, you will be able to choose the Swedish language in the ISPmanager login form and language selection field in the "User settings" form.
You can add a new language into any other ISPsystem's control panel in the same way. The only difference is that the ispmgr_msg_<language>.xml file should be named according to a control panel's name. E.g. file in BILLmanager - billmgr_msg__<language>.xml, file in VMmanager - vmmgr_msg__<language>.xml, etc.
How to translate a panel into my language?
After you have added a new language, you can translate the panel. There are two ways to translate our panels:
Open the login form or the user settings form in the control panel and select "Svenska" to translate the panel into Switch. As we haven't added the translated messages yet, the web interface will be in English (this is the default language).
Select a text in the control panel you want to translate and press Ctrl + Enter. A new window will open where you can make a translation.
Once you have entered your translation and clicked OK to save it, the translated text will be immediately displayed in the interface.
All the changes you make with Ctrl + Enter will be saved into the /usr/local/mgr5/etc/xml/ispmgr_mod_local_msg.xml file.
Once you are done with translation, all the language files will locate in the ispmgr_mod_local_msg.xml file.
You will have 3 files:
- core_mod_sv.xml — this file contains a language name. This file enables to display a language name rather its short name;
- ispmgr_msg_sv_msg.xml — file with language description;
- ispmgr_mod_local_msg.xml — file with language description and all translated messages.
You can combine the ispmgr_msg_sv_msg.xml and ispmgr_mod_local_msg.xml files, i.e. copy all the messages from ispmgr_mod_local_msg.xml into ispmgr_msg_sv_msg.xml. Or rename ispmgr_mod_local_msg.xml into ispmgr_msg_sv_msg.xml, but your new changes made by Ctrl + Enter will be added into the new file ispmgr_mod_local_msg.xml.
The first variant enables to make a translation directly from the panel's interface, however, it's possible to translate all the elements this way.
Let's consider one more example of translating your panel into the Swedish language.
Take the English file ispmgr_msg_en.xml and copy it.
cp /usr/local/mgr5/etc/xml/ispmgr_msg_en.xml /usr/local/mgr5/etc/xml/ispmgr_msg_sv.xml
In the new file ispmgr_msg_sv.xml change <lang name="en"> into <lang name="sv">.
Thus, we have the Swedish language will with all the messages used in the control panel. You will only need to translate the messages in the file from English into Swedish.
Restart the panel to apply the changes.