• Resolved pirinenj

    (@pirinenj)


    Hi,

    When created a translation file I noticed that it only works if stored in wp-content/languages/plugins. Not from wp-content/<child-theme>/languages where I have stored all my other language files.

    Br,
    Jukka

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mohaiminul Islam

    (@skshaikat)

    Hello Jukka,

    Sorry for the inconvenience. By default, this plugin loads languages file from this plugin/languages/ folder.
    To have your translation files .po and .mo in your child theme languages/ directory, you would add the following in your child theme functions.php:

    load_child_theme_textdomain( 'wup', get_stylesheet_directory() . '/languages/' );

    load_child_theme_textdomain() first argument must be wup as it is the text domain used for translation. The second argument is the path to your directory containing your translation files, you may change it according to your preference and need.

    Happy coding, and let me know if this could not help you. We will try again to fix our problem.

    Thank you.

    Thread Starter pirinenj

    (@pirinenj)

    Hi Sk Shaikat,

    The piece of code you sent did not work.

    I already have similar functionality in my functions.php to upload other translation files.

    function lang_setup() {
    $lang = get_stylesheet_directory() . ‘/languages’;
    load_child_theme_textdomain( ‘<Parent_Theme_Name>’, $lang );
    }
    add_action( ‘after_setup_theme’, ‘lang_setup’ );

    Br,
    Jukka

    Plugin Author Mohaiminul Islam

    (@skshaikat)

    Please update to new version. And you could try by making the second parameter true of function load_plugin_textdomain() in plugin main file woocommerce-upcoming-product.php on line 133.

    Please let me know if you need any assistance and which other plugins language file you loaded from the child theme. that will help me to find my mistake.

    thank you.

    Thread Starter pirinenj

    (@pirinenj)

    Hi Sk Shaikat,

    I changed woocommerce-upcoming-product.php and tested with and without
    load_child_theme_textdomain( ‘wup’, get_stylesheet_directory() . ‘/languages/’ );
    in my functions.php, but still did not pick up translations from child theme language directory.

    This works ok now. Woocommerce translations are coming from child theme language directory, but might, of course, be because it came with the theme itself.

    Br,
    Jukka

    Plugin Author Mohaiminul Islam

    (@skshaikat)

    plugin language files, a name like my_child_theme-de_DE.mo will NOT work. Although plugin language files allow you to specify the text-domain in the filename, this will NOT work with themes and child themes. Language files for themes should include the language shortcut ONLY.

    Thank you for understanding.

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

The topic ‘Translation not supporting child theme’ is closed to new replies.