Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can not Translate User roles in login modal from WP Residence.

Solution:

1. Add next rules to WPML > Settings > Custom XML configuration:

<wpml-config>
    <admin-texts>
        <key name="wpresidence_admin">
            <key name="wp_estate_visible_user_role">
                <key name="0"/>
                <key name="1"/>
                <key name="2"/>
                <key name="3"/></key>
        </key>
    </admin-texts>
</wpml-config>

2. - Go to wp-content/themes/wpresidence/templates/login_register_modal.php line 64:

- Replace

$user_types = array(
                 esc_html__('Select User Type','wpresidence'),
                 esc_html__('User','wpresidence'),
                 esc_html__('Single Agent','wpresidence'),
                 esc_html__('Agency','wpresidence'),
                 esc_html__('Developer','wpresidence'),
             );

- With

if (class_exists('sitepress')) {
          $user_types = array(
              esc_html__('Select User Type','wpresidence'),
              esc_html__('User','admin_texts_wpresidence_admin'),
              esc_html__('Single Agent','admin_texts_wpresidence_admin'),
              esc_html__('Agency','admin_texts_wpresidence_admin'),
              esc_html__('Developer','admin_texts_wpresidence_admin'),
          );
      } else {
          $user_types = array(
              esc_html__('Select User Type','wpresidence'),
              esc_html__('User','wpresidence'),
              esc_html__('Single Agent','wpresidence'),
              esc_html__('Agency','wpresidence'),
              esc_html__('Developer','wpresidence'),
          );
      }

3) Translate user roles using WPML String Translation.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 14 replies, has 2 voices.

Last updated by joseR-42 5 months, 1 week ago.

Assigned support staff: Dražen Duvnjak.

Author Posts
November 24, 2020 at 8:08 pm #7520311

joseR-42

We have subscription packages that need to be translated using WP Residence.

November 26, 2020 at 2:21 pm #7535497

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

sorry for waiting, we have a higher queue these days.

I have checked your site and could see the issue.

1) In order to expedite handling your support requests, can you please share WPML support debug information from your site.

- To give debug information, login to your site and go to WPML → Support. From there click on the “debug information” link at the bottom of the page.
- Once on the “debug information” page, select the entire content of the text box and copy it.
- Now go back to our support forum, find debug information box and paste it.

More information on the link: https://wpml.org/faq/provide-debug-information-faster-support/

2) How are you adding these User types? Are these some taxonomies if so are they set to Translatable? Please share some images or videos.

3) Make sure you are following WP Residence documentation for WPML:

- hidden link

Please let me know how, I'll do my best to help you in the best way possible.

Kind regards,
Drazen

November 29, 2020 at 9:32 pm #7554239

joseR-42

Dear Drazen

Thanks for your feedback and information.

2- The user roles are adding by theme default in English (1 = simple user, 2 = agent, 3 = agency, 4 = developer) but this main Website is for German speaking users. (1 = Benutzer , 2 = Einzelner Agent, 3 = Agentur, 4 = Entwickler). And When your look for those words in String or Taxonomie you can not find them.
At the same time when you want to register in Spanish option(hidden link) you have this strange sentences =buradan kayıt olun!= instead Registrarse aqui = Register here and I can't find that to correct it.

Let me know if you need any further details.
Thanks and best regards
JR

Wrong Spanish Translation and can not find it.jpg
User Role in Administration Dashboard.jpg
User Role are not available on the Frontside.jpg
November 30, 2020 at 7:21 am #7555979

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello JR,

thanks for the feedback.

Please note we usually limit 1 issue per 1 ticket to keep things clear and easy to follow.

I will suggest a fix but if the issue still happens we will need to split/open a new ticket for the new issue.

1) User role - can you please follow WP Residence documentation and see if it helps out.

- hidden link

- Add this code in WPML->Settings->Custom XML Configuration (tab) for the user roles translations to show in all WPML languages

<wpml-config>
    <admin-texts>
        <key name="wpresidence_admin">
            <key name="*" /></key>
    </admin-texts>
</wpml-config>

- Check if translated User roles appear or try searching them via WP String translation

2) String translation -

- Go to WPML → Theme and Plugins Localization
- Select the theme and theme related plugins
- Click to scan them
- After the scan is done, you should be able to find the strings on the String Translation page.

More info: https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

Please let me know how it goes.

Kind regards,
Drazen

November 30, 2020 at 2:53 pm #7560955

joseR-42

Dear Drazen

Thanks so much for the value instruction, everything has been done and translated.
But unfortunately is displaying the Agency for all languages except in Spanish it is displaying the agent and agency.

So again the Basic User, Agent and Agency have been translated and add the special html code but three option are no appear on user role option.

sorry to disturb you again.
Thanks in advance
PR

November 30, 2020 at 3:11 pm #7561061

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for the feedback.

Can you please try and replicate the issue on the next clean website that I am providing?

That way we can straight away see if this is an issue specific to your site or a compatibility issue, which will help speed up the process.

Please follow the next steps:

- Go to the next login link:
hidden link

- Finish setting up WPML

- Install WP Residence theme

- Set up some dummy page and login where can I see the issue

Please let me know how it goes and when can I check.

Thanks,
Drazen

November 30, 2020 at 8:52 pm #7563965

joseR-42

Dear Drazen

Thanks for the suggestion.

So the Theme and pages are installed but the WPML need to set up. And I think it is better if you do it because maybe I did something wrong.

I also updates the user role and it is working fine since is in English and is a single language too.

One detail: remember that German is our main Language, this means all will be translated to German. Let see.

Thanks again
Best regards
PR

User Role Test Version is Working.jpg
December 1, 2020 at 9:10 am #7567977

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for your time and effort.

I was able to get the same results in the sandbox, and as soon as I add a translation for User roles, they are gone from the frontend.

I have escalated this to our Compatibility team to check and advise further.

I will update you as soon as I have some news.

Kind regards,
Drazen

December 3, 2020 at 7:58 am #7584593

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

our developers have checked the issue and find the solution. I have just tested it on the sandbox site and it works fine.

Video: hidden link

Please check if the suggested fix works for you, and please update the theme author of this issue and suggested fix.

Workaround:

- Make sure that the site did not register the role strings in several languages. If so, delete the duplicates.

- Go to wp-content/themes/wpresidence/templates/login_register_modal.php line 64:

- Replace

       $user_types = array(
                        esc_html__('Select User Type','wpresidence'),
                        esc_html__('User','wpresidence'),
                        esc_html__('Single Agent','wpresidence'),
                        esc_html__('Agency','wpresidence'),
                        esc_html__('Developer','wpresidence'),
                    );

- With

              if (class_exists('sitepress')) {
                        $user_types = array(
                            esc_html__('Select User Type','wpresidence'),
                            esc_html__('User','admin_texts_wpresidence_admin'),
                            esc_html__('Single Agent','admin_texts_wpresidence_admin'),
                            esc_html__('Agency','admin_texts_wpresidence_admin'),
                            esc_html__('Developer','admin_texts_wpresidence_admin'),
                        );
                    } else {
                        $user_types = array(
                            esc_html__('Select User Type','wpresidence'),
                            esc_html__('User','wpresidence'),
                            esc_html__('Single Agent','wpresidence'),
                            esc_html__('Agency','wpresidence'),
                            esc_html__('Developer','wpresidence'),
                        );
                    }

- Translate user roles using WPML String translation.

I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you.

Regards,
Drazen

December 3, 2020 at 9:47 pm #7590273

joseR-42

Hi Drazen

I did all all the instruction, Even the instruction in the video was already done (translated from German to the rest of Irak) but I don't know why it doesn't work yet.

I also deactivate the WPML plugin to check if it works with the default theme and if it does, but as soon as I activate the plugin, I still have the same result and the user roles do not appear yet in the dropdown.

The only difference I'm seeing is that I don't know why I have everything in German and in your page the administration is all in English even though you have German configured as the main language. I think this might be influencing this error.

However I have created an account in case you need to see for yourself.

Let me know any information or instructions.
Thank you very much for all the help.
Greetings
PR

Lenguage Between Live and Test Wordpress Dashboard page.jpg
wpresidence_admin wp_estate_visible_user_role.jpg
Translation-wpresidence_admin wp_estate_visible_user_role.jpg
Special Code.jpg
December 4, 2020 at 6:52 am #7592895

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

The user language you see in backend admin depends on the language set in your User profile, also as said if you have user roles in any other languge in WPML String translation it will not work. What I suggest is to go to WPML string translation delete all User roles and if they appear in any other language delete them also. Switch your User > profile to English and make sure "Set admin language as editing language." is OFF. Then go to WP Residence theme options select correct User roles and save. Then go to WPML String translation and translate them.

If you still have an issue please share admin credentials in the next reply private fields I have just enabled and I will check it out.

Kind regards,
Drazen

December 4, 2020 at 10:54 am #7594179

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for the feedback.

I have checked your website and managed to solve the issue.

I have done the next steps:

- Remove added XML rule from WPML > Settings >Custom XML configuration

- Delete all admin text coming from WP Residence theme inside WPML String translation

- Go to Theme options > User role settings > Select all and save. Make sure in the top is your default language selected, in your case it is German.

- Check frontend and make sure all roles show in all languages

- Add again XML rule and save.

- Go to WPML String translation, find and translate roles

- Now everything shows up correctly on the frontend.

Please check, image attached.

I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you. 🙂

Regards,
Drazen

Screenshot_1.jpg
December 4, 2020 at 12:52 pm #7594975

joseR-42

Dear Drazen

I just wanted to remove developer (Entwickler) from the list and made the change in the main language which is German and saved the changes and now when I saw it it is back to the way it was before. I have an incredible pity and now how to put it as you did. Only the development should not be included.

A million apologies.

Thank you very much.

December 4, 2020 at 2:32 pm #7595447

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

no problem, I have fixed it.

To keep it simple I have added for translation only next rule and User roles, via Custom XML configuration:

<wpml-config>
    <admin-texts>
        <key name="wpresidence_admin">
            <key name="wp_estate_visible_user_role">
                <key name="0"/>
                <key name="1"/>
                <key name="2"/>
                <key name="3"/></key>
        </key>
    </admin-texts>
</wpml-config>

The issue here is you are saving theme options in German while they are already saved in English, so strings are added 2 times inside WPML String translation and it causes issues.

- To avoid this set your user profile languge to English (Users > Profile).

- Now make changes to theme options as you wish, image attached. Now it will always load correctly and you can make changes to selected user roles.

- Translate strings from String translation and always make sure they are marked as translated.

Please check the video: hidden link

I hope I was helpful. 🙂

Regards,
Drazen

December 4, 2020 at 3:44 pm #7595815

joseR-42

My issue is resolved now. Thank so much you!

First of all I would like to thank Drazan and the whole team.

Normally I have years of experience working with different webpages, wordpress, AEM, and more tools among these WPML, since I work with this one also with another website our tropicalcubanholiday.com and I have had problems but nothing compared to this last one.

It would be nice to have a formal guide about this if possible.

Thank you all very much and especially Drazan for reliable the support
Best regards
PR