Fix admin language selector with more than 4 locales#9519
Fix admin language selector with more than 4 locales#9519ahukkanen merged 8 commits intodecidim:developfrom belighted:fix/language-selector
Conversation
The field disappears when there are errors in the form and select a different language for this field.
ahukkanen
left a comment
There was a problem hiding this comment.
Thanks for the fix @sergei-krylov.
I have left few comments regarding some architectural issues this change would introduce as-is. Could you please fix the described issue?
Also, please revert all changes you have done in the locale files (*.yml) as you should only change the en.yml files when adding new strings, removing strings or modifying the source locale strings as explained at:
https://docs.decidim.org/en/contribute/translations.html
I went ahead and applied all the changes from this PR to Crowdin, so they should be fixed once we merge the Crowdin pull requests the next time (before the next releases).
ahukkanen
left a comment
There was a problem hiding this comment.
One more thing I realized during the testing regarding this method. Could you see my comments below?
We are also trying to migrate slowly away from jQuery so we kindly ask for any new code to be implemented without jQuery and I think this would be rather simple to migrate. Could you take care of that too?
And with this I only mean the choose_language.js, no need to refactor the forms related JS, as that would be much more work (and would not be related to the bug being fixed, so it should be handled separately from this).
|
Thank you very much for the review @ahukkanen ! |
ahukkanen
left a comment
There was a problem hiding this comment.
Thanks for the refactoring @sergei-krylov, looking really good now!
I just left few more ideas regarding code cleanup and after these it's good to go for me!
|
@ahukkanen , thanks for the tips! |
|
Thanks! There's still some ESLint issues after the latest changes, could you take a look at those? Suggesting also adding ESLint plugin to your code editor to see these while you write code. |
Typo. Change back "click" to "change" Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
…ging * feature/redesign-main-footer: Reorder elements in main links of footer and define links and texts Define a cell for static_pages and topics configured to appear in footer Fix translation call Set fixed links in redesigned_main_legal partial Add FooterMenuPresenter to display menu items in footer Fix budgets seeds on non development apps (#9585) Return 404 when there isn't a valid component in program (#9576) Add missing queue close_meeting_reminder to sidekiq configuration (#9568) Make the HERE Map display in the currently selected language (#9552) Add help text for proposals' 'publish answers immediately' setting (#9549) Fix admin language selector with more than 4 locales (#9519) Fix publish event on official proposals (#9421) Prevent missing ActionLog entries to break the application (#9502) Add boilerplate structure to CHANGELOG (#9501) Add step-by-step instructions of the Crowdin releases process (#9555) Fix translated attributes field type change (#9547) Add `modifyList` option to the autocomplete element (#9548) Admin log filters (#9460) Improve the default gitignore files created by the generators (#9507)
* Fix language selector doesn't work for newly created fields. The field disappears when there are errors in the form and select a different language for this field. * Fix translations of language with errors for language selector. * Disable require-jsdoc * Revert "Fix translations of language with errors for language selector." This reverts commit cda01ac * Refactoring of onchange function calls, reimplement without jQuery. * Refactor select change event * Fix linters * Update decidim-admin/app/packs/src/decidim/admin/choose_language.js Typo. Change back "click" to "change" Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
🎩 What? Why?
A few issues in admin panel when using more than 4 languages with questionnaires (decidim-forms):
First issue is that when you add
📌 Related Issues
Link your PR to an issue
Testing
Prerequisites:
config.available_localesshould contain more than 4 languages, so language selector will change from "tabs" style to "select" style.📷 Screenshots
Video explaining all 3 issues
On that video the default language of the organization is
:fr!