Hi,
How can I change “Leave A Comment” text to “Jätä Kommentti” and “Your Comment” text to “Kommentoi…”?
I already managed to change the submit button text.
Theme Ethos
Hi,
How can I change “Leave A Comment” text to “Jätä Kommentti” and “Your Comment” text to “Kommentoi…”?
I already managed to change the submit button text.
Theme Ethos
Hi There,
You can translate all strings from x.pot file, please use Poedit translations editor. For more guidance check this:
Other option is to add the following code on your child theme’s functions.php file:
add_filter ('gettext', 'x_translate_text', 99, 3 );
function x_translate_text ( $translated_text, $text, $domain ) {
$translation = array (
'Leave A Comment' => 'Jätä Kommentti',
'Your Comment' => 'Kommentoi...'
);
if( isset( $translation[$text] ) ) {
return $translation[$text];
}
return $translated_text;
}
Hope this helps.
Hi,
The code doesn´t work in child theme´s functions.php file. So any other ideas? I´m not familiar with poedit so I would like to use code in functions.php.
I managed to change the submit button text by adding this to the code you send:
$translation = array (
‘Submit’ => ‘Lähetä’
);
But the other two texts won´t change with the code you send.
Hello There,
Thanks for updating in! Please have the code updated and make use of this code instead:
add_filter ('gettext', 'x_translate_text', 99, 3 );
function x_translate_text ( $translated_text, $text, $domain ) {
$translation = array (
'<span>Leave a Comment</span>' => '<span>Jätä Kommentti</span>',
'Your Comment *' => 'Kommentoi...'
);
if( isset( $translation[$text] ) ) {
return $translation[$text];
}
return $translated_text;
}
Hope this helps. Please let us know how it goes.