Add a new language to the control panel

 

One of frequently asked questions is how to add a new language to the control panel or translate the panel into a new language? This article will describe the process of adding Swedish to ispmanager as an example.

How to add a language to the panel

To make a new language appear in the language selection field, create the /usr/local/mgr5/etc/xml/_msg_.xml file with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
<lang name="sv">
</lang>
</mgrdata>

Here "sv" is an arbitrary value that typically matches the language code.

To display the full language name in the control panel, create 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>

Here Svenska is the language name.

After both files have been added, restart the control panel with the following command:

pkill core

After that you will be able to select the Swedish language on the authorization page or on the page for changing the user's language.

How to translate the panel interface

Once a new language has been added, you can translate the panel to that language.

  1. Take the files with English messages ispmgr_msg_en.xml and core_msg_en.xml as a basis and copy them:
    cp /usr/local/mgr5/etc/xml/ispmgr_msg_en.xml /usr/local/mgr5/etc/xml/ispmgr_msg_sv.xml
    cp /usr/local/mgr5/etc/xml/core_msg_en.xml /usr/local/mgr5/etc/xml/core_msg_sv.xml
  2. As a result, we get Swedish language files that already contain all possible messages that are used in the control panel. All that remains is to translate the messages in the files from English to Swedish.
  3. Translate the messages in the file from English to Swedish.
  4. For the changes to take effect, restart the control panel.