Note: edited to correct the language file paths, which were incorrect in the original article.
I often get asked if it’s possible to change the labels used by the Participants Database plugin, including the name of the plugin as it appears in the admin.
This is sometimes called “white labeling” meaning that all traces of the name of the plugin, developer and labels are customized to give the appearance of a custom application.
This is possible because nearly all the text is processed through a translation file which can be edited to “translate” the plugin text to anything you want.
Here’s how to do that
The first step is to install a translation file editor on your computer. I use Poedit on my Mac, but there are several to choose from for different platforms. This article on WordPress.org explains how to do this.
Now, in the plugin, in a directory named “languages” are all the translation files. Using FTP, download the file for your language to your own computer. Make a copy for backup, then open the original in the translation editor.
Finding Your Translation File
To find the translation file to edit, you need to know the language code for your language. If you don’t know the code, check the WordPress Locales page to find it. Once you know the code, the plugin language file will have that code in it. For instance, if your language is Danish, the code is “da_DK” so your language file is participants-database-da_DK.po
. That file will be found in:
wp-content/plugins/participants-database/languages/participants-database-da_DK.po
Creating a New Translation
If no file exists for your language, you can create a new one in the translation file editor. Start by opening the language template file participants-database/languages/participants-database.pot
in your translation editor to create the new translation. The editor will provide a way to do this. You’ll need to know the correct language code.
Once you’ve opened the translation file in the editor, you can search for the words you want to change. If there is more than one string that matches and you don’t know which one to change, you can check the context of the string, which tells you which script the text is from. That can give you a clue as to where the text is seen. Most of the time, it doesn’t matter, you can just change them all.
Saving your changes
Once you’ve made all your changes, save the file. This will create a new .mo file in the same location as the language file you edited. Now, you’ll need to upload the two files to the plugin to make the change complete: the .po file and the .mo file ( which contains the binary data the plugin uses to generate text) for your language.
For your changes to persist through plugin updates, you need to upload your translation files to the WP languages directory. The plugin will look there first for language files, overriding any language files in the plugin itself. Upload the files to a directory named “participants-database” in the general languages directory. For most WP installs, that will be in this location:
/wp-content/languages/plugins/participants-database-{LOCALE}.po
“{LOCALE}” will be replaced by the current locale value, which identifies the language you are using for your site. This is normally set in the general settings. With that in place, the plugin will use your edited translation files. The locale string will be something like “en_US” (American English), “pt_BR” (Brazilian Portuguese), etc., so if your language is Brazilian Portuguese, the files you will save are:
/wp-content/languages/plugins/participants-database-pt_BR.mo /wp-content/languages/plugins/participants-database-pt_BR.po
A language file in this location will override a language file of the same name in the plugin.
IMPORTANT: don’t put your translation file into the wp-content/plugins/participants-database plugin folder, it will be lost when you update the plugin.
Custom Translations for Other Plugins
The same instructions will work for any other plugins, the difference will be the name of the files you generate. Look at the name of the .pot file for the correct name to use. They go into the same location on your server.
Contributing Translations
If you are multilingual and would like to contribute a new (or updated) translation to the plugin, please contact me, I welcome the contribution!
Hmm. I just want to change the default text of the single page item view. It is of course “Participant info” and I just want it to say “Detail” because I am using your system for document information, not participants. I used PoEdit on the participants-database-en_US.po and made a new *.mo. Uploaded both to the participant-database languages folder and … no change even after refreshing the cache. Thing is PoEdit does not let me actually change the string value for the id (50) and only lets me add a “Translation” value for the “Participant Info” (the next column over in the PoEdit grid. So, maybe since the language *IS* US English it ignored this “translation” value and just uses the “Source Text” value? PoEdit n WIndows does not let me alter the Source Text… is there another program that does? (I am used to translation files for actual programs – *.resx resource files – that are simple and just work, thought this would be simple too but I’m stumped :(
fyi, also opened the po file in notepad and manually changed the value that the UI would not let me change, opened the file in the PoEdit and saw that that worked, compiled and uploaded, still the value says “Participant Info”
Hi Robert,
Not all strings you see will be handeld by the translation files, some are user-configured strings. Check through the field and field group definitions (on the Manage Database Fields page). The “Participant Info” heading you see on the single record page is probably a field group header…I don’t know, that is not something that is provided wiht the plugin, so it must be a user configured title or heading.
DARN! :) And there it is. Excellent. That makes sense and was what I’d originally thought but I didn’t look close enough at ALL of the options. Thank you so much and thank you for the coding, I can imagine all of the work and personal thought you put into it to deal with WP (someday being able to have multiple databases on a single site would be awesome, but again I realize the WP walls you have to deal with. Thank you Roland
I need some help to find my language file so I can change the label from Participants to Patients.
My language is en_GB but there is no file in your plugin language folder?
I created the file participants-database-en_GB.po and added po and mo to WP language Plugin Participants-database folder but that did not work?
I even removed all the language files from your plugin language folder but made no difference?
Please advise
Andrew
Tried bug tracking
I have uploaded these 2 files
————————————–
participants-database-en_GB.mo
participants-database-en_GB.po
To these folders
————————–
/public_html/wp-content/languages/plugins/participants-database/
/public_html/wp-content/languages/plugins/
/public_html/wp-content/languages/
/public_html/wp-content/plugins/participants-database/languages
But still no change of the label from Participants to Patients?
Thanks for bringing this up, it looks like I got it wrong in the article. My apologies! The correct path for your language file is
public_html/wp-content/languages/participants-database/participants-database-en_GB.po
I’m fixing this in the article now.
I don’t know if this is the correct place to ask, but is it possible to change the decimal point of the decimal and currency fields to ”,” commas instead of point “.”?
This would normally be handled by the locale of the site, so for example if your site language is French, it would use a comma for the decimal. If that’s not working, do you have the “intl” module installed in your php? This is the module that handles localization.
If you want to “force” the formatting (you want a format that is different from what localization would provide), you can do that with a filter, the filter is pdb-number_display and it gets 2 parameters: the raw number and the field object so you know which field you’re trying to format. The filter should return the formatted number.
I attempted this and the wording I would like to change does not appear in the .po file.
Working with en_US and searching for “If you have an account, it is strongly recommended that you login before you sign up so that you can view and edit all your signups.” We would like to remove this as we do not have logins and it is confusing to users. The text comes from the actual sign up page. The one where you enter your First Name, Last Name, E-mail and Confirm E-mail.
Suggestions?
Hi Jim,
This text is not part of Participants Database. I’m guessing it’s in the content of your signup page, or possibly in the template.
Roland,
Thank you for your quick and accurate response. I hate to say this but I asked the question on the forum for the wrong plugin. Yours works great!
Jim