1
votes

I have done the following:

  • Wrapped all my non content managed string translations in __() or _e() functions.
  • Added the following to my function.php file:
//Add localisation
load_theme_textdomain('whitelabel', get_template_directory() . '/languages');
//Set locale
$locale = get_locale();
$locale_file = get_template_directory() ."/languages/$locale.php"; 
if ( is_readable( $locale_file ) )
require_once( $locale_file );
  • Used POedit to create a translation file and have a test translation to see if it's works but nothing is displayed either.
  • Checked my PHP info for gettext to make sure it's enabled.

    However all I see on page is blank spaces where the translations functions are. It should be defaulting to that text right? Which is English.

What am I doing wrong? I've spend a lot of time looking in to this. By the way I'm not totally sure what $locale.php is about but removing it makes no difference. To me it seems like a problem with the functions.

Thanks in advance.

1
Consider the following: $textdomain = load_theme_textdomain(...); var_dump($textdomain);. If the function succeeded it should print true. Is it so?Ofir Baruch
I tried that and it returned 1 so true.Cool Hand Luke

1 Answers

0
votes

Turns out that I had a PHP error on a page that was blocking the rest of the translations.

Problem is now solved. I also noted a few instances where __() had been used where _e() should have been.