New WordPress Plugin: Translate Words

Last week I had a theme customer who wanted to translate some words on their website. The changes they wanted to make were small, and so I wanted a simple plugin to make the changes.

I knew that from a technical point of view it could be done easily. A filter on the gettext hook and a check for the string, so I could have fixed it easily. But what if the customer wanted to change something else in the future? I wanted it to be self service.

I had also had a need to do something similar myself. My sites are always in English, and themes and plugins are mostly in English, but sometimes I want to change the copy so it’s more appropriate or personal to me, so I started searching for a plugin.

I found quite a few translation plugins but most were too complex. They were for translating the entire site, or setting up a multi-language site, and that’s not what I wanted. I basically wanted a back-end for the filter I mentioned before.

The Translate Words Admin screen.

The Translate Words Admin screen.

The closest plugin I found was a plugin called WP Override Translations, but I felt it could be simpler still. So rather than use it and move on, I spent a day rewriting it as my own plugin.

Translate Words

*

I named my plugin Translate Words. It has a simple table that lets you enter the word/ phrase you want to change and what you want to change it to.

  1. It works on the front-end and the admin.
  2. It translates anything that goes through the gettext hook, including translations.
  3. It’s quick! The front-end code is about 20 lines long with one autoloaded database request.

Use Cases

The obvious use case is translations, but you can also use it to change text. For example changing a title from ‘Recent Stories’ to ‘Recent Articles’. This is the sort of thing that you would normally create a child theme for, or filter somehow. But now it can be done quickly and easily.

It took me a day of work but my goal with plugins is always to create something simple that will save me time in the future. I’ve wanted this for myself in the past, and now I can share it with my customers so that they can tweak the text content on my themes to their tastes. The fact it works with translated content means users can use the translation files, and still override the copy to fit their site.

Win win I think!

Credit

I should add a note about credit. As I mentioned, I forked a plugin called WP Override Translations, and through a conversation on Twitter I found out that plugin is itself a fork of Gettext override translations.

Both plugins could be used instead of mine. Obviously I think my version is better because of it’s simplicity but they do offer a couple of extra features that might be useful to you.

Let me know what you think on Mastodon, or BlueSky (or Twitter X if you must).

WordPress News

The latest WordPress updates from the WPBriefs Podcast.

Related Posts

01 Apr 2015

The State of WordPress Themes #wcldn

I recently spoke on a panel at WordCamp London 2015e. Lance – who used to be the Theme Team lead at WordPress.com – asked me if I wanted to speak on a panel with him at WordCamp London 2015. I’ve...
27 May 2013

WordPress: 10 Years Young, What Does The Future Hold?

WordPress is now 10 years old. I started using wordpress 9 years ago – which means I joined the WordPress community early on. The reason I chose WordPress is simply because of the fabled 5 minute install process – I...
17 Oct 2012

WordPress Social Network Aggregation

I really like the idea of a Tumblog – and even have one on Tumblr.com – but I don’t promote it anywhere. Conceptually it’s great – but I don’t like not having control over my content.What I would really like...
29 Mar 2009

The future of WordPress themes

A couple of weeks ago there was quite a lot of talk within the WordPress themes community about the future of WordPress. Ian Stewart started it, and then it spread around the blogosphere… so I thought I’d offer my rather...
28 Aug 2009

Binary Moon WordPress design vIII

As I briefly mentioned on Monday, I have finally redesigned Binary Moon.I actually started redesigning about 2 years ago. Initially it was going to be an update rather than a totally new look, and I even built most of it,...