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

<h2>My Plugin Title</h2>

Type 2

<?php echo 'My Plugin Settings'; ?>

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: <code>_e()</code>.

The above code should be written in the following way:

<h2><?php _e('My Plugin Title', 'udp'); ?></h2>


<?php echo __('My Plugin Settings', 'udp'); ?>

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.


Plugin Name: UDP
Description: This is a sample plugin to test for plugin text domain
Author: Editorial Staff
Version: 1.0
License: GPLv3 or later
Text Domain: udp
Domain Path: /languages

if (!defined('ABSPATH')) die('No direct access allowed');/**
* Load plugin textdomain.
function udp_load_textdomain() {
load_plugin_textdomain( 'udp', false, basename( dirname( __FILE__ ) ) . '/languages/' );
add_action( 'init', 'udp_load_textdomain' ); 

function udp_menu_page() {
__( 'UDP Setting Page', 'udp' ),
__( 'UDP Setting Page', 'udp' ),
add_action('admin_menu', 'udp_menu_page');

function udp_setting_page() {
<h2><?php _e('My Plugin Title', 'udp'); ?></h2>

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:

French WordPress Language repository. 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.

5 ways you can set up a profitable side hustle using WordPress

With the stresses and demands of modern life, most working-aged people are perfectly happy to sustain and manage just one full-time job and while there isn’t anything inherently wrong with having just one arrow in your professional quiver, it can leave you open to being at the whims of the unexpected. What would happen if your best-laid plans went awry? One moment you’re gainfully employed, the next the company you work for has gone bankrupt and you’re wondering where it all went wrong, as you try to keep the wolves away from the door and do your best to chart a course back to a full-time income

There’s also the prospect of creative stagnation. Even if you enjoy and excel at what you do to an extent that you don’t need to worry about being fired or made redundant, do you really want to do the same thing over and over again for years to come? A lack of variety and new challenges can eventually sour you on something that you originally loved, and leave you feeling unfulfilled in your working life.

Enter the side hustle. Thanks to the internet, more and more people are now making their hobbies, interests and innovative business ideas pay off. By setting up a business  in your free time, it is possible to pick up some extra cash and alleviate the daily grind. This may sound like a lot of work and effort, but by using WordPress as your primary platform, it doesn’t need to be. Here’s how you can WordPress to get moving in the right direction:

1. Create your own inexpensive website

In many cases (perhaps most), if you are setting up a side hustle, you will not have huge sums of money with which to hire professional web designers to build the site. Simply finding the time to work on your new site can be challenging enough with all the existing commitments most people can have. It can be easy to either spend lots or create debts of many thousands when attempting to launch a dream project, but with up to 96% of businesses failing within 10 years, it is worth cutting your cloth appropriately.   

As WordPress is a free platform, you can keep the costs to a minimum by only paying for the hosting and any paid plugins or themes you deem necessary. Where many other easy site-builders are free initially, they eventually start charging a monthly fee. With WordPress you don’t need to worry about unexpected costs. 

2. It’s a great base for dropshipping

Although it has been around for a while, dropshipping is an incredibly popular (and thus very competitive) side hustle. This type of side business is still a viable option for entrepreneurs – holding a place among the best side hustle ideas. The idea is a very straightforward one: instead of creating or buying products, stocking them, selling them and shipping them out (or making them available for collection), you list items from third-party suppliers and let them handle any resulting sales.

Where does your profit come from you may ask? It comes from the markup you place on those products. You find something sold at a particular price and then list it on your site at an increased price. You can think of the price increase as either a curation charge  or maybe a finder’s fee. WordPress is a great platform for setting up a dropshipping site. Just set up the free WooCommerce plugin, then connect it to one or more of various dropshipping services (read more about them here).

3. Giving you the freedom to experiment

Not only is WordPress free, it is also open-source. This means that you are able to make fundamental changes to how the system works. If you work in development and have the skills to do so (or you’re willing to bring in a developer to help), you can customize your site in ways that aren’t possible on other platforms.

You can change themes to suit your personal preference, add creative features and chop and change as you see fit. There are no rules to follow or specific standards to meet and should something go wrong, you can just restore a backup using UpdraftPlus. This is important when you’re trying to build your side hustle, as you’re unlikely to hit upon a winning formula right away. 

4. Always keeping mobile in mind

For quite some time now, default WordPress themes have looked and worked excellently on mobile devices, with the breadth of free themes available online providing website owners with nearly-boundless options. This is vitally important when you’re trying to establish a website based business, as mobile customers made up 58% of all website site visits in 2018.

Couple this with the massive selection of monetization plugins for WordPress that go beyond just dropshipping (selling digital resources, accepting gifts and donations, book consultations, etc.); you have all the necessary ingredients for reaching and profiting from a potentially huge audience. Given that there are still numerous websites that look decidedly clunky on smartphones, this isn’t something to be taken lightly.

5. A supportive community

Starting completely from scratch isn’t the easiest way to go when building a side hustle business. Taking your destiny into your own hands and starting a project that’s wholly your own may sound romantic, but it isn’t practical. There are so many things that can go wrong during the startup process that you can easily fail before you have even got going if you are not careful.

Due to the general difficulties involved in launching a new side hustle, it is always a good idea to seek out an entrepreneurial community that can help you get through the tough times. WordPress has a vast and helpful community of entrepreneurial types spread throughout the world. If you make an effort to be part of it, you’ll find that there’s a huge amount of great advice on offer for free, covering both website development issues and general entrepreneurial roadblocks.

A WordPress site will save you money, neatly support the powerful dropshipping model, allow you to experiment safely and freely, give you access to a huge supportive community and work perfectly on mobile devices. 

The post 5 ways you can set up a profitable side hustle using WordPress appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

How to increase security while developing a WordPress site

Sixteen years after its release, WordPress is the most popular content management system (CMS) in the world and currently powers around one-third of all sites on the web. As WordPress become more popular, it increasingly draws the attention of hackers who are eager to access the valuable information contained within a website, which in turn makes WordPress increasingly risky to use. 

According to an ongoing study and analysis conducted by EnableSecurity founder and CEO, Sandro Gauci, more than 70% of WordPress installations are vulnerable to cyber attacks. There are two main reasons for this:

  1. Users continue to use outdated WordPress software that is not equipped to handle the latest cyber threats.
  2. Users do not install any type of security measures to protect their websites from hacks. 

There can also another reason why WordPress sites are vulnerable to attacks. Users often install apps that do not provide full protection against destructive online activity. Developers may implement malware detection or a virus protection app to help with the security of the site, but these types of protective apps do not provide complete protection from all cyber threats and they do not actually prevent an attack. Instead, these apps typically work by dealing with the attack during or after its occurrence. 

What can WordPress site builders do to increase security while developing a WordPress site? 

Let’s explore some options below.

1. Use a virtual private network (VPN)

The best way to protect a WordPress site is to use a VPN service.

What is a virtual private network? 

A virtual private network (VPN) is at its core, an encrypted connection over the Internet from any IoT (Internet of Things) device to a private or public network. There are several ways a VPN provides this protection, ultimately preventing unauthorized users from accessing any device throughout the network. If a hacker cannot access a device or break the encryption, then they are unable to break into the WordPress site. 

Virtual private networks are widely used by individuals and companies alike because it is by far the most effective way to secure a network and all the digital assets and users contained within it. The main features of a VPN include:

  • Endpoint security through virtual tunnelling – Data is encapsulated and untraceable or unreadable.
  • IP masking – The WordPress site IP address (or user IP address) is given a different location in a remote area, while the actual IP address is hidden from the hacker.
  • All traffic and data are encrypted so that a hacker or other entity cannot read it.
  • All developer activity on the WordPress site during development is untraceable since the VPN keeps no records or logs of activity.

2. Find a reputable hosting provider

The simplest way to protect a site is to find a reputable hosting provider that also utilizes multiple strategies for security. Many hosting providers use VPNs to keep their data and users safe. 

Users should take care to avoid cheap providers that offer eye-catching savings. While the user may save money on the front end, the cost of using an unsafe provider could be devastating in the long run. A users WordPress data could be vulnerable to ransomware, spyware, viruses, or phishing. 

There are several options for choosing a safe WordPress hosting service. Experts and users generally recommend the following hosting services:

  • HostGator
  • A2 Web
  • DreamHost
  • Hostwinds
  • Liquid Web
  • 1&1 Ionos

3. Install a top WordPress security plugin

WordPress offers a wide range of security plugins from third-party providers that can add an additional layer of security to the site. Plugins can regularly monitor the site for strange code or unauthorized access to the account. They also offer such features as:

  • Audits for suspicious activity
  • Monitoring the integrity of files
  • Malware scanning & detection
  • Monitoring for blacklisted items
  • Tightening security in certain areas of the site
  • Hack detection & response
  • instant alerts & notifications
  • Website firewalls

Many of these plugins should only be used as a supplemental security measure. While they may be reliable, they do not prevent hacks. They only monitor the website and act as an intrusion detection system (IDS). A VPN is a better option for actually preventing a cyber attack. 

4. Create an impenetrable password

Most passwords manually created by users are weak. Why is this? They are often predictable, too short, or they contain a logical sequence of letters and numbers. For instance, most users create passwords that start with a capital letter, have 8 to 11 letters which is then followed by 2 to 4 digits. This combination of letters and numbers makes it relatively easy for hackers to figure out the password.

The best passwords are at least 10 digits long and use a jumbled combination of numbers, symbols, and letters that make no logical sense and have no connection with the user. The more complex the password, the more secure the WordPress site. 

5. Get an SSL certificate

No website should exist without a secure sockets layer (SSL) certificate. But what is an SSL certificate? 

An SSL Certificate is a small data file that attaches a cryptographic key to the website / company details. Once the SSL is installed on the web server, it activates a digital ‘padlock’ or HTTPS protocol which virtually guarantees a secure connection from the server to the browser. SSL certificates are valuable for WordPress site builders who plan to operate an eCommerce store, engage in substantial data transfer, or create a site that will host lots of interactive features. 

SSL is mandatory for any WordPress site where the owner requests to store private or sensitive data such as account setup or payment information. SSLs also prevent data from being delivered in plain text, which would make it much easier to hack. 

With all the security threats that endanger websites today, WordPress site developers should take multiple precautions for securing their sites. Start by using a VPN to create a barrier around both the site and the network. From there, developers can use practical methods such as finding a reputable host, using sensible passwords, and utilizing security plugins. Every bit helps to ensure that a website is safe for all who visit.

Add two factor authentication and UpdraftPlus plugins

The post How to increase security while developing a WordPress site appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

Merry Christmas 2019

In previous years, we’ve shared some favourite versions of the classic Christmas carol, “O Holy Night”. It’s time for another! This is a beautiful Celtic version, with a beautiful voice, harp and violin. A happy Christmas 2019 to all our users!

Behold your king, before him lowly bend

David Anderson (lead developer)

The post Merry Christmas 2019 appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

Using AR & VR content on a WordPress website

Virtual reality (VR) continues to rise in popularity as the previously prohibitive expensive hardware needed to run it becomes more affordable. Companies are investing heavily in its expansion and increased appeal by creating dedicated media, games and building rich marketing experiences that utilize the technology. With each passing year as computer processing and internet speeds become faster, VR comes closer to fulfilling its awesome potential, with the next leap in the technology promising to be the most significant.

Augmented reality (AR) is even farther down that path. AR has been a viable platform and has been in use for quite some time to often huge success with smartphone apps such as the massively popular Pokemon game. AR can also be used to preview physical products in real-world environments, provide informative overlays for directions, or even participate in the use of shared digital environments.

At the other end of the spectrum is something that’s been mainstream for years: WordPress. A website platform with incredible versatility through its robust feature set and wide-ranging flexibility. WordPress can be used to construct the most basic beginners blog, all the way up to a super professional high-end business website. WordPress users of all types love choosing from the countless available plugins and themes to customize their sites and experiment with new tools and methods.

But what happens if you want to bring these two things together? Enhancing the fantastic WordPress experience with some AR or VR content sounds like a good idea in theory, but it raises a vital question: Such as, does AR/VR currently fit and work on a WordPress site? Let’s take a look:

What VR and AR content actually involves

Before considering how well AR/VR works in WordPress, it’s worth thinking about what they actually encompass. Given that VR is still essentially in the development phase with relatively low levels of ownership and a surfeit of confusing options (even those who do own a VR headset, only uses it occasionally), you might wonder why it’s worth the time to invest in this new sector – as such we need to find a satisfactory answer.

First let’s look at the VR/AR divide. A clear distinction is commonly made between VR and AR, with VR aims to replace the world around you while AR adds to it. But it isn’t quite this simple. What if you have a VR environment that draws from real world elements? Is this VR and AR? In truth, the future of VR lies in AR headsets, so AR content is essentially VR content.

This is a lengthy way of establishing that it’s easier to place a variety of content types under the broad “VR” umbrella, including 360-degree video, AR stickers, and instructional overlays.

What AR and VR can bring to WordPress

Some CMS developers have been vocal about investing in 3D content for VR and AR. In the eCommerce world, Shopify is a prime example of this, even announcing native 3D model storage for its store hosting system in early 2018 ( coupled with a rich lineup of existing video editor integrations). In addition to this, there has been plenty of progress elsewhere.

You might assume that progress is limited to hosted platforms, but what if existing plugin development could make WordPress (extended through WooCommerce) a more captivating prospect? As it happens, we can say exactly that – because it’s true.

The VR Shop is a new site, that while still in the early stages of development, allows the creation of a completely virtual store to be explored using a VR headset. While it’s compatible with various platforms, it already works with the WooCommerce plugin due to the massive popularity of WordPress.

Given that so much of the web runs on WordPress and how unlikely this is to change in the near future, it makes total sense that any company that aims to get ahead with VR website functionality would ensure it worked smoothly with WordPress.

If you want to use other VR related features such as 360-degree videos in your WordPress site, this can already be achieved by using suitable VR plugins (the same can also be said for AR previews). Since it would be foolish for VR content creators not to specifically cater to such a popular platform with such a large market share, it’s clear that the future for VR content on WordPress is exceedingly bright.

There’s even a full WordPress theme entirely dedicated to AR for eCommerce: it’s called Ozisti, and it uses an attached plugin developed for WordPress to enable the use of AR previews. If you want to give it a try, the AR service starts with a 14-day free trial for you to explore. Alternatively you can stick to the 360-degree video route and use a suitable plugin to position it on your homepage and set it to auto-play for maximum effect.

Conclusion on the future of VR and AR on websites

As previously stated, one of the biggest uses of VR online outside of traditional media and gaming will be creating virtual stores to bridge the gap between brick-and-mortar retail and eCommerce. The current WordPress VR Shop is merely a hint at what’s to come. One day people will be able to use powerful AR and VR interfaces to visually browse virtual stores and place items into their home to both preview and order them.

There’s also the matter of accessibility however as many VR systems are prohibitively expensive and require high end PCs to use all the features as intended.

Should you add VR and AR content/features to your WordPress site? Absolutely – With the system’s continued growth in popularity, you can rely on VR and AR companies to bring the medium into the new decade. Keep an eye on available plugins and to follow updates regarding AR and VR. The next decade should be interesting!

The post Using AR & VR content on a WordPress website appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.

UpdraftPlus support for Linode Object Storage

UpdraftPlus is always searching for new and reputable partners that we can recommend to our users. With websites and databases getting larger and larger, reliable cloud storage is one of the most important factors to consider when setting up your site. 

Linode is the largest independent open cloud provider in the world, with 10 global data centres worldwide that serve over 800,000 developers and businesses and offers valuable cloud services to new innovators, growing teams, startups and larger enterprises.

The company has taken the lead in open cloud provider services and has been at the forefront of innovation, making cloud services more simple, affordable and accessible. It also works well with UpdraftPlus as you can use Linode S3 compatible Object Storage for all your WordPress backups, big data and data archiving needs.

They offer a wide range of object storage and pricing plans for your needs, ranging from just 250GB, up to 10TB.

For in-depth details on how to use UpdraftPlus with Linode Object Storage, please read this guide.

The post UpdraftPlus support for Linode Object Storage appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.