How to localize and translate a WordPress plugin – An in depth guide for plugin developers

How to localize and translate a WordPress plugin – An in depth guide for plugin developers

When developing a plugin, it’s always good idea to make it translation ready as it could additionally reach audiences who do not use English as their first language. If you were wondering how important a translation option is, you can check the repository and see that every single popular plugin is available for language localization. You will find this option is available with UpdraftPlus, MetaSlider, WP-Optimize, Contact Form 7 and WooCommerce, as well as many more. These are some of the most popular plugins available and are coded in a way that allows anyone to translate them easily into their native language.

The purpose of this blog is to demonstrate to our readers how they can code a plugin so that it will be localized and translated into any supported WordPress language. For example, if we wanted to translate a plugin into French, the following steps will allow plugin translation and also make it ready for all supported WordPress languages.

Getting Started

When creating a plugin, we should make sure that we load the plugin text domain. WordPress provides this function:


This code will load the plugin’s translated strings. It may seem a little confusing, but keep reading and we’ll explain how it works shortly.

First, let’s take a look at how to add this function to our plugin code. In your plugin folder, create a directory called ‘languages’. Next, add the below code to your plugin main file.

* Load plugin textdomain.
function plugin_load_textdomain() {
load_plugin_textdomain( ‘udp’, false, basename( dirname( __FILE__ ) ) . ‘/languages/’ );
add_action( ‘init’, ‘plugin_load_textdomain’ );

In the above code, we keep the first parameter (domain) as ‘udp’. We should keep this domain name as per our name of the plugin. The second parameter defaults to false. The third parameter is the path of our ‘languages’ directory. This code keeps our translation files ready on the WordPress initialization.

Use of __() and _e() Methods

As we are aiming to make our plugin available in all languages, we should wrap all our plugin text inside either:

__() or _e() functions.

It is very easy to use these methods. Both methods work exactly the same but there is a rule for using both.

In our plugin code, we normally have two types of text. The first is wrapped in HTML directly and the second is displayed using PHP echo function. Below are examples of both types:

Type 1
[php htmlscript=true]

My Plugin Title


Type 2


The general rule is that if you are printing text using PHP echo then you should wrap text in the following code:


If it is in HTML then use the code:


The above code should be written in the following way:




Type 2
[php htmlscript=true]


As can be seen in the above examples, the second parameter was written as ‘udp’, which is our plugin text domain. By using this domain, it will allow us to later translate our text into any language. This is how other plugins make their plugins translation ready.

If you wish, you can check our plugin:


If you search for the text domain ‘updraftplus’, you will see how our plugin’s text is wrapped inside __() and _e() functions.

Create a Sample Plugin

The next stage is to create a sample plugin with the some text so we can test our translations. First, create an ‘udp’ folder in your plugin directory. Inside this folder create the file: udp.php and the folder languages. Next, add the below code to the plugin file.




Create the Translation Files

To generate our translation files, we will use the following translation editor software:


Translation files (.po and .mo) contain the string to translate and the translated string. While creating the .po file we need to save it in ‘{domain}-language code’ format. In this example, the file will be udp-fr_FR.po.

Next, install the POEDIT software on your system. This software is available for all platforms and can be installed on Windows, Linux or Mac.

Once installed, open POEDIT and go to File->New, where we will enter our language code in the window prompt.

Click on the ‘Save’ icon, after which, the file explorer will open. Head over to the plugins languages directory and save it as the following: udp-fr_FR.po.

Now we are able to add the French translation for our plugin text. To do so, click on the ‘Extract from sources’ section.

This will open a catalog properties popup. We now need to configure the three following tabs: Translation Properties, Source Paths and Source Keywords. In the Translation Properties tab, add our domain ‘udp’ as the project name. Source Paths will be our plugin folder and we will add ‘__ and _e’ inside Source Keywords.

If you have multiple folders inside the plugin, then we will need to choose each directory individually.

After selecting the plugin folder you should see ‘.’ in the Paths section. Repeat the same process for other folders inside your plugin directory if necessary.

Under the Source Keywords, click on the + icon and add ‘__’ and ‘_e’ as a keyword and click the OK button.

In the next window, under Source text, you will have all strings available to translate from your plugin. Choose the string one by one and add your French translation to the string.

Once you add all translations, click on the Save icon. This will automatically save all your string translation in your udp-ft_FR.po file. Your .po file will now contain the following code:

#: udp.php:24 udp.php:25
msgid “UDP Setting Page”
msgstr “Page de configuration UDP”

#: udp.php:37
msgid “My Plugin Title”
msgstr “Titre de mon plugin”

Test Our Plugin Translation

We have now completed the task of creating .po and .mo files for our plugin. Now it’s time to test our plugin and check the French language translation.

First, download our language file from the following address:

WordPress Language repository.

For the French language, the path is as follows: and fr_FR.po

Download files from this link and store it in the wp-content/languages directory. Create the ‘languages’ folder, if it does not already exist.

Next, we need to change the default language of our WordPress installation. Open the wp-config.php file and add the language as follows:

define(‘WPLANG’, ‘fr_FR’);

Now if you go to the dashboard, your plugin should be displaying in the French language.

In conclusion

Creating a localized translation for your WordPress plugin can seem a little daunting and complicated at first. However the potential benefits of offering large non English speaking countries like Brazil, France and Germany your plugin in their native language can help open your plugin up to a whole new, appreciate audience. While it may seem like a lot of work, the rewards could be considerable.

The post How to localize and translate a WordPress plugin – An in depth guide for plugin developers appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

Google Drive – have you read those terms and conditions…?

If you’re a Google Drive user, this might be interesting to you. As part of our extensive preparations for Europe’s GDPR data protection law, we’ve been reviewing all our relations with suppliers, use of different tools, and things of that sort.

Personally, I’ve been using Google Drive, fairly lightly, for over a decade. As a company, we had been keeping some internal documents of use to our staff (guides on how to do this or that, policies for X and Y, etc.), and that sort of thing, on Google Drive. This grew out of using it to share documents when there was first more than one of us, and it’s worked reasonably well.

But no more. Today I learnt something new, as part of our GDPR preparations. Something I think Google must keep fairly quiet, because I don’t know how I’ve never learned this before. What did I learn? This little stunner: Google Drive’s terms and conditions forbid the use of Google Drive for any commercial/business purposes.

Did that surprise you? It did me. But it’s there in black-and-white:

Personal Use. By accepting these terms, you agree not to use Google Drive for business purposes; you must use the Drive service only for personal non-commercial purposes.

Well, well. I normally try to read as much of the “Terms and Conditions” as seem like they have something that isn’t “legal boilerplate” in it. But I never saw that one before.

I hope I didn’t bring you bad news! If you have to comply with the EU’s GDPR law, then it’s better to find out now than later, before GDPR becomes law… because of the above, you can’t form a legal “data processing agreement” with Google for Drive and thus can’t store any customer data there (our review did not find any on our account, by the way. (That’s not the only that their T & C look to be incompatible with the GDPR – e.g. “Our automated systems analyze your content to provide you personally relevant product features, such as customized search results, and spam and malware detection. This analysis occurs as the content is received, shared, uploaded and when it is stored”).

The good news, if this affects you for business backups you were running, and you decide to move away from Google Drive, is that UpdraftPlus, and especially UpdraftPlus Premium, support lots of other options, including several (e.g. UpdraftVault, Amazon S3, Google Cloud, Microsoft OneDrive for Business, Rackspace Cloud, Backblaze) explicitly designed for business use (or having a business version, like Dropbox), and several other generic protocols that are common in business (e.g. SFTP, FTP, S3 generic). So there are plenty of other options to look at.

David Anderson (lead developer)

The post Google Drive – have you read those terms and conditions…? appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

Getting the best from your support request

Looking for support?  Please go here:

Can you remember the last time you had to contact customer support? It probably wasn’t the most thrilling experience. It’s bad enough when something goes horribly wrong and when you struggle to get the right kind of help you need, it can be very stressful.

So here are tips to make it all as painless and efficient as possible:

Find the Proper Channel

Make sure you are contacting the right place to get help. Firstly, make sure you read through the FAQ section, which address the most common concerns.

Failing that, double check that you have the correct phone number or e-mail address to save delays in getting help. For example, when seeking help with a WordPress plugin, you should submit a support request from the forum on the plugin page. But if you have the Premium version of the plugin, you should seek the Premium support channel. Posting about a paid plugin on the WordPress forums is against the community guidelines, which means we’re not able to help even if we wanted to.

Communicate Effectively

It’s vital to express your problem as clearly and concisely as possible. This isn’t easy when you’re stressed, but taking a few moments to plan out your message means your problem can be dealt with more efficiently, without the need for endless back-and-forth communications.

  1. Number your Points – If you have multiple issues, or need to explain what’s happening in order, number them in a list.
  2. Anticipate the Answer – Don’t wait for a reply if you can guess what the solution might be. Instead, tell the Support Member what you think might be causing the error and offer as much supporting information as possible.
  3. Be clear and concise – Use as few words as possible. Re-read your message before sending to ensure it’s clear and concise.

Create a Test Scenario

The easiest way to show support what is happening is to demonstrate it, either through a step-by-step description or through a screenshot/ screencast. If the issue is on your website, try creating a test page to isolate the specific issue- and don’t forget to share the link!

If you can’t share your website because it’s still in development, you could create a temporary site and share that with us. Poppy Life is a great resource for this.

Provide Technical Details

Finally, provide as much technical information as possible. Because your issue may be unique, the more we know, the more likely it is we can help you. Provide answers to as many of the relevant questions below:

  1. What operating system are you using? Windows? Linux? Mac?
  2. What browser are you using? Chrome? Firefox? Does it occur in different browsers?
  3. Do you see any errors? Usually you will see errors on screen or in a console window. Learn how to find errors. One place might be in the developer tools.
  4. Can you provide the PHP version, server information (Nginx or Apache?), and any other specifics about your server?

Keeping these tips in mind will hopefully save you time and frustration. Technical problems can be a headache, but submitting a decent support request can make all the difference to how efficiently and effectively they’re resolved.

Below are a couple different examples of support requests to give you an idea of what to aim for- make sure you aim for something like the second one!

Bad Example

Dear Support,

My site stopped working after the latest update. Can you fix it please?

A Better Example

Dear Support,

After the latest update, I notice that when I click on the button to save my settings I am see an error telling me that the settings aren’t saved. This happens after I log in and take the following actions:

  1. Login to the admin area
  2. Navigate to the settings page
  3. Click on “preview”
  4. Change a setting
  5. Save

Do you think this is because of the changes to the preview button? If so, maybe it’s not compatible with my “older” version of WordPress? I’ve attached a screencast of the error.

I’m using Chrome on MacOS and my server is running nginx and php 7.2. Let me know if you need any further details.

Article written by Kevin Batdorf, one of the UpdraftPlus’ developers.


The post Getting the best from your support request appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

3 Rock Solid Ways to Boost Your WordPress Blog Performance

You’ve created a wonderfully designed WordPress page. But as good as it may look and feel, if it’s sluggish and takes too long to load, you can kiss your conversions goodbye and say hello to higher bounce rates.

In a world where the average consumer is busier, savvier, more demanding and less patient than ever, site performance really matters – a lot. According to Google research, more than half of all mobile site visits are abandoned if a page takes more than just three seconds to load:

Image source: DoubleClick by Google, “The need for mobile speed” report

Faster pages, on the other hand, see better conversion rates, longer engagement and generate more revenue for their owners:

Image source: DoubleClick by Google, “The need for mobile speed” report

Every element of your website takes up space and memory, all of which increase your upload time and decrease your page speed. The more memory you use, the more sluggish your website is likely to be.

For WordPress site owners in particular, this represents a real challenge.  WordPress sites are built on a basic shell, which is modified by choosing a layout template and then adding in various plugins. Each extra element means extra database queries and additional HTTP requests, every one of which slows down your page speed and diminishes a website’s performance.

Most of us might not even notice these tiny, incremental decreases in speed when we view our own websites, but even fractions of a second can add up, especially for mobile viewers. And considering that just one second can make the difference between an engagement and a bounce, improving the page speed is critical.

Fortunately, there are some easy steps you can take to reduce database space and speed up the loading time of your WP site, none of which require technical knowledge or coding skills.

We’ve come up with three ways to improve your WordPress blog’s performance speed and optimize its performance without compromising on design:

Remove Unnecessary Assets

When building a WordPress site, you’ll invariably end up with things you thought you might use, but later discover that you don’t really need; like that picture you had to add three times to get the sizing right, or that extra template you loaded but then changed your mind about. All of these extras can add up, so it’s important to do a bit of cleaning up:

  1. Start by going through your media library with a fine-tooth comb, removing any image files, videos, audio clips or other media files that you no longer need. If you have a huge library to go through, consider using a media cleaner plugin to make the job quick and easy.

Image source: Theme Fusion

  1. Remove any unused plugins. This is one of the fastest and easiest ways to reduce the size of your database and speed up your site performance, according to Jenni MicKinnon at WPMUdev. Rather than just deactivating them (which basically turns them off but leaves them in the database), it’s worth going through and deleting them properly:

Image source: WPMUdev

  1. Next, remove any unused templates. If, like most people, you built your own WordPress site, you probably tried a few (or many) different templates before settling on your final design. And all of those templates remain in your site’s database, hogging space and slowing things down. Get rid of them by clicking on Appearance > Themes then click on Theme Details for the theme(s) you want to remove. Then click on Delete in the bottom right corner.

One word of warning though – be careful not to delete the default WordPress theme, Twenty Fourteen:

Image source: Connected Systems

“The reason is,” explains Rich Plakas from Connected Systems, “if one of the other 3rd party themes gets corrupted, either from a bad update or from you modifying theme files, you will experience the ‘WordPress White Screen of Death.’ Leaving the default theme gives you an easy way to get the site running again.”

  1. Finally, delete all unnecessary HTML and extra code. If you have a pretty good understanding of how site coding works, there are a number of plugins you can use to clean up your code. But as Joe Foley of WPMUdev warns, “only those who know what they’re doing with HTML should use these plugins. Otherwise you may permanently change things you didn’t want to change.”

Keep your WordPress blog Updated … and Secure

Updating may seem like a small thing, but it’s one of the most overlooked elements of site performance on any WordPress site. Like a smartphone, it requires these regular updates to ensure its operating system and applications stay up-to-speed and offer the latest features.

WordPress automatically pushes out updates on a regular basis. Each update provides new features and mends underlying security issues and bugs. Your WordPress theme and plugins may have regular updates, too; check in on your Dashboard frequently, and be sure to update whenever prompted. Failure to do so may make your website slow, unreliable and vulnerable to security breaches.

Image source: Theme Fuse

Keep in mind that WordPress is notoriously vulnerable to security problems. Relying on the WordPress updates alone are not really enough to keep you protected in the event of a crash, hack or other system melt-down.

To give you an idea of how big a problem this really is, check out WPScan’s vulnerability database, which lists real-time reports of current vulnerabilities in the WordPress core code, plugins and themes. As you can see from the 9,000+ vulnerabilities in the screenshot below, an unprotected site is at constant risk:

Image source: WPScan screenshot, taken September 27, 2017

With that kind of risk exposure, many experts recommend using a WordPress backup plugin that can protect you from hackers, server crashes, bad plugins, and even user errors. If anything goes wrong, you’ll be able to easily restore your site to full working order.

Adopt a CDN

When optimizing for speed, it’s important to consider the distance your potential viewers are from your server. If you have a global audience with visitors coming from anywhere in the world, you’ll probably want to install a Content Delivery Network or CDN.

“Basically, it’s a bunch of highly optimized servers all across the world, with a bit of unique logic worked into them: you’ll always hit the server that’s closest to you,” explains Joost de Valk , the founder of Yoast and a go-to source for site optimization and SEO. “This leads to huge performance improvements for sites that have visitors from all across the world.”

Basically, CDNs are used to prevent the issue of latency, which is an irritating delay that happens from the point when you request to load a web page to the point where the content appears onscreen. Latency, as you may have guessed, slows site loading speed down and has an adverse impact on site performance.

Image source: WP Beginner

Installing a CDN on your WordPress site will help to ensure that it continues to perform well and load quickly, keeping visitors happy, wherever they happen to be. You can find CDN plugins on; or, check with your hosting provider. Many of them provide CDNs at no or minimal costs.

Good site performance begins with cleaning out your assets, keeping your software updated, and using a good CDN for fast delivery. Once you get these basics down, you will be on your way to maintaining a high quality user experience and building a long-lasting relationship with your audience.

Finally, one of the quickest and easiest ways to maintain a website that runs at optimum efficiency is to download WP-Optimize, a plugin that automates the otherwise technical and time-consuming task of cleaning up your WordPress database by removing old revisions, spam and trash. It’s designed with a load of useful features such as automatic weekly cleanups, the retention of a certain number of weeks of old data, database table stats to show how much space can be cleared, the enabling/ disabling of trackbacks and comments for published posts, and restricted access for Administrators only. Owned and run by UpdraftPlus, this plugin has a solid half-a-million strong user base, and a host of new Premium features in the pipeline.

Article written by Dvora Goldstein, professional blogger and content marketer.


The post 3 Rock Solid Ways to Boost Your WordPress Blog Performance appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

Maintenance Checklist for Bloggers

By Cathy Tibbles
– Guest post –

Have you ever looked at the cobwebs building up in a dark corner somewhere and wondered where, on earth, they came from? And don’t tell me it’s a spider, because you can’t see a spider!  But you know it was there cause the proof is in the gifts left behind!

Every so often, a blogger will come to us, with a sneaking suspicion that something’s wrong with the site: things are slower than before, there are notices in the dashboard, other people talk about things they’re not familiar with, like SSL and caching. There is no malware, there are no ‘spiders’ per se, but things just don’t work like they should.

Friends, I have your maintenance checklists today – just for you – the blogger. And you’ll be happy to learn its far easier than your real life cob-web cleaning checklist.

Let’s start with the seasonal checklist – if this stuff is kept up to date, you won’t have a problem going forward.

Seasonal Maintenance Checklist for Bloggers:

I recommend you do this 3-4 times per year.

check backups, make one extra just before going through the list
check antivirus software on all computers with access to your dashboard
upgrade plugins, theme, then WordPress
change admin passwords
delete all administrators that don’t need access
check caching is installed and configured if necessary
check SEO plugin & settings
run virus scan using
 run speed check with
Google Analytics:
working properly
Google Search Console:
check messages and/or errors
check sitemap is submitted & error free
Host Company:
check your current account storage against the amount in your package
check the error logs
get a mani – pedi

Monthly Maintenance Checklist for Bloggers:

create extra backup before proceeding
download backup to your hard drive
upgrade plugins, theme, then WordPress
check database optimization plugin is working correctly (we recommend WP Optimize)
check image optimization plugin is working correctly (we recommend short pixel)
check for broken links in Google Search Console – crawl tab & fix them
check for spam and delete
test contact form
get a latte

Weekly Maintenance:

if upgrades needed, then check backup is working
upgrade plugins, theme, then WordPress
check Google Analytics to make sure referrals are still coming from Social Media (nothing’s wrong)
check Google Analytics to be sure you catch a spike in any SEO performance and capitalize on it
check that any scheduled posts went out
answer any comments
have a cupcake

Daily Maintenance (or on Publish days):

check the last backup did not have errors
upgrade plugins, theme, then WordPress if necessary
check that all images have alt tags & titles
check for no-follow tags if you are compensated for links
pour yourself a glass of wine

I know this seems like a lot – but save yourself the money and headache that goes into troubleshooting an issue that could have been prevented!  These checklists are only laborious the first couple of times, after that you’ll get a feel for the areas that you need to check, and when. As long as the site is backed up and upgraded, you really can’t go wrong!

If you have any questions, or want someone to run through the Seasonal list for you, feel free to contact the friendly girlfriends at WP Barista!

The post Maintenance Checklist for Bloggers appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

Wannacry ransomware

You’ve probably heard all about the Wannacry ransomware that’s been spreading like wildfire across computer networks since last Friday- the one that encrypts computer files, demands a ransom (that doubles within 3 days) and threatens to delete the files in 7 days if the ransom isn’t paid.

So far, it’s affected over 200,000 computers in 150 different countries. By this morning, people had paid just under £30,000- but the true cost in terms of lost time, lost data and lost business is much greater. Germany’s rail network Deutsche Bahn has been affected, as has the Spanish telecommunications operator, Telegonica, French car producer Renault, US Logistics Company FedEx and even Russia’s Interior Ministry. The attack on 61 of the UK’s NHS trusts has resulted in huge disruption to services and delayed or cancelled operations, putting people’s entire lives at risk.

This attack wasn’t specifically targeted at any particular groups or individuals, but just a faceless virus let lose by cybercriminals with no thought of anything but their own profit. The reality is that because we all depend on technology, personally and corporately, our vulnerability runs deep.

Reports of attacks have slowed down, although experts are warning that we shouldn’t expect it to have gone away just yet. A 22-year-old security researcher became an “accidental hero” when his registering of a domain name to track the virus’ spread ended up putting a stop to it. But even he expects that it’s not over: “The attackers will realise how we stopped it, they’ll change the code and then they’ll start again. Enable windows update, update and then reboot.”

This attack is unprecedented in scale. It exploits a flaw in Microsoft Windows that was identified by the US intelligence- but not sufficiently guarded. Microsoft’s Chief Legal Officer, Brad Smith said: “The governments of the world should treat this attack as a wake-up call.”

Keeping up with schemes that endlessly increase in scale and sophistication is a huge challenge. Of course, major security flaws represent potent ammunition for online terrorists and should be more carefully guarded.

But the truth is that every single person who uses a computer has a responsibility to have a basic understanding of the risks. Everyone should practice basic cyber security.

Here are the basic security measures we recommend that everyone should implement:

• Back up your files.
If your files are stored in the cloud and not just on your computer, you’re not going to be held to ransom. Store data on external servers like Dropbox and Google Drive this makes it easy to restore the latest version of your files.

• Use antivirus software
This will scan files before they’re downloaded. It should also block secret installations and seek out malware that may already be on a computer. If you don’t already have it, enabling Windows Defender is free and effective.

• Install updates!
This is vitally important, since new versions of things like Microsoft Windows fix exploitable vulnerabilities. You can set up alerts to inform you when there’s a new release. If you use Windows, make sure you install the patch that’s been released to block the specific exploit that the Wannacry software is using.

• Be suspicious!
If you receive an unsolicited email, be suspicious! Don’t open it, and certainly don’t click on any links. The same applies to adverts and unfamiliar websites. Don’t download apps that haven’t been verified by an official store, and always look at reviews.

Wannacry doesn’t seem to affect website files, but there are plenty of other viruses that do. Viruses are getting cleverer and firewalls and security software can’t protect against everything. The best way to have peace of mind is to back everything up as that protects against every kind of threat. So if you have a WordPress site, make sure that you install UpdraftPlus today.

The post Wannacry ransomware appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.