• Resolved dis-annie

    (@dis-annie)


    Hi!

    Awesome plugin! It works perfectly and is so easy to use. Thank you!!

    I’d like to run the translation when the user logs in (because I have user meta where they have specified their preferred language). I can’t seem to get it to work.

    Note: I have enabled the floating language selector, but hid it in CSS. I have a button that toggles between “English” & “Spanish”, which works fine.

    function my_login($login) {
    $user_language = get_user_meta( $user->ID, ‘language’, true );
    ?>
    <script type=”text/javascript”>
    if ( <?php $user_language ?> == “Spanish”) {
    doGTranslate(‘en|es’);
    }
    else {
    doGTranslate(‘es|en’);
    }
    </script>
    <?php }

    add_action( ‘wp_login’, ‘my_login’, 1);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author edo888

    (@edo888)

    Hi,

    It depends where on the page it outputs your code. Make sure it is in the HTML source code after the doGTranslate function definition and make sure that everything is loaded and initialized before you call it.

    Thanks! ??

    Thread Starter dis-annie

    (@dis-annie)

    OK, thank you for your prompt reply!

    Plugin Author edo888

    (@edo888)

    You are welcome! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can it translate on Login?’ is closed to new replies.