Problem/Motivation

If you install your site with predefined polish language, then go to admin/config/regional/language/add page to add another language from the list of available languages, you encounter form validation errors for fields which doesn't exists in form (are hidden).

It happens because polish translations for both "add language" and "add custom language" buttons are the same, so both "value" and "name" are identical. That might be a case also for other languages.

Proposed resolutions

Fix Form API to use "english" value for "op" instead of translated one.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 2351667-add-lang-4.patch1022 bytesMaouna
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zaporylie’s picture

Issue tags: +D8MI

D8MI added for context.

zaporylie’s picture

Title: #validate breaks when more than one button has the same value. » Can't add another language (due to validation errors)
Issue summary: View changes
Priority: Normal » Major
Issue tags: +language-ui, +sprint, +Barcelona2015, +formapi
Maouna’s picture

Assigned: Unassigned » Maouna
Maouna’s picture

Component: forms system » language system
Status: Active » Needs review
FileSize
1022 bytes

I reproduced the bug and agree with the proposed solution. Here is a patch doing that.

In the LanguageAddForm we have two buttons, which are only distinguishable due to their different values. The problem is that this requires their values being different in all translation. Via adding a different name to each of them, we do not have to rely on that assumption anymore.

From my point of view this does not require a test, but if somebody sees that different, I can work on that, too.

Maouna’s picture

Assigned: Maouna » Unassigned
Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Fix looks simple. Tested. It certainly works for this form. It certainly does not fix it generally. I guess we can do it for this one for now and see if we need to generalize it when it comes up again. We had this behavior for years, and such bugs did not appear before.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Makes sense and fixes a bug and I agree that a test would be overboard. Committed a182684 and pushed to 8.0.x. Thanks!

  • alexpott committed a182684 on 8.0.x
    Issue #2351667 by Maouna, zaporylie, Gábor Hojtsy: Can't add another...
Gábor Hojtsy’s picture

Issue tags: -sprint

Thanks Maouna, zaporylie for making it possible to have multiple languages ;)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.