This is an offshoot of #997884: t() documentation overhaul

Basically, the problem is that as things are currently in Drupal 7, some of the UI text we have in Drupal Core is difficult to translate. The reason is that we are using too much variable substitution. This example from dashboard.module will illustrate the problem.

      'description' => t('Customizing the dashboard requires the !permission-name permission.', array(
        '!permission-name' => l(t('Administer blocks'), 'admin/people/permissions', array('fragment' => 'module-block')),

The problem here is that the text "Administer blocks" is taken out of the string, and the person attempting to translate the string
"Customizing the dashboard requires the !permission-name permission."
might have to use different words for "the" and maybe other things (depending on the language), depending on what the text in !permission name is. For instance, according to kiamlaluno (posted on that other issue, comment #25), if the permission name was Administer Blocks, it would translate in Greek to
Προσαρμογή του ταμπλό απαιτεί την άδεια διαχείριση μπλοκ.
And if the permission name was Create new book pages, it would be
Προσαρμογή του ταμπλό απαιτεί τη Δημιουργία νέας άδειας βιβλίο σελίδες.
So the "the" is either την or τη depending on the first letter of the permission. This kind of thing also happens in Spanish, French, and other languages, and certainly some other languages have even more complicated things happening than just picking a version of "the" to use. Even in English, we use "a" before a consonant and "an" before a vowel, so you can see why something like this could be important.

I will note that the reason these strings were done this way was in an attempt to make sure that the permission name "Administer blocks" was translated the same way everywhere it occurs on the site. But given that it screws up the ability to translate the longer text, we can't do this.

So for cases like this where a variable substitution is being used but the text doesn't vary (it is always "Administer blocks" in this case), it should not be pulled out into a variable. We will still need to continue to use variables for cases where we're substituting in something that is really variable, like a user name, and there is no way around it, even though those may also have translation problems.

So this example should be doing:

     'description' => t('Customizing the dashboard requires the <a href="!permission-url">Administer blocks</a> permission.', array(
        '!permission-url' => url('admin/people/permissions', array('fragment' => 'module-block')),

There are many other similar spots in Core that need to be fixed. This should really be done for D7, but so many strings would need to be changed that I'm filing it against D8 instead.

Comments

jhodgdon’s picture

There is still a link left to this spam tag above. Is there some way that can be removed?

apaderno’s picture

The problem is also for languages where the article is appended to the substantive, and the postfix part depends from the word, which is what happen in Swedish.

For example, the Swedish word for apple is äpple, but "the apple is red" is translated with äpplet är rött (litterally, "apple-the is red").
The problem in this case is that %permission-name could be a single word, and in that case the definitive article is translated with a postfix that changes basing on the word to which the article is added, or it is a quote, or a phrase that works as noun.
With Italian, the problem would not be with the sentence taken as example, where "the %permission-name permission" would be translated with il permesso %permission-name. Still, there would be a problem with "the %object-name," as in Italian there isn't just a definite article, but 6 (il, lo, la, i, gli, le).

For this case, the only workaround I can think of is to avoid using the article before a placeholder. If the sentence would be "Customizing the dashboard requires the right permission (%permission-name)." the problem would be resolved.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

apaderno’s picture

Version: 8.6.x-dev » 8.7.x-dev

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

catch’s picture

Status: Active » Closed (outdated)

This issue was opened ten years ago, we don't have the string in the issue summary in core any more, and a lot of other strings have been overhauled. Going to go ahead and close this out without extant examples to refer to.

The proper way to add links to strings is already documented at https://www.drupal.org/docs/7/api/localization-api/dynamic-or-static-lin... and elsewhere.

catch’s picture

Issue tags: +Bug Smash Initiative