wpDataTables localization and translation

wpDataTables localization and translation

Hi, everyone!

While wpDataTables 1.7 is still under beta testing, we wanted to share some instructions on how to translate your copy of the plugin. wpDataTables is used worldwide, and not always having it in English is sufficient.

There is some confusion caused by the language selection in plugin’s settings. Indeed, you can choose the language there, but it uses only the core DataTables localization, which means, only the strings in front-end related to basic functionality (global search, pagination, info) are translated, everything else, including editing functionality, and plugin’s back-end needs to be translated manually, but there’s nothing complicated in that.

In this post we’ll go through the translation process step-by-step. We will be using Mac OS and Mac software, but it’s really similar for Windows and Linux machines too.

We assume that you will be doing the translation on a local WordPress installation, so the prerequisites are: local WP site with wpDataTables installed.

First of all, we need to make sure that proper locale / language is defined for WordPress globally. Check this in WP-Admin, Settings -> General -> Language:

Localising wpDataTables - WordPress CRUD Manager

Next thing to do is to re-generate a valid “.po” catalog. Catalogs in “.po” files are compiled libraries of strings for translation used by gettext engine to localise software – this localisation mechanism is used by WordPress natively.

To do this, please download POEdit, the localisations standard cross-platform editor (available for Mac OS, Linux and Windows systems).

After installing POEdit, you can launch it, and click “File -> New…”, then choose the language from the dropdown:


Translating wpDataTables - Tables and Charts in WordPress

Then choose “File -> Save As…” and navigate to your WordPress local installation folder, there open “wp-content/plugins/”, open wpDataTables plugin folder (usually “wpdatatables“), then go to “languages” folder and under it create a new folder with your locale code as a name (e.g. for US English it’s en_US, for German it’s de_DE, for Russian it’s ru_RU, etc). There save the new catalog as “wpdatatables-{locale code}”, e.g., for Russian – wpdatatables-ru_RU:

Translating wpDataTables WP Table Manager

Please note that following the directory and file name strictly is a requirement, otherwise WordPress won’t “see” the translation!

Next thing to do is to extract all the translatable strings from plugin source code which requires a couple of settings to be made.

Click “Extract from sources“. In the first tab (“Translation properties“) set “Source code charset” to UTF-8; in the second tab (“Sources Paths“) in the “Paths” setting locate the plugin’s root folder (usually it’s wp-content/plugins/wpdatatables under your WP install folder) and in “Excluded paths” add Wildcard “*.js” ; in the third tab (“Sources keywords“) add 2 keywords: “__” (two underscores), “_e“.

When these settings are done you can click “OK” and POEdit will browse through the source code, looking for all the strings which can be translated. If everything goes fine, you should get a list of translatable strings in the POEdit window:

Translate wpDataTables using POEdit

Now comes the longest part of the job: translating all strings one by one. As there’re already a lot of tables in the plugin, this might take a couple of hours:

Translating wpDataTables - Tables and Charts Manager for WordPress

When you’re finished – just save the catalog, and POEdit will automatically save both the .po (text file) and .mo (binary file) files which WordPress is using.

Now – if you did everything right – you will need just to refresh your WordPress pages with wpDataTables (both back-end and front-end) – and the interface (except for ‘deeply technical’ things like data types) will be in your language! As e.g. in our case in Russian:

wpDataTables - Tables and Charts Manager for WordPress - localisation

We will include translations (e.g. Russian will be already included in 1.7) in the core package, so that hopefully we’ll fill the library little by little.

If you translated wpDataTables to your language – please do contact us, we will include this too after a brief verification!

As WPML also supports gettext – we believe it can also be used to translate wpDataTables – but we’re yet to check this.

Hope this helps – and see you soon!

Back-end Excel-like Editor
Up Next:

wpDataTables 1.7 Beta Release

wpDataTables 1.7 Beta Release