Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
'#markup' => SafeMarkup::format('<p>Translations will be downloaded from the <a href="http://localize.drupal.org">Drupal Translation website</a>.
If you do not want this, select <a href="!english">English</a>.</p>', array(
'!english' => install_full_redirect_url(array('parameters' => array('langcode' => 'en'))),
History
Was changed
- From a plain string to
SafeMarkup::format()
in this issue. #2185583: Allow to select "English" language via mouse click in installer language selection screen - Lost translation in this issue #1848490-45: Import translations automatically during installation
Proposed resolution
Remove translation and use of SafeMarkup::format(). No translation for the string will ever be used, because it is displayed before translations are downloaded.
Remaining tasks
User interface changes
API changes
Data model changes
Follow-up to #2564353: Remove !placeholder usage from SafeMarkup::format()
Comment | File | Size | Author |
---|---|---|---|
#20 | 2565981.14.patch | 3.09 KB | Gábor Hojtsy |
#14 | 2565981.14.patch | 3.09 KB | alexpott |
#14 | 12-14-interdiff.txt | 648 bytes | alexpott |
#12 | 2565981.12.patch | 3.1 KB | alexpott |
#9 | translate_instead_of-2565981-9.patch | 1.49 KB | joelpittet |
Comments
Comment #2
alexpottComment #3
joelpittetComment #4
joelpittetAdded history context to the issue summary.
Comment #5
joelpittetAha! I found the issue that this was lost it's translation in! #1848490-45: Import translations automatically during installation
Comment #6
joelpittetSuggestion from @alexpott, moved the
<p>
outside the translated string into prefix/suffix.Comment #7
stefan.r CreditAttribution: stefan.r commented+1 to this
Comment #8
tstoecklerWell you can't really say the translation was "lost" as these strings will never actually be translated in the actual sense of the word as we don't have any translations yet at this point. That doesn't make this fix any less correct, though.
The weird thing is that with this the string will end up on localize.drupal.org so people will translate it, but they will never actually see it translated, so maybe that's a usability problem then? On the other hand, if people ship distributions with pre-set translations then they would want this to be translated? Maybe we could even ship "Pre-translation-download-strings" in a bunch of languages with D8 core in the future? Hmm...
Maybe we should run this by @Gábor Hojtsy?
Since we're already touching this, IMHO we should fix the "multiline-ness" of the translated string. That's very non-standard in core, and results in weird markup (and weird translator's experience).
Comment #9
joelpittet@tstoeckler thanks for the review and notes. I've removed that weirdness in multi-lineness. @Gábor Hojtsy has been pinged by @alexpott and I'll assign this to him.
"lost" translates to removed by accident;) Or what I meant anyway.
Comment #10
tstoecklerYay, thanks a lot. Looks good to me, but will let @Gábor Hojtsy RTBC in case there are no reservations.
Comment #11
Gábor HojtsyAgreed with
As for
I don't think the .po file would be read at this time even if available. Also it would need to be in a sites/X/files/translations directory. Not sure how distros could ship with that (due to its dynamic site specific location). Also even distro PHP code does not have a chance to run at the time of this form (to download a .po file to that dynamic location). So I don't know how would that work for this form. As for doing in the future, we can add t() when/if we get there. Now its a lie.
Comment #12
alexpottSo let's go the other way and remove t() completely and add a comment - we can also improve security by removing the
SafeMarkup::format()
and letting XSS filter do it's job.Comment #13
Gábor HojtsyRetitled. Looks good except:
none is not translated
Comment #14
alexpottThanks @Gábor Hojtsy
Comment #15
Gábor HojtsyYay, looks good.
Comment #16
joelpittetCouldn't I put this in a settings.php like config in a distribution?
I've included hard coded translations like this in d7 in my settings.php.
Also there are other translations in this file that also should be removed if this solutions is correct?Edit Alex removed them all(on phone, didn't see code)
Comment #17
alexpott@joelpittet if you've got a settings.php why are you in the installer?
Comment #18
joelpittetTouché, glad I'm reviewing code when I wake up next to my phone...
Comment #20
Gábor HojtsyNot sure why this broke all the installer forms. Reuploading as a retest, so we have the results up for posterity.
Comment #21
joelpittetReRTBCing this.
I feel we should keep the translation and hopefully make the strings translatable on the installer in the future. But I don't want to hold up the fix here, so no need to block.
Comment #22
xjmSo, currently, the summary says that the string should be translated. But the comment in this patch and the discussion indicate the opposite, because the translations aren't available yet when the form is displayed. So I've updated the summary to clarify that.
Committed and pushed to 8.0.x. Thanks!
Comment #24
Gábor HojtsyYay, thanks!