Contents

Translations - Plugixa Easy Social Share Buttons

Every sentence the plugin shows is translatable, in the admin screens and on the pages of your site. The plugin is written in English and ships its translation templates. It ships no translated files of its own.

The text domain and the templates

Edition Text domain Template
Free plugixa-easy-social-share-buttons languages/plugixa-easy-social-share-buttons.pot
Pro PRO The same one pro/languages/plugixa-easy-social-share-buttons-pro.pot

Both paths are inside the plugin’s folder. The free template lists the sentences of the free edition and none of Pro’s. Pro’s sentences are in Pro’s own template, which is only in the Pro download.

The admin screens are an application that runs in the browser, but their text is not held in JavaScript. Each sentence is declared in PHP and handed to the application when it starts, so the one template covers the admin screens as well as the pages of your site.

How a translation is loaded

The plugin does not load the free edition’s translation itself. WordPress does, the first time a sentence is needed, from the folder where it keeps plugin language packs:

wp-content/languages/plugins/plugixa-easy-social-share-buttons-fr_FR.mo

fr_FR stands for the language in use.

Translating the free edition

  1. Open languages/plugixa-easy-social-share-buttons.pot in a translation editor such as Poedit.
  2. Translate, and save the result as plugixa-easy-social-share-buttons- followed by the language code, for example plugixa-easy-social-share-buttons-fr_FR.mo.
  3. Put the file in wp-content/languages/plugins/.

Translating Pro PRO

Pro’s options, such as the Pinterest, short link and email panels, are translated from a second file. Pro loads it into the same text domain, after the free edition’s translations.

  1. Open pro/languages/plugixa-easy-social-share-buttons-pro.pot.
  2. Translate, and save the result with -pro- and the language code in its name, for example plugixa-easy-social-share-buttons-pro-fr_FR.mo.
  3. Put the file in the plugin’s pro/languages/ folder.

Keep a copy of that file somewhere else too: it sits inside the plugin’s folder, which an update replaces.

What Pro does with the file

Step What happens
1 Pro looks for pro/languages/plugixa-easy-social-share-buttons-pro- plus the language code, as a .mo file or the .l10n.php file beside it
2 With no such file, Pro does nothing. WordPress loads the free translations as it always does, and Pro’s own sentences read in English
3 With the file, Pro first loads the free translations, if nothing has loaded them yet: from wp-content/languages/plugins/, or failing that from the plugin’s languages/ folder
4 Pro then adds its own file to the same text domain

The free translations go in first on purpose. WordPress fetches a plugin’s language pack only while nothing is loaded for its text domain, so Pro’s file loaded alone would leave every free sentence in English.

Pro does this early on every request, and again whenever WordPress switches language part-way through one, as it does to send an email in the language of the person receiving it.

Changing a sentence in code

The filter plugixa_social_share_admin_i18n_strings passes the whole catalogue of the admin screens, as key and translated text, before it is handed to the application. See the Hooks reference.

What to do next

Quick Links