Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding 40 languages to custom list failed in admin area #2417

Closed
squigglybob opened this issue Mar 22, 2024 · 5 comments · Fixed by #2509
Closed

Adding 40 languages to custom list failed in admin area #2417

squigglybob opened this issue Mar 22, 2024 · 5 comments · Fixed by #2509
Assignees
Labels

Comments

@squigglybob
Copy link
Collaborator

@corsacca Trying to add 40 languages for zume to the languages list on wp-admin/admin.php?page=dt_options&tab=custom-lists

failed at around 18

image-

@squigglybob squigglybob changed the title Adding 40 languages to custom list failed Adding 40 languages to custom list failed in admin area Mar 22, 2024
@corsacca corsacca added the bug label Mar 25, 2024
@corsacca
Copy link
Member

We'll want to update this to be a ajax post requestwith the changes instead of a php post.
Each translation adding ~100 fields to the post request and going over the max 1000 fields in the PHP POST

@corsacca
Copy link
Member

corsacca commented Apr 16, 2024

Files to update:

  • dt-core/admin/menu/tabs/tab-custom-lists.php
  • dt-core/admin/js/dt-options.js
  • dt-core/admin/menu/tabs/admin-endpoints.php

The _POST for adding a language contains the whole form and the updates for translations on each language:
image

Once ~1000 fields is reached, some hosts trim the _POST request.

Todo:

  • Remove the Table from inside the <form>. this will let adding languages work.
  • transform the "save" button to submit an ajax request to a new rest endpoint to update the languages and translations.

How we've fixed it in the past:
#2067

@CptHappyHands
Copy link
Contributor

@corsacca @squigglybob I am still working on implementing an ajax solution, but may have found a way to cut down on the huge requests in the mean time: https://www.loom.com/share/fa2486ca60cd486db30907dba3bdb88b?sid=38186f73-51ec-464b-aad1-1f148628d71c

@squigglybob
Copy link
Collaborator Author

I think that's not a bad idea as it will make any POSTs more efficient when the translations aren't being used.

You can see where the translations get used by navigating to /settings and scrolling down to the section "Languages you are comfortable speaking" The translations will show up here.

We have to assume the worst (best?) case, of these sections being fully translated. So while stripping out the empty translations will reduce POST size when they aren't there, the system still needs to be able to cope when the array is full of translations.

@corsacca corsacca self-assigned this May 1, 2024
@CptHappyHands
Copy link
Contributor

I think adding that last commit finishes this @corsacca. Unless I'm missing something.

@corsacca corsacca linked a pull request May 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants