New Landing How can we help? Themeforest Theme Support Neighborhood Translate Neighborhood theme from english to german by .mo and .po file Reply To: Translate Neighborhood theme from english to german by .mo and .po file

#291550
janheege
Member
Post count: 148

Dear Mohammad,

Thank you for your reply!

I paste this code into my functions.php. But it doesn’t work. I am sure I did something wrong, could you check it, please?

See at the attachment, there is my improved functions.php file.

My second problem is that I want to change the Text “Have a coupon…” in 1.phg. I think I can easily to this by changing the translation in the .po file (Look 2.png).

How can I do this?

Here is my functions.php:

<?php
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

}
load_theme_textdomain( ‘swiftframework’, get_stylesheet_directory() . ‘/language’ );
function sf_child_theme_locale() {
//echo get_stylesheet_directory() . ‘/language’ ;exit;
//load_theme_textdomain( ‘swiftframework’, get_stylesheet_directory() . ‘/language’ );
load_child_theme_textdomain( ‘swiftframework’, get_stylesheet_directory() . ‘/language’ );
}
//add_action( ‘init’, ‘sf_child_theme_locale’ );
}
add_filter( ‘gettext’, ‘sf_string_translate’, 20, 3 );
function sf_string_translate( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case ‘Name’ :
$translated_text = __( ‚Add to Shopping Bag‚, ‚In den Warenkorb legen‚ ); //just change it.
break;
}
return $translated_text;
}
?>

Best regards, Jan

Attachments:
You must be logged in to view attached files.