Adding a new language to the control panel
This article describes how to add a new language to the control panel. Swedish is taken 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/
<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
<lang name="sv">
</lang>
</mgrdata>
To display the language name in the control panel, create the /usr/local/mgr5/etc/xml/core_mod_sv.xml file with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
<lang name="en">
<messages name="label_langs">
<msg name="sv">Svenska</msg>
</messages>
</lang>
</mgrdata>
After both files have been added, restart the command control panel:
killall core
In the panel, 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 the new language is added, you can translate the control panel interface into that language. There are two methods to translate:
Method 1
- In the control panel, switch to the new language. This can be done on the authorization page or in the user settings. Since you have not yet added new messages for this language, the entire interface will be in the default language.
- Select any text for translation in the panel and press Ctrl + Enter. A window will open in which you need to enter the translation.
- After you enter a new message and save the changes, the interface will immediately change to the new message.
All changes you make with Ctrl + Enter will be saved in the/usr/local/mgr5/etc/xml/
After the translation is complete, all language messages will be in the
In total, you will have three language files:
- core_mod_sv.xml — contains the language name. The file is needed so that the language selection list displays the name of the language, not its short designation;
_msg_ _msg.xml — file with the language description; _mod_local_msg.xml — file with the language description and all translated messages.
You can merge the
Or rename
Method 2
The first method allows you to translate directly from the panel interface, but it is not always convenient, and not all messages can be translated this way. In this case, you can use the second method.
- Take the English message file
_msg_en.xml as a base and copy it:
cp /usr/local/mgr5/etc/xml/<mgrname>_msg_en.xml /usr/local/mgr5/etc/xml/<mgrname>_msg_<sv>.xml
Comments - In the new file
_msg_sv.xml changeto . You will get a file for the Swedish language, which already has all possible control panel messages. - Translate the messages in the file from English to Swedish.
- For the changes to take effect, restart the control panel:
killall core