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”

What are your feelings
Updated on Dec 1, 2023