Question
How to add a new locale (create custom language files) in Plesk?
Answer
In the examples below, the English 'en-US' locale is used as the source, and the Czech 'cs-CZ' locale is used as the new target.
- Log into the server via SSH.
-
Copy the existing locale directories (e.g., 'en-US') to the new locale path (e.g., 'cs-CZ'):
CONFIG_TEXT: 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 inside the new directory according to the locale code:
CONFIG_TEXT: cd /usr/local/psa/admin/plib/locales/cs-CZ rename 's/en-US/cs-CZ/' *
Note: If the
renamecommand is not available or works differently on your OS (e.g., CentOS), you may need to use themvcommand to rename files manually. -
Modify the
messages_*.phpfile to replace the locale string:CONFIG_TEXT: sed -i 's/en-US/cs-CZ/g' ./messages_cs-CZ.php
-
Modify (or create) the
meta.xmlfile to reflect the locale name in the Plesk UI:CONFIG_TEXT: vi /usr/local/psa/admin/plib/locales/cs-CZ/meta.xml
The file content should look as follows:
CONFIG_TEXT: <?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>and<country>tags. -
Register the new locale in the Plesk database:
CONFIG_TEXT: 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 the Plesk localization guide.
Comments
Please sign in to leave a comment.