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.
After applying the attached patch you'll be able to choose a message type. Being 'error', 'warning' or 'status' - as defined by drupal_set_message();
I wanted this because 'error' is kinda heavy to show to a first-time user trying to access pages/functionality. The guy/girl didn't do anything wrong. So I prefer 'warning' even if it still isn't ideal.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1719342_edit_message_type.patch | 1.5 KB | greggles |
r4032login-message_type.patch | 1.45 KB | PieterDC | |
Comments
Comment #1
deekayen CreditAttribution: deekayen commentedSInce this touches on it, t() shouldn't wrap variables.
Comment #2
gregglesI believe that requirement is no longer relevant.
Comment #3
gregglesRe-rolled so that it applies to 7.x-1.x-dev.
In spite of what the docs say, I really do think that it's fine to do t($foo) if $foo is some complete string entered by site administrators.
Comment #4
iamEAP CreditAttribution: iamEAP commentedt($foo) is a no-no. The problem is twofold:
To properly translate Drupal variables, you're looking for this kind of thing. Where you're registering your variable with the Variable module and i18n_variable is taking care of things behind the scenes for you (so you can
variable_get('your_variable');
and it'll return the localized value for you, without having to run it through anything liket()
). Something like this:Note that this does not create a dependency on Variable, or i18n. It just allows sites that have a need for variable translation to localize your variable (because they would have those modules installed and enabled and know how to use them already).
Comment #5
gregglesOK, awesome, thanks for the explanation. It seems like that can be a followup in its own issue (indeed it is at #1138562: Integrate with i18n_variable) and we can just go ahead here with #3.
Comment #6
greggles#3 still makes sense and still applies.
Any reason not to commit it?
Comment #8
deekayen CreditAttribution: deekayen commented8.x got started on this project
Comment #9
deekayen CreditAttribution: deekayen commentedComment #10
bdone CreditAttribution: bdone commentedworking on adding this to the 8.x-1.x branch.
Comment #12
bdone CreditAttribution: bdone commented