1

I have theme. For example code for comments:

<?php
'fields'   =>  array(

'author' => '<p class="comment-form-author">' . '<label for="author">' . esc_html__( 'Name','text_domain' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' placeholder="'.esc_html__( 'Name','text_domain' ) .'"/></p>',

)
    ...
);
?>

I have changed site language in admin panel, but i still get 'Name' (english). How to translate theme content using site language?

1 Answer 1

0

Make sure to load the translations using the load_theme_textdomain function, and supposed your translations is located in the library/translations folder, then you can add the code below in you functions.php file.

// let's get this party started
add_action( 'after_setup_theme', 'translations');
function translations() {
  // let's get language support going, if you need it
  load_theme_textdomain( 'text_domain', get_template_directory() . '/library/translations' );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.