Merging the 'New-Style' Locale Files

Locale for the 'new-style' Plesk pages is made up of numerous files organized into a complex hierarchy. Handling those multiple files and preserving the hierarchy during the translation can be difficult. You can make the task easier by merging the individual 'new-style' locale files into a few larger ones before the translation. After you have translated the few bigger files, split them back before importing the new locale into Plesk.

The contents of the following directories can be merged:

  • /usr/local/psa/admin/application/default/resources/languages/en-US/

    Controls used on the 'new-style' Plesk pages, shared by Server Administration Panel and Customer Panel.

  • /usr/local/psa/admin/application/admin/resources/languages/en-US/

    Server Administration Panel locale.

  • /usr/local/psa/admin/application/smb/resources/languages/en-US/

    Customer Panel locale.

You can join the locale files within each of these directories into a separate big locale file.

To join the 'new-style' locale files:

Run the following command for each of the directories:

php <plesk-installation-dir>/admin/smb/application/utils/locale/smb2plesk.php -d <target-directory> [-o <output-directory>]

where

  • <plesk-installation-dir> is the Plesk installation directory (by default, that's /usr/local/psa on Linux and "C:\Program Files(x86)\%plesk_dir%" on Windows).
  • <target-directory> is the directory whose contents are to be merged.
  • <output-directory> is the directory where the resulting file will be created. If not specified, the current directory will be used.

    Note: The file name cannot be specified and is always en-US.php, so be sure to rename it before running the utility to merge the different directory. Otherwise, the file will be overwritten.

For example, to merge the files in all 3 directories, and have the resulting files in the /tmp directory under the names shared.php, admin-panel.php, and control-panel.php respectively, run the following commands:

# cd /usr/local/psa/admin
# php smb/application/utils/locale/smb2plesk.php -d <code>application/default/resources/languages/en-US/</code> -o /tmp
# mv -T /tmp/en-US.php /tmp/shared.php
# php smb/application/utils/locale/smb2plesk.php -d <code>application/admin/resources/languages/en-US/</code> -o /tmp
# mv -T /tmp/en-US.php /tmp/admin-panel.php
# php smb/application/utils/locale/smb2plesk.php -d <code>application/smb/resources/languages/en-US/</code> -o /tmp
# mv -T /tmp/en-US.php /tmp/control-panel.php

Note: The utility output may contain the following text: "PHP Notice: Undefined variable: content in /usr/local/psa/admin/smb/application/utils/locale/smb2plesk.php on line 170". It can be ignored.

After you have translated the resulting files, you will need to split them before importing the locale into Plesk. See the Splitting 'New-Style' Locale Files section for instructions.

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.