Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295466

Exception is thrown on changing "Site language" setting of a user if user account is translated

$
0
0

Problem/Motivation

An exception is thrown on changing Site language setting of a user under /user/<uid>/edit if that user account is already translated to that target language.

Steps to reproduce:

  1. Install Drupal standard profile in default English language.
  2. Enable Language, Content Translation and Interface Translation modules.
  3. Add Language e.g. Hindi under /admin/config/regional/language.
  4. Enable translation for user accounts by checking Enable translation under admin/config/people/accounts.
  5. Translate user account to enabled language in step 3. In this case, Add Hindi translation at user/1/translations
  6. Now change Site language setting for user at user/1/edit. In this case, change it to Hindi. An uncaught exception will be thrown (mentioned below).
  7. If the translation of user account is not added (step 5) then you can change the Site language setting of the user. You can delete the translation added in step 5, now you can change the Site language of the user.

Error thrown:
Uncaught PHP Exception InvalidArgumentException: "A translation already exists for the specified language (hi)." at core/lib/Drupal/Core/Entity/ContentEntityBase.php line 810

Proposed resolution

Added a check on syncing user entity language and user preferred language only when a user registers, but not when updating / translating the user.

Remaining tasks

User interface changes

API changes

Data model changes


Viewing all articles
Browse latest Browse all 295466


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>