Title: learnee's Replies | WordPress.org

---

# learnee

  [  ](https://wordpress.org/support/users/learnee/)

 *   [Profile](https://wordpress.org/support/users/learnee/)
 *   [Topics Started](https://wordpress.org/support/users/learnee/topics/)
 *   [Replies Created](https://wordpress.org/support/users/learnee/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/learnee/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/learnee/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/learnee/engagements/)
 *   [Favorites](https://wordpress.org/support/users/learnee/favorites/)

 Search replies:

## Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/page/2/#post-18143935)
 * **Tim W, thank you very much** for your patience and work.
   For me personally,
   the solution for now – is to add the find_textdomains_from_files function to 
   my scripts.I hope the WordPress developers will also want to look into the situation
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/page/2/#post-18143806)
 * Good day. Unfortunately, I continue to see a problem on the my test site.
 * The plugin sees the language translation file for my plugin (Eagle Booking). 
   But it does not see the theme translation (X Blog).
 * I updated to version 2.6.14 – it does not help.
 * The test site is pure WordPress. Only two plugins are installed: Loco Translate,
   Eagle Booking. Only one theme is installed: X Blog
 * Is this a problem only for me?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/page/2/#post-18139416)
 * A **working ‘crutch’** that restores the plugin to work.
   Add this code to the
   end of the /wp-content/plugins/**loco-translate/loco.php** fileBy changing if(**
   true**) to if(**false**) (at the beginning of the code) – it is easy to enable/
   disable the script
 *     ```wp-block-code
       if(true) add_action('init', function(){    // Paths for language files    $plugin_custom_path = WP_CONTENT_DIR . '/languages/loco/plugins/';    $theme_custom_path = WP_CONTENT_DIR . '/languages/loco/themes/';    // Array for storing found domains    $textdomains = [];    // Function for searching and adding domains based on .mo files	function find_textdomains_from_files($directory, $locale, &$textdomains)	{		// Open the directory and look for all .mo files		$mo_files = glob($directory . '*.mo');		// If files are found		if ($mo_files) {			foreach ($mo_files as $file) {				// Checking if the file exists				if (file_exists($file))				{					// Get the file name without extension					$domain_with_locale = basename($file, '.mo');					$domain_parts = explode('-', $domain_with_locale);  // We split the domain by the '-' symbol					// If there is a locale at the end, remove the last element of the array					if (count($domain_parts) > 1 && end($domain_parts) === $locale) {						array_pop($domain_parts);  // Remove the last element (locale)					}					// We assemble the domain back from the array					$domain = implode('-', $domain_parts);					// Add the domain to the array if it doesn't exist yet					if (!in_array($domain, $textdomains)) {						$textdomains[] = $domain;					}				}			}		}	}	$locale = determine_locale(); // Determining the current locale	//error_log("locale: ".$locale);	// Trying to find text domains for plugins and themes	find_textdomains_from_files($plugin_custom_path, $locale, $textdomains);	find_textdomains_from_files($theme_custom_path, $locale, $textdomains);	if (!empty($textdomains)) {		// error_log("Found text domains: " . implode(', ', $textdomains));	} else {		//error_log("No text domains registered.");		return;	}	// We go through all registered text domains	foreach ($textdomains as $domain)	{		//error_log("domain: ".$domain);		// Skipping already loaded domains		if (is_textdomain_loaded($domain)) {			//error_log("Text domain '{$domain}' already loaded.");			continue;		}		// Path to translation file for plugins		$mo_plugin_file = $plugin_custom_path . $domain . '-' . $locale . '.mo';		if (file_exists($mo_plugin_file)) {			//error_log("Loading plugin translation for domain '{$domain}' from {$mo_plugin_file}");			load_textdomain($domain, $mo_plugin_file);		} else {			//error_log("No translation file found for plugin domain '{$domain}' at {$mo_plugin_file}");		}		// Path to translation file for themes		$mo_theme_file = $theme_custom_path . $domain . '-' . $locale . '.mo';		if (file_exists($mo_theme_file)) {			//error_log("Loading theme translation for domain '{$domain}' from {$mo_theme_file}");			load_textdomain($domain, $mo_theme_file);		} else {			//error_log("No translation file found for theme domain '{$domain}' at {$mo_theme_file}");		}	}});
       ```
   
    -  This reply was modified 1 year, 5 months ago by [learnee](https://wordpress.org/support/users/learnee/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/page/2/#post-18138560)
 * Testing on the[ Eagle Booking plugin](https://api.eagle-booking.com/updates/?action=download&slug=eagle-booking).
   
   I create a new language for it (Ru).I edit the text I need.If I move (inside 
   the Loco plugin) the language file to the system or author’s – then the translation
   is pulled. If to the individual (languages/loco/plugins/) – then no.
    -  This reply was modified 1 year, 6 months ago by [learnee](https://wordpress.org/support/users/learnee/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/page/2/#post-18138433)
 * Just installed your plugin.
 * Tried moving the language file to system, author and individual inside the plugin–
   works. Deactivating the plugin disables translation – which is logical and confirms
   functionality.
 * 
   The theme is being translated. Unfortunately, plugins are not translated
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/#post-18138323)
 * Yes. The problem was solved in the theme. But not in the plugin.
 * [https://localise.biz/wordpress/plugin/developers](https://localise.biz/wordpress/plugin/developers)
 * P.S. And the version number of the plugin has not changed (it’s not important)
    -  This reply was modified 1 year, 6 months ago by [learnee](https://wordpress.org/support/users/learnee/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/#post-18138051)
 * A working solution at the theme settings level via a **functions.php** file **
   without moving language files** from /wp-content/languages/loco/:
 *     ```wp-block-code
       add_action('after_setup_theme', function () {    $domain = 'x-blog'; // Specify the text domain. My option is indicated for the X Blog themes    $locale = determine_locale(); // Determine the current locale    // Main path for plugin language files    $plugin_custom_path = WP_CONTENT_DIR . '/languages/loco/plugins/';    $theme_custom_path = WP_CONTENT_DIR . '/languages/loco/themes/';    // Load files from the custom plugin directory    $mo_plugin_file = $plugin_custom_path . $domain . '-' . $locale . '.mo';    $po_plugin_file = $plugin_custom_path . $domain . '-' . $locale . '.po';    if (file_exists($mo_plugin_file)) {        load_textdomain($domain, $mo_plugin_file);    } elseif (file_exists($po_plugin_file)) {        load_textdomain($domain, $po_plugin_file);    }    // Load files from the custom theme directory    $mo_theme_file = $theme_custom_path . $domain . '-' . $locale . '.mo';    $po_theme_file = $theme_custom_path . $domain . '-' . $locale . '.po';    if (file_exists($mo_theme_file)) {        load_textdomain($domain, $mo_theme_file);    } elseif (file_exists($po_theme_file)) {        load_textdomain($domain, $po_theme_file);    }});
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/#post-18137656)
 * I will be waiting for your decision with interest. And if I can help test it,
   I will be glad. Good luck.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/#post-18137620)
 * Here’s what the neural network got wise: [https://chatgpt.com/share/67370e51-7a4c-8000-a312-57bc0d483198](https://chatgpt.com/share/67370e51-7a4c-8000-a312-57bc0d483198)
 * In WordPress 6.6 and 6.7, significant changes were introduced that could affect
   how language files are loaded. In particular:
    - Updates to the `theme.json` file processing.
    - API changes for templates and localization mechanisms.
 * These updates may have made WordPress strictly adhere to the standard `/wp-content/
   languages/plugins/` path for plugins and themes, excluding custom directories
   like `/wp-content/languages/loco/plugins/`. This could be due to a simplification
   of file-loading mechanisms or security enhancements to prevent the accidental
   use of unsupported directories.
 * A possible solution could be this (haven’t tried it yet): Add the following code
   to your theme’s `functions.php` file:
 *     ```wp-block-code
       add_filter('loco_load_textdomain_override', function ($locale, $domain, $path) {    $custom_path = WP_CONTENT_DIR . '/languages/loco/plugins/';    if (file_exists($custom_path . $domain . '-' . $locale . '.mo')) {        load_textdomain($domain, $custom_path . $domain . '-' . $locale . '.mo');        return true;    }    return false;}, 10, 3);
       ```
   
    -  This reply was modified 1 year, 6 months ago by [learnee](https://wordpress.org/support/users/learnee/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/#post-18136393)
 * Installing Loco Translate plugins 2.6.12-dev does not help
    -  This reply was modified 1 year, 6 months ago by [learnee](https://wordpress.org/support/users/learnee/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/#post-18136161)
 * Yes. There is a problem and it is easy to reproduce.
 * My steps:
    - installed a clean WordPress 6.7 RU (PHP 7.4)
    - deleted all default plugins
    - installed Loco Translate plugins 2.6.11
    - deleted all default themes
    - installed a free X Blog theme 1.3.27
    - added a new language (ru) to the theme and translated the “More button”
 * If you save the language file to the loco plugin folder, it doesn’t see the translation.
 * If to the system folder, it does
    -  This reply was modified 1 year, 6 months ago by [learnee](https://wordpress.org/support/users/learnee/).
    -  This reply was modified 1 year, 6 months ago by [learnee](https://wordpress.org/support/users/learnee/).
    -  This reply was modified 1 year, 6 months ago by [learnee](https://wordpress.org/support/users/learnee/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] WordPress 6.7 is not using your language files – solution](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/)
 *  Thread Starter [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/wordpress-6-7-is-not-using-your-language-files-solution/#post-18136117)
 * In my particular case – the language I need is not supported by the author of
   the plugin and theme. Therefore, for a quick solution – this was the way out 
   for me.
 * Ideally, of course, you need to store language files not in the system directory.
 * he latest version of the plugin 2.6.12-dev – I tried, but it did not help.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] Known issue with Just-in-time text domain loading](https://wordpress.org/support/topic/known-issue-with-just-in-time-text-domain-loading/)
 *  [learnee](https://wordpress.org/support/users/learnee/)
 * (@learnee)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/known-issue-with-just-in-time-text-domain-loading/#post-18135909)
 * Here is a quick solution to the problem with the location of language files with
   translation in WordPress 6.7 – which I myself have successfully used:
   A ready-
   made bash script that automatically moves the language files on the whole server
   from the plugin folder, to the system folders.
 * As a result, you don’t need to do anything else on the sites themselves (even
   if there are a lot of them) 🙂
   Place in the root of the server (or user directory)
   and run. All processes are logged.
 *     ```wp-block-code
       #!/bin/bash# Set the log file to the current directoryLOG="$(pwd)/logfile.log"# Function for logginglog_message() {    echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" >> "$LOG"}# Recursive directory traversalfind . -type d -path "*/wp-content/languages/loco/plugins" | while read -r dir; do    # Move files from /wp-content/languages/loco/plugins/ to /wp-content/languages/plugins/    target_dir="$(echo "$dir" | sed 's|wp-content/languages/loco/plugins|wp-content/languages/plugins|')"    mkdir -p "$target_dir"    mv "$dir"/* "$target_dir"    log_message "Moved files from $dir to $target_dir"donefind . -type d -path "*/wp-content/languages/loco/themes" | while read -r dir; do    # Move files from /wp-content/languages/loco/themes/ to /wp-content/languages/themes/    target_dir="$(echo "$dir" | sed 's|wp-content/languages/loco/themes|wp-content/languages/themes|')"    mkdir -p "$target_dir"    mv "$dir"/* "$target_dir"    log_message "Moved files from $dir to $target_dir"doneecho "Script completed."
       ```
   

Viewing 13 replies - 1 through 13 (of 13 total)