Detailed instructions for use are in the User's Guide.
[. . . ] 13 Panel 10 Locale (PHP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 SiteBuilder Locale (INI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Importing Custom Locale
17
Validating Translated Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Splitting 'New-Style' Locale Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [. . . ] Changing locale code in file names Change the locale code in names of all directories and files where it is specified: /usr/local/psa/admin/common/resources/languages/en-US/ /usr/local/psa/admin/plib/locales/en-US/ /usr/local/psa/admin/plib/locales/enUS/common_cli_messages_en-US. php /usr/local/psa/admin/plib/locales/en-US/devmessages_en-US. php /usr/local/psa/admin/plib/locales/en-US/common_messages_enUS. php /usr/local/psa/admin/plib/locales/en-US/messages_en-US. php /usr/local/psa/admin/panel/application/resources/languages/en -US/ /usr/local/psa/admin/smb/application/resources/languages/enUS/ /usr/local/sb/resources/locale/en_US Note: Here, the code is different, the language and country codes are connected with underscore "_" instead of hyphen. Be sure to preserve this.
Preparing for Translation
9
Changing language properties in locale data files Edit your copy of the /usr/local/sb/resources/locale/en_US/info. xml file:
<?xml version="1. 0" encoding="utf-8"?> <locale code="en_US" version="1. 0"> <native_name>English, United States</native_name> <english_name>English, United States</english_name> <decimal_point>. </decimal_point> <monetary_unit_code>USD</monetary_unit_code> <currency_symbol_left>$</currency_symbol_left> <currency_symbol_right></currency_symbol_right> <date_format>n/j/Y</date_format> <time_format>g:i:s A</time_format> <week_begin>1</week_begin> </locale>
It is required to change the code attribute of the locale element, and change the values of the native_name and english_name elements. Note: The language code should be a valid code, where a two-letter abbreviation of the language name is followed by an underscore ( _ ), and then by a two-letter country code
10
Preparing for Translation
Merging 'New-Style' Locale Files
Locale for the 'new-style' Panel pages is made up of numerous files organized into a quite complex hierarchy. Handling those multiple files and preserving the hierarchy during the translation can turn out as a very complicated task. You can save efforts on this: just join the multiple 'new-style' locale files into a few before the translation, translate those few bigger files, and then split them back before importing your new locale into the Panel. The directories that contain locale of the 'new-style' pages and can undergo the conversion are as follows: /usr/local/psa/admin/common/resources/languages/en-US/ Controls used on 'new-style' Plesk pages, shared by Server Administration Panel and Control Panel. /usr/local/psa/admin/panel/application/resources/languages/en -US/ Server Administration Panel locale. /usr/local/psa/admin/smb/application/resources/languages/enUS/ Control 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 <panel-installationdir>/admin/smb/application/utils/locale/smb2plesk. php -d <targetdirectory> [-o <output-directory>]
where <panel-installation-dir> substitutes the Panel installation directory (by default, that's /usr/local/psa on Linux and "C:\Program Files\Parallels\Plesk" on Windows) <target-directory> substitutes a 'new-style' locale directory, one of the three listed above <output-directory> substitutes a directory where the resulting file will be created. Note: The file name cannot be specified and is always en-US. php, so be sure to rename it after you create it for each directory.
Preparing for Translation
11
For example, to join files in all 3 directories, and have the resulting files in the /tmp directory under the names shared. php, admin-panel. php and controlpanel. php respectively, run the following commands:
# cd /usr/local/psa/admin # php smb/application/utils/locale/smb2plesk. php -d common/resources/languages/en-US/ -o /tmp # mv -T /tmp/en-US. php /tmp/shared. php # php smb/application/utils/locale/smb2plesk. php -d panel/application/resources/languages/en-US/ -o /tmp # mv -T /tmp/en-US. php /tmp/admin-panel. php # php smb/application/utils/locale/smb2plesk. php -d smb/application/resources/languages/en-US/ -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". Despite of this notice, the utility successfully merges the files, so please ignore it. After you translate these files, you'll have to split them back before adding to the Panel as described in the section Splitting 'New-Style' Locale Files (on page 18).
CHAPTER 3
Translating Locale Strings
In this chapter:
Files Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Translation Tips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Files Format
Panel 10 locale files are PHP files with simple associative arrays made up of records like
'<localization_key>' => '<message>',
or
'<localization_key>' => "<message>",
SiteBuilder locale files are plain text (INI) files with the . lng extension with strings in the following format:
<localization_key> = "<message>"
where <localization_key> uniquely identifies a GUI item <message> is a text in a human language which describes a particular GUI item, appearing as either a GUI or a contextual help text
To adjust these files so that the the Panel GUI was displayed to users in a particular language, translate all string parts containing messages (<message>), leaving localization keys and string syntax as they are. Note: SiteBuilder messages can contain HTML source text, be sure to preserve the HTML syntax during the translation, too.
Translating Locale Strings
13
Translation Tips
For editing locale files, we recommend using a text editor which supports highlighting syntax. Using such editors makes the translating more comfortable than when using those displaying just plain text, and also, what's more important, helps you detect the file corruption if you change the files syntax. Often, instead of particular values taken from the Panel operation context, such variables are substituted with the neighbor messages. For example:
'secureSettingsDescription' => 'If you want the provided hosting to be the most secure, %%link%%. Note that some of the permissions, if granted, let subscribers change these settings. %%helpLink%%. ', 'secureSettingsLink' => 'apply secure settings preset', 'secureSettingsHelpLink' => 'Learn about secure hosting setting',
Here, variables %%link%% and %%helpLink%% are substituted with the messages defined by the secureSettingsLink and secureSettingsHelpLink, respectively. So, the resulting message in the Panel looks as follows: If you want the provided hosting to be the most secure, apply secure settings preset. Note that some of the permissions, if granted, let subscribers change these settings. %<number> For example, the message string "The domain resolves to another IP address (%1). [. . . ] Run the following command:
#php -l <file-name> for example, #php -l conhelp_pt-BR. php
18
Importing Custom Locale
Splitting 'New-Style' Locale Files
If you merged locale files (on page 10) for more comfortable translation, you should split them back into the file structure used by the Panel.
To split your translated files:
Run the following command for each of the files:
php <panel-installationdir>/admin/smb/application/utils/locale/plesk2smb. php -f <localeFile> -o <target-directory> -l <locale-code>
where <panel-installation-dir> substitutes the Panel installation directory (by default, that's /usr/local/psa on Linux and "C:\Program Files\Parallels\Plesk" on Windows) <localeFile> substitutes the locale file that should be split <target-directory> substitutes a directory where the folder named xx-YY (see below) and containing the resulting files will be created. <locale-code> substitutes a locale code used as a name of resulting folder with locale files (in format xx-YY, to find a required locale code, use Appendix. Locale Codes (on page 20)).
For example, to split the files /tmp/shared. php, /tmp/admin-panel. php and /tmp/control-panel. php with Brazilian Portuguese (pt-BR) translation and have the resulting files placed into the Panel locale file structure, run the following commands:
# cd /usr/local/psa/admin # php smb/application/utils/locale/plesk2smb. php -f /tmp/shared. php -o common/resources/languages -l pt-BR # php smb/application/utils/locale/plesk2smb. php -f /tmp/adminpanel. php -o panel/application/resources/languages -l pt-BR # php smb/application/utils/locale/plesk2smb. php -f /tmp/controlpanel. php -o smb/application/resources/languages -l pt-BR
Importing Custom Locale
19
Adding New Locale to Panel Files
Place your new locale files next to other Panel locales (be sure that the proper locale code presents in the names of files/folders (on page 8)). In particular, directories named after your locale must appear next to each en-US directory listed in the Copying Locale Files section (on page 6). [. . . ]