Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Tweaks › eMember -register/login form in 2nd language without wpml or qtranslate
Tagged: members, Translation, wpml
- This topic has 5 replies, 2 voices, and was last updated 9 years, 9 months ago by admin.
-
AuthorPosts
-
February 11, 2015 at 10:06 am #12194jurgenvtMember
Hi, I have read this: https://support.tipsandtricks-hq.com/forums/topic/multilanguage-support
and this must be a solution for my eMember project.
However, i have no wpml or qtranslate installed in my website. I also want to avoid installing it, since qtranslate is no longer supported and i find WPML to heavy for just one form in another language.
is something like this possible wihout any of those plugins installed?
what i had in mind:
my base language is hebrew. i have about 3 pages in dutch, but now also the question arised to have the register/login forms in dutch. WHat would work for me is a specific page (to identify with an id, and then load a differend language set for the registration /login form.
if it would help to create a separate template file for this (login/registration) page, this i can do.
i just need instructions on how to load another language for the login / registration form.
your help is -as always- greatly appriciated!
Thank you
February 11, 2015 at 10:32 pm #68537adminKeymasterI can tell you how you can load a different language file for emember from your custom code. However, I don’t know if it will fully solve your issue or not.
Below is an example code that loads the dutch language if the page/post ID is 100. Else it will load the English language file.
add_filter('emember_get_language_path', 'emember_custom_lang_handler', 10, 2);
function emember_custom_lang_handler($eMember_language_file, $lang)
{
//Add your condition here and specify the language file that you want to load
global $post;
if ($post->ID == "100"){
$eMember_language_file = WP_EMEMBER_PATH . "lang/nld.php";
}
else{
$eMember_language_file = WP_EMEMBER_PATH . "lang/eng.php";
}
//Return the path and eMember will load this file.
return $eMember_language_file;
}February 12, 2015 at 11:27 am #68538jurgenvtMemberThank you so much.
i must be doing something wrong, because i am getting a white screen.
in wp_eMember1.php i added (after last “add_action”, line 165:
//SOSMOD
add_filter(’emember_get_language_path’, ’emember_custom_lang_handler’), 10, 2);
function emember_custom_lang_handler($eMember_language_file, $lang)
{
//Add your condition here and specify the language file that you want to load
global $post;
if ($post->ID == “1071”){
$eMember_language_file = WP_EMEMBER_PATH . “lang/nld.php”;
}
else{
$eMember_language_file = WP_EMEMBER_PATH . “lang/heb.php”;
}
//Return the path and eMember will load this file.
return $eMember_language_file;
}
//SOSMOD
wrong file? wrong place?
please advise.
Thank you!
February 12, 2015 at 10:34 pm #68539adminKeymasterYou shouldn’t add this code to eMember. Add it to a custom plugin or your theme’s functions.php file. That way you won’t lose this customization when you upgrade the plugin also.
February 13, 2015 at 9:03 am #68540jurgenvtMemberi got the white screen tackel:
there was a “)” to much in:
add_filter(’emember_get_language_path’, ’emember_custom_lang_handler’), 10, 2);
now i did in functions.php:
add_filter(’emember_get_language_path’, ’emember_custom_lang_handler’, 10, 2);
function emember_custom_lang_handler($eMember_language_file, $lang)
{
//Add your condition here and specify the language file that you want to load
global $post;
if ($post->ID == “1071”){
$eMember_language_file = WP_EMEMBER_PATH . “lang/nld.php”;
}
else{
$eMember_language_file = WP_EMEMBER_PATH . “lang/heb.php”;
}
//Return the path and eMember will load this file.
return $eMember_language_file;
}
//SOSMOD
no errors, but no “nld” language on pageid 1071 where i used the shortcode [wp_eMember_registration]
February 13, 2015 at 11:41 pm #68541adminKeymasterYou should probably do an “echo” statement inside the following condition block just to make sure that path of the code is being executed:
if ($post->ID == "1071")
Also, check the contents of the “nld.php” file to make sure the texts are translated. We can’t speak or understand dutch. One of our users gave us that file.
-
AuthorPosts
- You must be logged in to reply to this topic.