Translating the plugin to other languages

Customize plugin labels and messages or translate them to other languages.

When do you need to change plugin text?

WP Full Stripe displays labels and messages in US English by default.

You might need to translate the labels for many reasons, just to name a few:

  • You’d like to use the plugin in a different English-speaking region (UK for example)
  • You’d like to use the plugin in a different language
  • Your area of expertise uses a different terminology

Does the verb “translate” sound confusing?
We refer to “translate” even when you change some US English labels to their regional counterparts, like changing Zip (US) to Postcode (UK).

There are two ways to change plugin labels:

  1. Change the labels in the program code directly
    This is not recommended as your changes would be overwritten by plugin updates.
  2. Creating a resource file for your translations
    This is the recommended way to translate plugin text. The resource file is independent of the plugin installation so it will survive your plugin updates intact.

This article describes how you can translate plugin labels by creating a resource file.

How to translate plugin text

You need to complete the following steps to translate plugin text:

  1. Copy and rename the template resource file included with the plugin.
  2. Add your translations to the resource file.
  3. Convert the resource file to binary format.
  4. Copy the binary resource file to the plugin directory.

1. Copy and rename the template resource file

You can find the template resource file called wp-full-stripe.pot in:

  • The languages/ folder of the plugin .zip file; or
  • The wp-content/plugins/wp-full-stripe/languages/ folder of your Wordpress installation.

Copy and rename the file to wp-full-stripe-[language]_[country].po, where:

2. Add your translations to the resource file

You can edit the .po file in a text editor, or you can use the free version of POEdit for a better user experience.

The .po file is composed of lines grouped together, each group representing the source text and translated text on a separate line. The source text is identified by “msgid”, and the translated text is identified by “msgstr”.

As an example, imagine the following .po file snippet that we’d like to translate to Italian:

This is how the translation would look like:

If you’d like to translate only a few labels, you can delete the rest of the file. For the deleted labels, the plugin will display their default US English counterparts.

3. Convert the resource file to binary format

You have to convert the plain text .po file to a binary .mo file which will be used by Wordpress.

You can use the po2mo online tool to convert.
Make sure to correct the file name after conversion (po2mo spoils the file name).

Alternatively, you can use the msgfmt command line tool (part of the gettext distribution) to do the conversion:

4. Copy the binary resource file to the plugin directory

The last step is to copy the wp-full-stripe-[language]_[country].mo file to the
wp-content/plugins/wp-full-stripe/languages/ folder of your Wordpress installation.

Real-world example: Changing the ‘Zip’ and ‘State’ form labels for a UK-based website

1. Create the .po file with your translations

You’d create the following .po file with the translations. Please note that all other labels are removed since we don’t need to translate them:

2. Convert the .po file to .mo file

You can use the po2mo online tool to convert.

3. Copy the binary resource file to the plugin directory

The next step is to copy the wp-full-stripe-en_GB.mo file to the
wp-content/plugins/wp-full-stripe/languages/ folder of your Wordpress installation.

4. Verify your language settings in WP admin

Make sure that site language is set to “English (UK)”. You can verify it on the “Settings -> General” page in WP admin: Wordpress - Settings - General

Still not finding the solution?

Our support team is happy to help you.

Contact support

Feature requests are always welcome!
We consider each feature request carefully, and examine how it fits the roadmap for the plugin.