Articles in this section

How to add custom locale to Plesk?

kb: how-to Plesk for Linux ABT: Group B

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.

  1. Log into the server via SSH.
  2. 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/

  3. 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 rename command is not available or works differently on your OS (e.g., CentOS), you may need to use the mv command to rename files manually.

  4. Modify the messages_*.php file to replace the locale string:

    CONFIG_TEXT: sed -i 's/en-US/cs-CZ/g' ./messages_cs-CZ.php

  5. Modify (or create) the meta.xml file 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.

  6. Register the new locale in the Plesk database:

    CONFIG_TEXT: plesk db "replace into locales values ('cs-CZ', 'true');"

  7. 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.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.