How to Translate Dynamic Words from Multilanguage Website (WPML)
For some dynamic words, such as login button, register button, lost password, etc, it can not be translated automatically by using WPML. It requires a snippet to be achieved.
Please do these steps to implement it:
1. Go to your FTP/CPanel, and go to folder "wp-content/plugins"
2. Create a new file there and name it with "bp-custom.php"
3. Put this snippet on the file
https://gist.github.com/KaineLabs/73ba3d3577c83c29397199b92241d203
4. For this code on the snippet
if ( defined( 'ICL_LANGUAGE_CODE' ) && 'hr' == ICL_LANGUAGE_CODE ) {
please change 'hr' with your WordPress language code. For example, if you want to translate the words in Indonesian, so you need to change 'hr' with 'id'. Please check the complete list of the codes here:
https://wpastra.com/docs/complete-list-wordpress-locale-codes/
5. For this code on the snippet
add_filter( 'option_yz_login_lostpswd_title', 'yzc_translare_dynamic_words' );
Change "yz_login_lostpswd_title" with option ID of Dynamic Words you want to change. Please make sure replace only "yz_login_lostpswd_title", do not replace the "options_". It still required.
To check complete list ID of the Dynamic Words, please check this link:
https://kainelabs.ticksy.com/article/16635
6. Save the file
How to translate Multiple Words?
1. Please just duplicate the snippet and put below existing snippet on the bp-custom.php
2. But please note, do not duplicate the PHP tag
<?php
Just duplicate the snippet starting from code
function yzc_translare_dynamic_words( $value )
3. Change this code on the duplicate snippet with another else.
yzc_translare_dynamic_words
Because you only able to have 1 function code on a single bp-cusom.php. For example, change it as
yzc_translare_dynamic_words2
Please check the screenshot below to see an example of how to implement multiple dynamic words translation