Skip Navigation

[Resolved] Login form translation

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 17 replies, has 3 voices.

Last updated by francescoL-3 3 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#2315983

Tell us what you are trying to do?
I would like to translate and customize a login form

Is there any documentation that you are following?
No

Is there a similar example that we can see?
I don't know

What is the link to your site?
hidden link
hidden link

#2316131

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Are you a user of WPML?

You can use WPML String Translation to translate the log-in form texts (as well as other related texts such as for resetting password etc.).

But please be aware of the issue described in this erratum: https://toolset.com/errata/default-language-used-in-parts-of-the-translated-forgot-password-workflow/

#2316133

Hello Nigel,
no I'm not a WPML user. Is this a free plugin? There is a free version?
Anyway I would like to translate and customize by my self this kinf of string

Can you help me?

Thank you

#2316229

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

WPML is a paid plugin (wpml.org), although there are free alternatives available which may help.

If you want to translate these strings yourself, then you need to use the core WP gettext filter: https://developer.wordpress.org/reference/hooks/gettext/

You should use some checks such as for the current page to limit where you hook into this filter to avoid hooking into it unnecessarily and affecting performance.

Here is an example of the kind of code you might use:

add_action( 'wp', function(){

    if ( is_page( 'custom-login' ) ){ // edit for slug of login page

        add_filter( 'gettext', 'ts_filter_texts', 10, 3 );
    }
} );

function ts_filter_texts( $translation, $text, $domain ){

    if ( ! ( $domain == 'default' || $domain == 'wpv-views') ){
        return $translation;
    }

    // translations
    switch ($text) {
        case 'Username or Email':
            $translation = 'Alternative username text';
            break;
        case 'Password':
            $translation = 'Alternative password text';
    }

    return $translation;
}

The first action callback is to check which page we are on, while the second filter callback performs the actual translations...

#2316289

Many Thanks Nigel,
I'll try your suggestion... so this is a WP string. Right?

Please, can I instead use a custom login form? I read your lesson about but I cannot well aunderstand the steps..

Have a nice day

#2316361

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sorry, I thought you were using a custom login form already.

Please see this page for the steps needed to create a custom login page: https://toolset.com/course-lesson/creating-custom-login-forms/

#2316589

Thank you again,
I tried to follow the steps but it doesn't work...I think the steps are not updated and I cannot obtain the suggested results... so I'm using a shortcode

#2316721

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Francesco,

When you say you're using a shortcode can you let me know which shortcode you're using?

Are you using the [wpv-login-form]
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-295292

As this will generate the same form that you can use the code Nigel had provided to replace the text.

Please let me know.
Thanks,
Shane

#2316839

Hi Shane, thanks for your response.
So I am using the internal code of WP?
Isn't there a way that works to use a custom login form? As I said the solution given in the tutorial doesn't work for me.

Anyway... from what I understand using WP shortcode I can't customize for example adding more fields. Right?

Moreover the notification email is sent by WP. Right?

For the redirection I am using Peter's plugin which seems to work.

Do you have any other solutions to avoid using the code mentioned by Nigel?

Thanks a lot

#2317427

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Francesco,

Anyway... from what I understand using WP shortcode I can't customize for example adding more fields. Right?
That is correct, this will only display the default login form.

Moreover the notification email is sent by WP. Right?

Yes the emails are sent by wordpress itself.

Do you have any other solutions to avoid using the code mentioned by Nigel?

Unfortunately without a translation plugin the only way to translate the fields is by using code. If you're using a shortcode that is not from our plugins then the textdomain for the text will be different.

The best option you may have for some automatic translation is by using the WPML plugin or another translation plugin for wordpress.

Thanks,
Shane

#2317491

Thank you Shane,
you clearly answered my questions. Thank you!

What I was ultimately asking though is if there is a way to create a custom login agina that works though.

As I tried to tell you earlier as well, following the instructions provided in your tutorial something doesn't work. I have tried several times and thought that maybe the tutorial was made with an old version of toolset. Some information does not match with the software I am using and that is the most updated version.

Or some information is missing.

Thanks again

Translated with hidden link (free version)

#2317571

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Francesco,

create a custom login agina

Ok so you're not able to create a custom login form with our plugins. I'm actually not aware of a plugin that can create a custom login form in terms of adding additional custom fields etc.

I know that you can style the login forms however this is a purely css solution. If it's just change how the form looks then css will need to be used to do this.

I hope I was able to answer your question.

Thanks,
Shane

#2317623

Here you can find your tutorial:
https://toolset.com/course-lesson/creating-custom-login-forms/

It doesn't work 🙂

#2317743

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Francesco,

This tutorial shows you how to create a login page, not a custom login form.

The login form you see on this page is being pulled from wordpress using this shortcode.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-295292

If you can specify which section of the tutorial isn't working for you then I can go over it to see what the issue is.

Thanks,
Shane

#2318431

Many thanks Shane,
however this is not very clear, in fact the title talks about how to build a custom login form and not how to translate it....

That's ok 🙂

Thanks