Text overrides

Have you ever wonder how to change just a little piece of text within PeepSo? We know you are.
Sometimes that pesky “Say whats is on your mind…” in postbox just don’t cut it and you really want to change it to something else. Like “Send the rocket to Jupiter…” or “White House is in Washington…” (we don’t know why would you want to do that but it’s possible)

Plugin translators have been doing just that for decades using translations files.
Stop there. We are aware you don’t need a translation per se, but what is a translation if not a text change?

In this article, we will use PoEdit application for macOS, but the same software is available for Windows and Linux

Once you download and install PoEdit, open the application and select “Create New Translation”


You might be wondering why not selecting “Translate WordPress theme or plugin” and you’re right, it will be easier to do so, but you’ll need paid version of PoEdit to do this, so we’ll stick with “Create New Translation” in this exercise.

The popup window to select the POT file will now be shown.
PeepSo, as is the case with every other decently coded WordPress plugin use POT files to handle all language strings.
Locate the POT file from which you want to change text and open it.
POT files for plugins are always in this location.

ROOT/wp-content/plugins/PLUGIN-NAME/language

Examples:
if you want to change the text in PeepSo Foundation plugin, then the location would be:
– ROOT/wp-content/plugins/peepso-core/language/peepso-core.pot

If you want to translate Groups plugin, then the location would be
– ROOT/wp-content/plugins/peepso-groups/language/groupso.pot

Note: Please be advised that some plugin names have been changed over the course of PeepSo development to better suit or represent the features of a plugin. For example, if you want to translate Chat plugin, it is actually called peepso-messages and it’s language file msgso.pot
To avoid conflicts and having to redo all language files, we didn’t change the POT names.

Once you selected the POT file to modify, PoEdit will ask you what language you want to translate file to.
Assuming you want to change the text for default WordPress language choose the English (United States) as shown in the picture bellow.

Press CMD + F if you’re on Mac or CTRL + F for Windows and Linux to invoke search popup and search for the keyword you want to change. Here we want to change “Say whats is on your mind…” so we will search for keyword “mind“.
Press “Next” until you find it.

In the Translation box, enter your translation for this string

Save the file as peepso-core-en_US.po (remember the location where you save them. We will need these files soon)

Note 1: If you change other files, like picso.pot, friendso.pot or groupso.pot then you need to name them picso-en_US.po, friendso-en_US.po, groupso-en_US.po and so on
Note 2: The file must be saved using po extension. There is no typo here.

PoEdit will now create two files

  1. peepso-core-en_US.po
  2. peepso-core-en_US.mo

Applying the Text Change

Now that we have our files ready, take them both and copy to following location:

ROOT/wp-content/languages/plugins/

If this directory does not exist yet, create it manually

And will you look at that, we just changed the text in the postbox!

Adding More Changes

To add more changes, edit the newly created po file and save to create new mo “translation”

Translating PeepSo

The official translations project for PeepSo is located at Crowdin. If you wish to contribute to existing translations, you can login to Crowdin and join the translators team.

There are, however situations when available translations simply don’t cut it. Maybe you’re not happy with the translation, maybe translation is in formal format when you need the casual one. Don’t worry, you can make your own translations with the little effort.

In this article, we will use PoEdit application for macOS, but the same software is available for Windows and Linux

Once you download and install PoEdit, open the application and select “Create New Translation”

You might be wondering why not selecting “Translate WordPress theme or plugin” and you’re right, it will be easier to do so, but you’ll need paid version of PoEdit to do this, so we’ll stick with “Create New Translation” in this exercise.

The popup window to select the POT file will now be shown.
Locate the POT file you want to translate and open it. POT files for plugins are always in this location.

ROOT/wp-content/plugins/PLUGIN-NAME/language

Examples:
if you want to translate PeepSo Foundation plugin, then the location would be:
– ROOT/wp-content/plugins/peepso-core/language/peepso-core.pot

If you want to translate Groups plugin, then the location would be
– ROOT/wp-content/plugins/peepso-groups/language/groupso.pot

Note: Please be advised that some plugin names have been changed over the course of PeepSo development to better suit or represent the features of a plugin. For example, if you want to translate Chat plugin, it is actually called peepso-messages and it’s language file msgso.pot
To avoid conflicts and having to redo all language files, we didn’t change the POT names.

Once you selected the POT file to translate, PoEdit will ask you what language you want to translate file to. Choose the language and press OK.

Now you are ready to start translating PeepSo to your language.
Enter your translations in a “Translation” box and do this for each string individually
Once you’re done with the translation, save the file. PoEdit will now ask you to name the translated file.

Translations must follow this naming convention:

pluginname-LANGUAGE_CODE.po

Note: The file must be saved using po extension. There is no typo here.

Examples:

If you wish to translate peepso-core.pot in German language, the file name will be peepso-core-de_DE.po
If you wish to translate friendso.pot in French language, the file name will be friendso-fr_FR.po
If you wish to translate picso.pot in Spanish language, the file name will be picso-es_ES.po

When you save the file, PoEdit will actually create two files, one with extension po and the other with extension mo

How to Discover What Language Code To Use

If you are not sure what language code you should be using when saving the file, you can use a very simple trick to learn what is the code you need.
Go to WP Admin -> Settings – General and change the language of your site.
Now take a look into ROOT/wp-content/languages
WordPress should already add some language files with appropriate language codes for selected language.

Applying translations

When you have all po and mo files ready, copy them into
ROOT/wp-content/languages/plugins/

Maintaining the Translation File

Because each new version of PeepSo and it’s supporting plugins contains a new .POT file, to remain accurate, translation files must be updated with each new release. To update the translation file:

Open your po translation file with PoEdit

Click “Catalog” and then “Update from POT File…

You will then see a summary of the updates including new strings that have been added and old strings that have will be removed.

Click “OK” to merge the changes into your translation file.
Translate the new strings.
Save the new po and mo files.