New Landing How can we help? Themeforest Theme Support Neighborhood translate with child theme

Viewing 7 posts - 1 through 7 (of 7 total)
  • #226019
    MarcusRG
    Member
    Post count: 69

    Hi

    How is the easiest way to translate theme with child theme?

    I have like 5-6 strings i need to translate from English to Danish

    #226075
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this code after replacing the text

    function sf_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case 'STRING 1' :
    $translated_text = __( 'DANISH TEXT 1', $domain );
    break;
    }
    case 'STRING 2' :
    $translated_text = __( 'DANISH TEXT 2', $domain );
    break;
    }
    case 'STRING 3' :
    $translated_text = __( 'DANISH TEXT 3', $domain );
    break;
    }
    case 'STRING 4' :
    $translated_text = __( 'DANISH TEXT 4', $domain );
    break;
    }
    case 'STRING 5' :
    $translated_text = __( 'DANISH TEXT 5', $domain );
    break;
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'sf_text_strings', 20, 3 );

    Thanks
    Mohammad

    #226107
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this code after replacing the text

    function sf_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case ‘STRING 1’ :
    $translated_text = __( ‘DANISH TEXT 1’, $domain );
    break;
    }
    case ‘STRING 2’ :
    $translated_text = __( ‘DANISH TEXT 2’, $domain );
    break;
    }
    case ‘STRING 3’ :
    $translated_text = __( ‘DANISH TEXT 3’, $domain );
    break;
    }
    case ‘STRING 4’ :
    $translated_text = __( ‘DANISH TEXT 4’, $domain );
    break;
    }
    case ‘STRING 5’ :
    $translated_text = __( ‘DANISH TEXT 5’, $domain );
    break;
    }
    return $translated_text;
    }
    add_filter( ‘gettext’, ‘sf_text_strings’, 20, 3 );

    Thanks
    Mohammad

    #226313
    MarcusRG
    Member
    Post count: 69

    Hi

    Thanks for quick answer

    I’m not sure I understand.

    #226316
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide English strings with equivalent danish strings. I will provide you exact code.
    Thanks
    Mohammad

    #226366
    MarcusRG
    Member
    Post count: 69

    Ok

    Where will the code be placed then?

    English:

    Related articles -> Andre artikler
    Browse F.A.Q. Topics -> Se vores emner her
    Shipping -> Fragt

    I think that’s it

    #226370
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please place the code at function.php of child theme.
    function sf_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case ‘Shipping’ :
    $translated_text = __( ‘Fragt’, $domain );
    break;
    }
    case ‘Browse F.A.Q. Topics’ :
    $translated_text = __( ‘Se vores emner her’, $domain );
    break;
    }
    case ‘Related articles’ :
    $translated_text = __( ‘Andre artikler’, $domain );
    break;
    }

    return $translated_text;
    }
    add_filter( ‘gettext’, ‘sf_text_strings’, 20, 3 );

    Thanks
    Mohammad

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register