In my child theme, I copy files from the parent theme and do some changes. My problem is about translation.

In functions.php I load the child translation file like this :

if ( !defined( 'ST_CHILD_TEXTDOMAIN' ) )
    define( 'ST_CHILD_TEXTDOMAIN', 'traveler-child' );

function traveler_child_theme_setup() {
    load_child_theme_textdomain( ST_CHILD_TEXTDOMAIN, get_stylesheet_directory() . '/language' );
add_action( 'after_setup_theme', 'traveler_child_theme_setup' );

With Poedit, I generated the po files with all labels to translate but I translate only one label "My account", others labels are empty string.

In my php file, I change the text domain only for this string :

And the label is translated, BUT others labels with ST_TEXTDOMAIN, not binded with the child mo file, are not translated anymore.

when I do this :

<?php var_dump(ST_TEXTDOMAIN); echo __('Hi, ', ST_TEXTDOMAIN ) . TravelHelper::get_username($userdata->ID); ?>

The output is correct :


So,... What happens ? Someone can help me ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.