Encourage community translations for WordPress.org plugins

Plugins and themes hosted on WordPress.org are, as of December 5th(-ish) 2015, translateable through translate.wordpress.org.

This opens up for a lot of interesting new interactions for existing, and potential new users, who may not be fluent in English, and have not yet picked up your plugin or theme for this reason alone.

So, your plugin is now up there, it can be translated…but how do you encourage your users to participate and translate the plugin?

I threw together a snippet for just this purpose, it may not be for everyone, but I do believe it’s a fairly safe starting point for most people.

The code requires some minor edits before you use it (technically only one edit is required, the text_domain one);

  • $plugin_slug in the get_option and update_option calls should reflect your own plugins slug
  • $text_domain needs to match your plugin slug (adn the langauge path ideally, just like your normal textdomain loading function)

The snippet follows the plugin guidelines for nag screens (dismissable and will stay dismissed, yay!), so you can use it as is, or you can modify it (it’s just a way to get the ball rolling really).


Caveats (before you say it’s broken);

  • The code must be in your main plugin file, this is due to the get_plugin_data call being used
  • The nag screen is per language, so if the user changes their language, they’ll get a new nag screen (possible yay, possible nay?)
  • No nag screen is shown if a translation file actually exists for the current language, if so the nag screen is automatically disabled

I also added in text domains to the nag message, this is so you can utilize it even if you decide to remove the disable nag checker, and want to display a translated message to your users, one idea here is to show a “You’ve used this plugin for 1 week, please consider helping with translations” kind of message, or any other approach you feel is valid.


The Lofoten Islands, Norway

I will never forget my first siting of Lofoten. Tall craggy peaks fringed with snow jut out of the Arctic Ocean like some kind of ancient monster. They appear so inhospitable from the sky (and the land for that matter) that you wonder how humans have managed to survive here for 6000 years.

Source: The Lofoten Islands, Norway

Tom Archer has captured some amazing pictures in Norway, they seem almost otherworldly and I absolutely LOVE them!

Fun with fail2ban and WordPress

We run some webservers at work as a part of the services we offer our customers, we’re not a large host by a long shot, but we still get a large amount of brute force attacks against the WordPress installs we run.

I’ve been monitoring the servers and just manually dealing with them using a quick firewall block whenever I’ve seen these in the past, but unfortunately we’ve passed the point of this being a viable solution.

Enter fail2ban.

Continue reading

I love joined subqueries in MySQL

So I was looking into ways of improving the load times of a project, and knowing SQL is one of my biggest weaknesses (in my own humble opinion), I figured there might be a fair bit to gain by researching a bit around it, which lead to a friend linking me to http://www.chrislondon.co/joins-vs-subqueries/

Judging by his benchmarks on a low amount of data points, he discovered a massive leap between a subquery and a joined subquery. I’ve been using join statements all along (and in some cases multiple queries like the schmuck I am) so I figured it was worth giving this a shot on the data I was working with. I mention the data points as it was put up in the comments that the amount of data he queried against was very low, I hit mine against ~50 000 rows of data

Continue reading