2

I seem to have a problem loading Wordpress language files into my custom theme.

In functions.php I have the following code in my setup:

load_theme_textdomain( 'theme_textdomain', get_template_directory() . '/langs' );

In my stylesheet I have the textdomein defined:

Text Domain: theme_textdomain

In my theme folder I have a folder /langs with 2 different file types:

en_GB.mo nl_NL.mo

Default language of my theme is nl_NL.

In one of my templates I use:

<?= __('Zoeken'); ?>

Just to test I added a translation of this in both language files:

For en_GB = search, for nl_NL = zoeken2. However, both nl_NL and en_GB are not being loaded by the theme. What I'm I doing wrong?

Redox
  • 981
  • 3
  • 12
  • 29

1 Answers1

4

I think you need to specify your theme domain in your call to the __() function. I don't think it's picked up automatically from your stylesheet header. So rather than

<?= __('Zoeken'); ?>

try

<?= __('Zoeken', 'theme_textdomain'); ?>
Hobo
  • 7,536
  • 5
  • 40
  • 50