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.
Related to
#1457320: Document that t() should not be used for assertion message texts and groups and sub-issue #1803674: Remove t() from default test assertions in TestBase class
#500866: [META] remove t() from assert message
I just noticed that the function _simpletest_format_summary_line() is translating its output. It probably shouldn't be?
API page: http://api.drupal.org/api/drupal/core%21modules%21simpletest%21simpletes...
Comment | File | Size | Author |
---|---|---|---|
#5 | drupal8.simpletest-summary.5.patch | 2.37 KB | sun |
Comments
Comment #1
sunHah, thanks for pointing this out -- it might resolve some weird PHP shutdown function fatal errors I'm getting in
#1808220: Remove run-tests.sh dependency on existing/installed parent site
However, for Simpletest itself, I'm not sure whether this is required. The summary line is (or should be) printed in the full/regular environment of the parent site that runs a test.
Comment #2
jhodgdonReally, it needs to be translated? None of the assert messages are being translated, so I figured we also shouldn't translate the summary line?
If it does need to be translated, we should just close this as 'works as designed'. Or are you saying it needs to use st() or $t instead of t()?
Comment #3
jhodgdonOh, and if it can't use t(), then it also probably can't use format_plural(), right?
Comment #4
sunYeah, I don't really care... Simpletest module generally becomes exempt from t()/localization rules, it seems.
So we can remove the t()/format_plural() calls here, like this:
Closely related: #1601146: Allow custom assertion messages using predefined placeholders
Comment #5
sunPicking this up again. The summary should still not be translated today.
Comment #6
jhodgdonThanks! I have tested this patch manually in the Simpletest UI and it works fine.
I think the approach is good. It updates the tests properly and the slight change to having "and" vs. not having "and" in the test summary string is IMO fine.
Let's get it in -- we simply don't need to be translating these strings since we've decided everywhere else in the Simpletest UI that we are not translating.
Comment #7
catchCommitted/pushed to 8.x, thanks!