Subscribe2: How to translate

Is there somewhere I can go to edit and translate these lines so they will show up in Portuguese?

@MattyRob can shed light on this if it’s possible to translate those strings.

Yes, subscribe2 is fully i18n compliant.

I usually recommend this plugin to add translations:

I went to download Loco Translate and got this:

Incompatible with your version of ClassicPress

You may need to download and manually install and older version.

Available at the bottom of the page here:

Can it be done with gettext() manually? It’s only 4 strings, might be quicker/easier that way than adding another plugin.

@viktor - I’m sorry tp say that being an English speaker I really don’t know enough about this area of the code. It could certainly be accomplished via the core gettext filter and a function but that would involve writing code.

I’m not sure what the implementation would be for using gettext() manually.

Any suggestion about how far back to go, how much older version? I’m kinda lost here.

Version 2.5.x looks good. It seems version 2.6.0 bump the required version to WordPress 5.2.

2.5.8 downloaded and installed.
This is not low-hanging fruit. Gonna have to study up on this to figure it out.
Thanks for the tips and time.

I had time to look into this and test it. If you prefer not to have another plugin, you can drop the following code in your theme’s functions.php and update values inside $new_text array, this will translate Subscribe2 widget text:

add_filter( 'gettext', 's2cp_translations', 'subscribe2-for-cp' );

function s2cp_translations( $text ) {

	$old_text = array('Unsubscribe', 'Subscribe', 'Your email:','Enter email address...');
	$new_text = array('Unsubscribe123', 'Subscribe2', 'Your email:2','Enter email address...2');
 
    $text = str_replace( $old_text, $new_text, $text );

    return $text;
}

Let me know if you need help.

1 Like

Got it! Thanks so much for taking out the time to do this. Great help.

I went to the plugin editor first. Came back to read your instruction: theme editor. haha

1 Like