How to translate custom Divi module using POEDIT and Polylang [closed]

  1. It seems that you’re adding translatable strings with text domain “custom-strings” but loading a text domain “Divi” in load_child_theme_textdomain. Needs to be the same

  2. Don’t use the same text domain as your parent theme. If your parent theme is Divi, use divi-child (it should match your child theme slug).

  3. In your child theme’s style.css, define the Text Domain.

  4. I’ve read somewhere that the path to the child theme’s .po and .mo files should be the same as the parent’s, but I’m unsure about this. Your path seems custom (not sure) so include it in your child theme’s style.css as well.

So,

In functions.php:

function my_lang_function() {
    load_child_theme_textdomain( "divi-child", get_stylesheet_directory() . "/includes/builder/languages" );
}

add_action( "after_setup_theme", "my_lang_function" );

In whatever file:

$output.="<li class="bedroom">".sprintf(_nx("%d bedroom", "%d bedrooms", $custom["bedroom_count"][0], "noun", "divi-child"), $custom["bedroom_count"][0])."</li>";

In style.css:

/*
[...]
Text Domain: divi-child
Domain Path: /includes/builder/languages
*/