Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideadude/778e66b566b800c6a19d34e472a1e856 to your computer and use it in GitHub Desktop.
Save ideadude/778e66b566b800c6a19d34e472a1e856 to your computer and use it in GitHub Desktop.
Translate the password suggestions in the PMPro Strong Passwords Add On
<?php
/**
* Swap or translate the password suggestions from the PMPro Strong Password Add On.
* These suggestions come from the bundled password strenght library.
* Until we update the plugin to make these translatable,
* the following code can be used to translate them on your site.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmprosp_minimum_password_score_message( $message ) {
// add translations
$suggestions = array(
'Use a few words, avoid common phrases' => 'Ikutsu ka no tango o shiyō shi, ippantekina furēzu o sakemasu',
'No need for symbols, digits, or uppercase letters' => 'Kigō, sūji, daimonji wa fuyō',
'Add another word or two. Uncommon words are better.' => 'Mō 1-go ka 2-go tsuika shite kudasai. Mezurashī kotoba no kata ga īdesu.',
);
$message = str_replace( array_keys( $suggestions ), array_values( $suggestions ), $message );
return $message;
}
add_filter( 'pmprosp_minimum_password_score_message', 'my_pmprosp_minimum_password_score_message' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment