• Anna
    April 30, 2015 at 8:31 am #107566

    Working with Child Theme Translations

    Child Themes are using in normal cases the translation files of the main theme. In some cases it could be necessary to have a separate language file handling at the Child Theme itself.

    How to make your Child Theme ready to use its own translation files?

    First of all you have to modify your Child Themes functions.php file and call the appropriated load method as shown below. Assume the textdomain is defined at the Main Theme as super theme the load function should look like:

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

    The code can be added before add_action. See an example before:

    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css' ); 
    load_child_theme_textdomain('wpestate', get_stylesheet_directory().'/languages');
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );

    The path has been defined as subdirectory within the Child Themes directory but you can skip the directory parameter and place the language files at the Child Themes main folder.

    (Re)scan process and Synchronization at Child Themes

    Scanning a Child Theme always includes the files from Main Theme too. So you always get the mixed translation from Main and Child Theme. Doing a Synchronization with the Main Theme will preserve the texts from Child Theme and will attach new texts from Main Theme only.

    • This topic was modified 2 years, 2 months ago by  Anna.
    • This topic was modified 1 year, 12 months ago by  Anna.
    • This topic was modified 1 year, 11 months ago by  Anna.
    • This topic was modified 1 year, 11 months ago by  Anna.
    July 24, 2015 at 9:52 pm #116904

    So it will be correct

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

    September 4, 2015 at 3:44 pm #123105

    1. What if I want to load an entire language file, not only with text-domain from child theme?
    2. How would I load the pins from child theme?
    3. How should I include wpml-config.xml in child theme?


    September 7, 2015 at 8:58 am #123127

    Hi Hampus

    This is to load wpresidence/languages folder in child theme.

    The pins modification in child theme – we didn’t get the instructions from Wpml about that being possible.

    As for wpml-config.xml in child theme – all there is as documentation (at least what i found) is here https://wpml.org/documentation/support/language-configuration-files/

    The pins modifications can stay in main theme because you create new names. A theme update done via FTP (by simply overwriting theme files) would continue to have the files after update because the names are unique.

    Update via FTP video tutorial is here – http://help.wpresidence.net/#!/updatetheme


    Thank you

You must be logged in to reply to this topic.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.