WordPress Language file is not being loaded

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:

Read More
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?

Related posts

Leave a Reply

1 comment

  1. 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'); ?>