• Resolved soviet_1917

    (@soviet_1917)


    Hey, I’d like to give the opportunity to donate anonymously, but my website is in german. The option is there, but it’s in english only, and apparently also not in the .po-file.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi There,

    You should be able to change the text by adding the following custom snippet to your website.

    function vc_give_text_switcher( $translation, $text, $domain ) {
    
    	if ( 'give' === $domain && 'Make this an anonymous donation' === $text ) {
    		$translation = __( 'YOUR TEXT HERE1' );
    	}
    
    	// For the help text.
    	if ( 'give' === $domain && 'Would you like to prevent this donation from being displayed publicly?' === $text ) {
    		$translation = __( 'YOUR TEXT HERE2' );
    	}
    
    	return $translation;
    }
    add_filter( 'gettext', 'vc_give_text_switcher', 10, 3 );

    If you need any help in adding a custom snippet to your website, you can check this detailed doc here for more help: https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/

    Thanks

    Hello

    I tried for my website that is french with divi plugin but it does not work !!!

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    @webcreationbelgium Can you provide a link to your form so we can see the problem live?

    Hello. I also tried your solution, but is doesn’t work for my Divi website (https://nieuw.kindweeskind.nl/doe-een-gift/) neither.

    Update: I managed to translate the text by editing PO and MO files.

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hi all,

    The above snippet has some typos which is why it wasn’t working as intended. Use this instead please:

    function vc_give_text_switcher( $translation, $text, $domain ) {
    
        if ( 'give' === $domain && 'Make this an anonymous donation.' === $text ) {
            $translation = __( 'Translated text 1' );
        }
    
        // For the help text.
        if ( 'give' === $domain && 'Would you like to prevent your name, image, and comment from being displayed publicly?' === $text ) {
            $translation = __( 'Translated Text 2' );
        }
    
        return $translation;
    }
    add_filter( 'gettext', 'vc_give_text_switcher', 10, 3 );

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Checkbox for anonymous donation not localized’ is closed to new replies.