WordPress site not translating after adding .mo and .po files to the theme's lang directory

16 views Asked by At

I have a site with a theme that I want to translate. The theme had a .pot file so using Poedit I created lt_LT.po and lt_LT.mo files. I placed both files in my theme's /lang directory. Text domain is "simppple".

Unfortunately, when I change WordPress site's language to lithuanian the site does not translate, it is still in English.

What could the problem be? This is my themes's functions.php file:

<?php
if (!defined('ABSPATH')) {
    exit;
}

define('SIMPPPLE_IS_VITE_DEVELOPMENT', false);

/*
 * ================================
 *  THEME FUNCTIONS
 */

require get_template_directory() . '/inc/vite.php';
// Front assets
simppple_vite_enqueue_script('/assets/js/front.js', 'wp_enqueue_scripts', 'wp_footer');

// Admin assets
simppple_vite_enqueue_script('/assets/js/admin.js', 'admin_enqueue_scripts', 'admin_footer');

// Editor assets
simppple_vite_enqueue_script('/assets/js/editor.js', 'enqueue_block_editor_assets');

// Theme customization
require get_template_directory() . '/inc/theme-customization/wp_customization.php';
require get_template_directory() . '/inc/theme-customization/theme-remove-default-settings.php';
require get_template_directory() . '/inc/theme-customization/color-add-rgb.php';
require get_template_directory() . '/inc/theme-customization/color-add-hsl.php';

// Patterns
require get_template_directory() . '/inc/patterns/categories-register.php';

I tried adding some code at the beggining of functions.php file:

function my_theme_load_theme_textdomain() {
    load_theme_textdomain( 'simppple', get_template_directory() . '/lang' );
}
add_action( 'after_setup_theme', 'my_theme_load_theme_textdomain' );

but it did not help.

0

There are 0 answers