Question
How to add a new locale in Plesk?
How to create custom language files for Plesk?
Answer
In the examples below, English 'en-US' locale is used as an original one and Czech 'cs-CZ' locale as a new one:
-
Copy existing locale, e.g. 'en-US'
# cp -npr /usr/local/psa/admin/application/admin/resources/languages/en-US/ /usr/local/psa/admin/application/admin/resources/languages/cs-CZ/
# cp -npr /usr/local/psa/admin/application/default/resources/languages/en-US/ /usr/local/psa/admin/application/default/resources/languages/cs-CZ/
# cp -npr /usr/local/psa/admin/plib/locales/en-US/ /usr/local/psa/admin/plib/locales/cs-CZ/
# cp -npr /usr/local/psa/admin/application/smb/resources/languages/en-US/ /usr/local/psa/admin/application/smb/resources/languages/cs-CZ/ -
Rename the files according to the locale code:
# cd /usr/local/psa/admin/plib/locales/cs-CZ
# rename 's/en-US/cs-CZ' /usr/local/psa/admin/plib/locales/cs-CZ/* -
Modify
messages_*.php
file# sed -i 's/en-US/cs-CZ/g' ./messages_cs-CZ.php
-
Modify or create
meta.xml
file, if it does not exist, to reflect the locale name in Plesk UI# vi /usr/local/psa/admin/plib/locales/cs-CZ/meta.xml
The file content should looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 1999-2017. Parallels IP Holdings GmbH. All Rights Reserved. -->
<locale>
<language>Česky</language>
<country>Czech</country>
</locale>Note: Custom language and country names should be placed inside
<language> </language>
and<country> <country>
tags. -
Add locale to Plesk:
# plesk db "replace into locales values ('cs-CZ', 'true');"
-
Modify the files according to language specifics. When logged in using the new locale, GUI items will be reflected accordingly.
For more information check Plesk localization guide