BuycPanel Blog

BuycPanel Blog

Latest news and updates

Steps to Localize Text in cPanel Plugins

Posted by Allura on 29 07 2019.

Introduction
The localization of text in a cPanel Plugin allows users from a variety of places to access or use the given Plugin.The process to be followed so as to successfully create and install a localized cPanel Plugin shall be traced in some detail as follows:Localize Plugin Text
Step 1: Use the locale.maketext System to Localize your Plugin’s Text
For instance, cPanel Plugins usually use CPAN’s Locale::Maketext::Utils module to carry out most of its tasks or functions.Step 2: Use the LANG System to Localize your Plugin’s install.json File
When this file is being created for a localized plugin, the name value of each group and item in the file must be localized. That is what will allow cPanel to correctly localize and display the name of the plugin in its Home Interface.In situations where the locate.maketext method is incompatible such as in the case of dynamicui.conf system’s localization, the LANG method may be used.Step…

Introduction

The localization of text in a cPanel Plugin allows users from a variety of places to access or use the given Plugin.

The process to be followed so as to successfully create and install a localized cPanel Plugin shall be traced in some detail as follows:

Localize Plugin Text

Step 1: Use the locale.maketext System to Localize your Plugin’s Text

For instance, cPanel Plugins usually use CPAN’s Locale::Maketext::Utils module to carry out most of its tasks or functions.

Step 2: Use the LANG System to Localize your Plugin’s install.json File

When this file is being created for a localized plugin, the name value of each group and item in the file must be localized. That is what will allow cPanel to correctly localize and display the name of the plugin in its Home Interface.

In situations where the locate.maketext method is incompatible such as in the case of dynamicui.conf system’s localization, the LANG method may be used.

Step 3: Create or Update the Desired Locale Files with your Custom Translations

One may copy the locale file created by developers, exporting the same so that it may be updated and modified by translators and then importing it as the customized version of the locale for each language that one wishes to equip the Plugin with.

Step 4: Import your Custom Locale

The custom locale may be imported using the /scripts/locale_import script. It may either be installed manually after it is imported or be incorporated into the Plugin’s installation script.

Step 5: Rebuild the Server’s Locale Databases

Once the aforementioned steps have been successfully completed the server’s locate databases can be rebuilt simply by running the /usr/local/cpanel/bin/build_locale_databases script.

This script recompiles all of the given server’s locales and may either be run manually at the time of the localization of the Plugin or be incorporated in the installation script of the same, therefore being run at the run of the Plugin’s installation.

Step 6: Check your Plugin’s Localization

Finally, once all of the previous steps have been executed, it is time to check the localization of the Plugin.

One may login to cPanel using a test account and navigate to the Plugin, checking to ensure that the localized text is displayed properly in each and all of the various languages included in the Plugin.

Conclusion

All information on localizing text in cPanel plugins is outlined in this review.