Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
aggregator.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2013 at 15:08 UTC
Updated:
29 Jul 2014 at 21:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
simon georges commentedPlease review the following patch.
Comment #2
jmarkel commentedSince you're changing the messages to be the same, why not build the message once as a variable and then use the variable, instead of rebuilding the message twice? I.e.:
Less error-prone for the future, and probably saves a few cpu cycles too.
Comment #3
simon georges commentedBecause a watchdog message shouldn't be translated, as it will be later, during the watchdog call (at least I think).
Comment #4
jmarkel commentedThat's so but, because the exact same message is being used and that message will have already been translated, it seems to me that there's no reason to put it through translation twice. If the substitution values have been translated for the watchdog() call, it's hardly likely that the exact same message will be translated into a different language for the immediately following drupal_set_message(t()) call.
Comment #5
simon georges commentedOh, yeah, you're totally right! Something like that, then?
Comment #6
jmarkel commentedLooks good to me - and passes all tests for Aggregator...
Comment #7
tstoecklerEven if it will probably not cause problems on actual sites as #4 explains, it is still wrong to put a translated message in watchdog(). Additionally the string parser cannot pick up variables in t(), so this patch would actually make the string untranslatable.
Let's just use duplicate the strings here, it's not the end of the world. For the variable substitutions it might (or might not) make sense to use a $args variable and pass that to both watchdog() and the t() inside drupal_set_message().
Comment #8
simon georges commentedIn watchdog() api documentation, it's stated that
$variablesparameter should contain, so that's what I did.
The strings in t() call are not variables but placeholders accepted by the
format_string(), as stated in t() api doc and format_string() api doc, so I don't really understand your argument here.Comment #9
tstoecklerYes, sorry I mixed that up in my head. What I meant was that you shouldn't do
t($message)(i.e. with a $message variable) because that is not translatable. Obviously the patch doesn't do that.I did not know that we explicitly allow setting variables NULL and therefore to bypass translation in watchdog(). It still feels wrong to me (and it is also unnecessary in my opinion), but I checked theme_dblog_message() and it does account for that case, so there really is no technical case to be made here.
My personal feelings shouldn't hold this issue up, but I would still suggest to have another person take a look at this, therefore setting to "needs review".
Comment #10
simon georges commentedSure, I agree, let's see what the rest of the community thinks ;-)
Comment #11
jmarkel commented#5: aggregator-1906692-5-string_cleanup.patch queued for re-testing.
Comment #12
jmarkel commentedThere's nothing been heard here, so I re-queued to make sure the patch still passes testing. If it does, I'm going to RTBC it again.
Comment #14
jmarkel commentedSince the original patch was posted, aggregator/aggregator.parser.inc has been replaced by aggregator/Plugin/aggregator/parser/DefaultParser.php. That's why the patch fails testing now.
So I re-rolled the patch with the appropriate changes to .../DefaultParser.php.
Now someone other than me needs to review it...
Comment #15
simon georges commentedPatch still applies.
Has someone with a deeper core knowledge an objection to this being committed?
Comment #16
ParisLiakos commentedwell, this removes the ability of translating the string on runtime (eg when displaying on the Recent log entries page)
what we could do here, is make both string the same.. eg use "due to" or "because of" in both cases
Comment #17
simon georges commentedThat was the first patch of the issue ;-)
Comment #18
simon georges commentedRe-roll of the 1st patch of the issue on the current 8.x-dev version.
Comment #19
ParisLiakos commentedthanks
Comment #20
alexpottConsistency++
Committed 02c8071 and pushed to 8.x. Thanks!
Comment #21
simon georges commentedThanks! Now, let's see if we'll find others.