In this chapter, we will discuss the details of Plesk localization.
Preparing for Translation
To prepare locale files for translation:
- Export the American English (en-US) locale by copying the locale
directories and files. The list of these files is provided in the
Plesk Locale Files section. - Change the locale code in the copied locale files and directories. To
learn what exactly you need to change, see the Changing Locale
Code section. - (Optional) Merge the ‘new-style’ locale files. In other words,
convert a large number of locale files into a few for easier
translation. The instructions on merging files are provided in the
Merging ‘New-Style’ Locale Files section.
Translating GUI Messages
Plesk locale files are PHP files with simple associative arrays made up
of records like
'<localization_key>' => '<message>',
or
'<localization_key>' => "<message>",
where
-
<localization_key>
uniquely identifies a GUI item. -
<message>
is human-readable text describing a particular GUI
item, and appearing as either a GUI element or contextual help text.
To translate the Plesk GUI into a particular language, edit the files by
translating all string parts containing messages (<message>
),
leaving localization keys and string syntax intact.
The Translating Plesk GUI Messages section provides more information
on translating locale strings.
After you have finished editing the locale files, to avoid possible
issues caused by broken PHP syntax, we recommend that you validate the
new locale files after translation.
To validate the translated files:
-
Upload the files to a computer with PHP installed.
-
Run the following command for every uploaded file:
#php -l <file-name>
for example,
#php -l conhelp_pt-BR.php
Importing the New Locale
To import the new locale into Plesk:
-
Add the new locale to Plesk by copying the directories containing the
new locale files to the corresponding locations on the file system. -
Register the new locale in Plesk by running the following commands:
-
On Linux:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e "replace into locales values ('<xx-YY>', 'true')"
-
On Windows:
>cd /D "%plesk_dir%DatabasesMySQLbin" >mysql -P8306 -uadmin -p<Plesk admin password> psa -e "replace into locales values ('<xx-YY>', 'true')"
Where <xx_YY> is the code of your locale.
-