Hard to translate: "Required if you want to change the %mail or %pass below."

Created on 16 November 2010, about 14 years ago
Updated 14 September 2024, 3 months ago

Problem/Motivation

AccountForm::form() uses the following code.

$form_state->set('user', $account);

// The user may only change their own password without their current
// password if they logged in via a one-time login link.
if (!$form_state->get('user_pass_reset')) {
  $form['account']['current_pass']['#description'] = $this->t('Required if you want to change the %mail or %pass below. <a href=":request_new_url" title="Send password reset instructions via email.">Reset your password</a>.', [
    '%mail' => $form['account']['mail']['#title'],
    '%pass' => $this->t('Password'),
    ':request_new_url' => Url::fromRoute('user.pass')->toString(),
  ]);
}

Required if you want to change the %mail or %pass below. is problematic to translate in languages that use more than a definite article because, without knowing which word follows the article, it is not possible to decide which article must be used.

For example, in Italian the definite articles are il, lo, gli, i, la, and le depending on the word to which the article is applied. Without knowing what word follows the article, which in this case is replaced by %mail, I cannot know which article to use.
Furthermore, in Italian I could translate email with indirizzo email, indirizzo di posta elettronica, posta elettronica, or simply use email or mail as in English. With the article, those translations would become l'indirizzo email, l'indirizzo di posta elettronica, la posta elettronica, l'email, and la mail. (In l'email, l' is an elision for la, but differently from la, l' is written without spaces before the following word.)

In Norwegian, the definite article is an enclitic which is attached to the word. For example, the translation of the house is husen, while the translation of the car is bilen.
Even supposing I would know which definite article is used, I cannot attach it to the placeholder, which would change to a different placeholder (%mailen instead of %mail).

In both the cases, the sentence can be translated if what follows the definite article is not a placeholder.

The placeholder has been used to avoid to translate again the form element title, but using a placeholder after a definite article causes more translation issues.

Proposed resolution

In 'Required if you want to change the %mail or %pass below. <a href=":request_new_url" title="Send password reset instructions via email.">Reset your password</a>.', do not use the %mail nor the %pass placeholders.
Instead, a string like 'Required if you want to change the <em>Email address</em> or the <em>Password</em> field below. <a href=":request_new_url" title="Send password reset instructions via email.">Reset your password</a>.' should be used, where
Email address and Password are the title of the form elements which requires the current password to be changed.

Original report for Drupal 7

The string

Enter your current password to change the %mail or %pass. !request_new.

on user/n/edit is very hard to translate correctly because of the placeholders %mail and %pass. You really need to control the whole sentence to translate it properly. A couple of examples: In Norwegian, you don't use a separate word like "the" to get the definite form, you add an ending to the word instead. While in German, there are three different versions of "the" depending on the word it's pointing to.

There doesn't seem to be a good reason for these placeholders. The string should be changed to:

Enter your current password to change the <em>e-mail address</em> or <em>password</em>. !request_new.

🐛 Bug report
Status

Fixed

Version

10.4

Component
UI text 

Last updated 5 days ago

No maintainer
Created by

🇳🇴Norway zirvap

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Actually, Your current password is missing or incorrect; it's required to change the %name. is not easier to translate, not even in Italian.

    In Italian, the translation of Your current password is missing or incorrect; it's required to change the email. is La tua password corrente è mancante o errata; è necessaria per modificare l'email.. The translation of Your current password is missing or incorrect; it's required to change the password. is La tua password corrente è mancante o errata; è necessaria per modificare la password..

    In Russian, the translation for Your current password is missing or incorrect; it's required to change the %name. Your current password is missing or incorrect; it's required to change the email. Your current password is missing or incorrect; it's required to change the password. are the following.

    • Ваш текущий пароль отсутствует или неверен; необходимо изменить %name.
    • Ваш текущий пароль отсутствует или неверен; необходимо изменить электронную почту.
    • Ваш текущий пароль отсутствует или неверен; требуется сменить пароль.

    Also in this case, the sentence changes basing on what replaces %name.

  • 🇮🇳India amanbtr72

    amanmansuri72 made their first commit to this issue’s fork.

  • Status changed to Needs review 5 months ago
  • 🇳🇿New Zealand quietone

    There is some confusion here. I was referring to the string in the issue summary. The string in the issue summary is "Enter your current password to change the %mail or %pass. !request_new." That string was changed in core 2011, #1326172: Improve wording of the "Current password" field description on the user edit form , to "Required if you want to change the %mail or %pass below". That string is still in core.

    The string in #36, is different from those two. The string in #36 added in 2010 in [#8629]. So, I think that should be a separate issue.

  • Status changed to Needs work 5 months ago
  • The Needs Review Queue Bot tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    My comment was a reply to comment #35, which says:

    I tested this on 9.2.x and the string Enter your current password to change the %mail or %pass. does not exist in the code base nor in 8.9.x. It was replaced with <code>Your current password is missing or incorrect; it's required to change the %name.in #2418119: REST user updates bypass tightened user account change validation in March 2015. The new string is easier to translate (looking at the Italian translation right now).

    Since the string still exists in D7 moving to the Drupal 7 issue queue.

    I did not check which string was actually used, but that comment said the string used in Drupal 7 was replaced from Your current password is missing or incorrect; it's required to change the %name., which is them said to be easier to translate.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Even Required if you want to change the %mail or %pass below has the same issue the original string has: Other languages could have more than a definite article, or could use no definite article at all.
    In Italian, the definite articles are il, lo, la, gli, i, le, not considering that it is l'email, not la email, but it is la mail. Without knowing which word is used, after the article, I can just guess basing on the placeholder, with the consequence that l'mail or la email could appear, depending on my guess and what value is used for %mail.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    In Norvegian seems to be even more difficult, as the translation of la signora seems to be damen, while the translation of il bambino seems to be barnet. In both the cases, the bold part in the word is what replaces the article. (The translation of signora would be dam.)

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Active 5 months ago
  • 🇳🇿New Zealand quietone

    So, I came to two different conclusions based on my git research. That doesn't help this at all!

    I have updated the issue summary

    @avpaderno, do you have a suggestions to fix this?

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The solution is simple: Do not use placeholders after an article.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    (I forgot the link to the documentation page.)

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The only time the %mail is used in a translatable string is in the core/modules/user/src/AccountForm.php file.
    I would leave other cases of placeholder after an article to other issues.

  • Status changed to Needs review 5 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work 5 months ago
  • 🇺🇸United States smustgrave

    Could the issue summary be updated to the standard template please.

  • Status changed to Needs review 4 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    I apologize: I was not able to retrieve this issue.

  • Status changed to RTBC 4 months ago
  • 🇺🇸United States smustgrave

    Much appreciated @avpaderno believe the change is good.

    • catch committed 94d42a07 on 10.4.x
      Issue #973772 by drupal_was_my_past, avpaderno, joachim, tstoeckler,...
    • catch committed 353e737c on 11.x
      Issue #973772 by drupal_was_my_past, avpaderno, joachim, tstoeckler,...
  • 🇬🇧United Kingdom catch

    Committed/pushed to 11.x and cherry-picked to 10.4.x, thanks!

  • Status changed to Fixed 4 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024