How to translate some words by using snippet?
What is different if translating words by using this way and use snippet?
Actually if you translating Youzify, if you updates your Youzify, your translations will be resetted to Youzify default translation. Except, you backup .po and .mo file, after update your Youzify, replace the it with your backup files.
But if you don't want that way, you can translate some words by using a snippet. Please try this way
1. Please go to your FTP/Cpanel, and go to folder "wpc-ontent/plugins"
2. Create a file and name it with "bp-custom.php"
3. Paste this snippet to the file
https://gist.github.com/KaineLabs/7cb85161783d83f7a1947df55e5482e9#file-yz-translate-like-button-php
4. On line 9, change 'Like' with existing word and on line 10, change 'Upvote' with your new word.
5. if you want translate more words, just copy the code from line 8 to line 12 And do same thing like point 4 but with other words.
6. Save the file
Example if you want to translate multiple words
<?php /** * Translate Like Button. */ function yzc_translate_text( $translated_text ) { switch ( $translated_text ) { case 'Add Friend' : $translated_text = __( 'Connect', 'youzify' ); break; } switch ( $translated_text ) { case 'Unfriend' : $translated_text = __( 'Unconnect', 'youzify' ); break; } switch ( $translated_text ) { case 'Friendship' : $translated_text = __( 'My Network', 'youzify' ); break; } return $translated_text; } add_filter( 'gettext', 'yzc_translate_text', 30 );