Category Archives: Languages

An accent for your website

Have you ever wanted to change the original text for a plugin?  Do you have an audience who would respond to their unique way of speaking being used on your website?

Even if you’re english and it’s in english you can still “translate”.

WordPress is so amazing when it comes to language support (if theme and plugin developers have done their job well)

  • it will use a language file if it finds one
  • it will use a translation if there is one, else will revert to the default language
  • it allows for variations of language (en_US, en_AU etc)

So if you want to talk strine, BBC, cockney, singlish, na’vi or Klingon,  for at least some of the phrases in a plugin or theme, it’s easy. (I’n not bunging it on, you Can la!)

Update on 2016 October 7th:  This is all much easier now with the use of a plugin like      Simply ensure that the language for which you are adding a new text / translation is one which is either the main wordpress language or selectable by your users.

Already have system translations in that language?

You may need to override existing translations

  • Drop the code at the bottom of the post into your plugin or theme’s functions.php.
  • Decide which locale code to use-  the default wordpress language for your site (for English it is en_US) or  a variation ? (en-GB, en_au ) .  If not using the default you will need to change your  wp-config.php file to tell your wordpress your preferred locale.
  • Create a translation file with just the texts that you want to translate.  For example using loco translate or code styling localisation plugin (old, still works for me)

    1. Select the theme or plugin,
    2. click add new language and enter the locale code.  It will appear in the list of language files for that plugin or theme or wordpress core
    3. click edit against the language
    4. Scroll to the texts you want to  change or “accentise”
    5. Enter your text as the translation, SAVE
    6. after you have entered your translations, most important – generate the .mo file
  • Put the .mo file into your wp-content/languages folder
Screen shot of language folder

the link to clickenter a translation

It’s a link text, and here it is

the translation in action

Don’t like the menu text ? translate it!

Change the menu text

Have some fun!

Just pick a few key phrases (they must be translateable) to make an impact.

Your website could talk like a pirate just for a day – drop the .mo file in on the day and delete it afterwards!

Danger of upgrades

An upgrade may overwrite your translations, so save it somewhere other than the main plugin language folder .  The amr-events plugins looks for language files with the plugin language text domain in the wp-content/languages folder before looking in the normal place.

The loco translate plugin offers you choices as to where to save your translation files.

Locating your language file for the amr-events plugins in the wp-contents/language should be safe from upgrades.

For other plugins you could write a quick filter function to point to your special file.  WordPress now has several filters that can be used.  The best for this purpose may be:

$mofile = apply_filters( 'load_textdomain_mofile',
                     $mofile, $domain );

Suggested Filter Function

if (!function_exists('amr_load_custom_text') ) { // for filter
	function amr_load_custom_text( $mofile, $domain='' ) {
	//only do for the plugins/themes you want
	if (!in_array($domain, array('amr-ical-events-list', 'amr-events')))
        return $mofile;

    $pathinfo = pathinfo($mofile);
	$custom_mofile = WP_CONTENT_DIR."/languages/" 
            . $pathinfo["basename"];
	if (file_exists($custom_mofile)) 			
			return ($custom_mofile); 
			return $mofile;
add_filter ('load_textdomain_mofile','amr_load_custom_text',10,2 );

Works a treat!