Skip Navigation

[Resolved] Search Form on AJAX refresh turns to default lang (en) – WPML AJAX supp. is ON

This support ticket is created 3 years, 8 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 9 replies, has 2 voices.

Last updated by blazM-4 3 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#2073561

I am trying to:
Select checkboxes on a search form and get automatic AJAX refresh

Link to a page where the issue can be seen:
hidden link

I expected to see:
a Refreshed Form still in SL language

Instead, I got:
the refreshed form in EN language (default one). Reload page (F5) restores the lang. Cookie wp-wpml_current_language is present.

#2073715
Screen Shot 2021-06-01 at 11.23.23 AM.png
Screen Shot 2021-06-01 at 11.23.10 AM.png

Hello, I'll be glad to take a closer look. At first glance, I can see there is one syntax error in the browser console when I load the page. The error is here:

 //jQuery(function() { console.log("Anything?"); })
 //})
})  jQuery(function(){
// reads all checked TOs and Categories and WRITES them into cookies
 jQuery('#all-calls-button').click( function( event ) { 

There should be a semi-colon before the jQuery after logging Anything?, like so:

 //jQuery(function() { console.log("Anything?"); })
 //})
});  
jQuery(function(){
// reads all checked TOs and Categories and WRITES them into cookies
 jQuery('#all-calls-button').click( function( event ) { 

If you will make that correction, I can continue investigating the language persistence issue.

#2073909

Christian, I apologize.
I believe this is ok now, and unfortunately, the issue is still there.
At reload all is in Slovenian. When I click, it changes to english.

#2074037

Thank you for the update, I'm running a test locally to see if I can replicate this problem in a similar setup. I'll give you an update before the close of my shift today.

#2074081

I've set up a custom search View with taxonomy filters, and added some content in multiple languages, but I'm not able to easily replicate the problem you are experiencing where the taxonomy filters update with the default language terms as I adjust the filters for search. Can you confirm your Toolset and WPML plugins are all up-to-date? You can check in wp-admin > Plugins > Add New, click the "Commercial" tab and then "Check for Updates" in the WPML updater panel. Update any plugins needed. After the page reloads, you can click "Check for Updates" in the Toolset panel as well, and update those plugins as needed. The most recent version of Blocks / Views fixed an issue with custom search filters, so I'd like to confirm this is unrelated.

If you're using the latest plugin versions and the problem continues, I'll need to log in and take a closer look to check your setup and configurations to understand what is going on here. Please provide login credentials in the private reply fields here, and I will continue investigating.

#2074943

Hi, I was able to log in but it seems this User account has somewhat limited access in wp-admin. Is it possible to grant this User administrator-level access so I can see all the relevant WPML and Toolset features in the dashboard?

However, if I create a new page with a view and use just standard fields without my styled checkboxes (with a js-wpv-filter-trigger") the problem does not exist. I just can't organize them, add icons nor tooltips, so this is why I'd prefer to make this work.
Does this page with the standard search fields still exist in staging? If so, can you share the URL? I would like to see it if possible, so I can compare the filter markup, JavaScript functionality, and AJAX call details from both pages.

#2075045

As I was writing to you I realized I made a big mistake: I am developing the site in English and since our first country is actually our own and we have all the data in the local language it is highly ineffective to having all this laboratory development work done with and through WPML.
I would ask you to suspend this ticket for a day or two, for me to test how I can develop it in Slovenian and then move to WPML and international setup.

And, I would have a question, how I could proceed:

1. My website's primary language is English, without a subdir and with Slovenian in a subdir.
2. I would like to continue to develop now in Slovenian language which is in /sl subdir.
3. So the questions:

a. Can I do it in /sl subdir with local copies that later I can migrate/copy/translate to English and make them originals

and

b. I can have Slovenian as a primary development language also in future (for archives, templates, views etc.) and in terms of website (root dir vs. subdirs) English can remain default.
or
c. I should make now Slovenian as default (root) and do everything normally. I just worry about moving it now.

#2076453

Yes of course, I will stand by while you investigate the changes necessary to migrate from default language English to default language Slovenian. My answers to your questions so far:

a. Can I do it in /sl subdir with local copies that later I can migrate/copy/translate to English and make them originals
c. I should make now Slovenian as default (root) and do everything normally. I just worry about moving it now.
Let me make sure I understand. It sounds like you already have some content (posts, Views, Content Templates, WP Archives, Forms, etc.) created in the default language English. It sounds like you have already translated some of that content into the secondary language Slovenian. Now you are considering changing to use Slovenian as the primary language, and use English as the secondary language. You would like to know how to handle existing content.
- Should the existing content be recreated in Slovenian default language and translated?
- Or should you try to keep the existing content and translations in the existing site, but set the Slovenian translations to be the "original language"?
I will ask my 2nd tier team because I'm not sure what is the best option here, and how to handle different types of content like posts, Views, templates, archives, and forms. I will let you know what I find out.

b. I can have Slovenian as a primary development language also in future (for archives, templates, views etc.) and in terms of website (root dir vs. subdirs) English can remain default.
It sounds like you are asking about this directory/language setup:
- Primary language Slovenian.
- Develop Toolset content like WP Archives, Views, Content Templates, Forms, etc) in Slovenian.
- Include Slovenian-language post URLs in the /sl/ directory.
- Secondary language English.
- Include English-language post URLs in the default path with no /en/ directory.
This setup is not one of the built-in options in WPML, so I think it would require a custom code solution. The built-in subdirectory setup requires subdirectories for secondary languages, and provide an optional subdirectory for the primary language.

#2080477

I've asked my second tier support team for additional information here, and I got some feedback. The general response is that we expect things to work, but there is no documented example of this type of change in an existing site. We ran some tests to try it out and found one issue with editing Content Templates after changing default language. It was not possible to edit templates directly from Toolset > Content Templates, regardless of the language they were created in. The only way to edit that template was to edit a post where the template was assigned and click the link to edit the template from the post editor screen. Forms seemed to work well. So the best advice is to try switching languages first in a staging site, then report any problems you encounter and we can address those as bugs.

#2091443

My issue is resolved now. Thank you, Christian and the team!