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.
The translation function is not used consistently throughout SimpleTest. In some places strings are automatically translated, but not in others.
Not auto-translated
- assert*([conditions], $message = "%s") - $message
- get_info - values in returned array
Auto-translated
- drupalPost($path, $edit = array(), $submit) - $submit
- clickLink($label, $index = 0) - $label
There may be other areas that I haven't listed, but we need to come to a consensus on how this should be done.
Comment | File | Size | Author |
---|---|---|---|
#6 | simpletest-remove-auto-t-236535-6.patch | 87.94 KB | webchick |
#4 | simpletest-remove-auto-t-236535-4.patch | 3.83 KB | webchick |
#3 | remove-auto-t-236535-3.patch | 3.81 KB | webchick |
Comments
Comment #1
webchickMy two cents is SimpleTest shouldn't do /any/ magical t()ing behind the scenes. I should have to wrap my submit button name in t(), and if I forget to, my test has a bug in it. SimpleTest trying to be "nice" for me just results in my never knowing whether I'm double t()ing or not.
However, I swear I had this conversation with Rok one time and thought that he explained it's somewhat trickier than that.
Comment #2
webchickHere are the weird cases I was able to find. Only other one was in locale.test, but that's probably expected.
This one is interesting. Basically, it's calling all the random SimpleTest functions that mean "Click on a submit button." The one it's t()ing is looking for button text sopecifically, where the others are looking for various attributes on HTML tags.
However, I still maintain that it's a bug not to have this t()ed in your original test if you in fact mean "Click on the thing labeled blah." However, it's confusing that this function can actually take any one of those types of submit texts.
This one can clearly go. It's just SimpleTest trying to safety net you. Don't safety net me. ;)
Comment #3
webchickHere's a patch that gets rid of the clickLink auto-t(). I'm still a little torn on the drupalPost one, since it could result in unintended consequences if you're after the "edit" ID, and there's a button on your page somewhere else named "edit". I'm not sure if this is likely to happen often enough for it to be a concern, but...
Comment #4
webchickHere's a re-roll after chx's browser patch went in.
Comment #5
webchickOk, looks like chx's patch also cleaned up the instance in drupalPost(), so that settles that. :)
However, now we need to make sure that the submit button names are t()ed properly in all the tests. Working on that now.
Comment #6
webchickOk here it is... drumroll...
This patch:
1. Removes auto-t()ing from clickLink
2. Makes all calls to clickLink('something') -> clickLink(t('something'))
3. Makes all calls to drupalPost(..., 'button') to drupal_Post(..., t('button'))
4. Fixes Windows line endings in trigger.test.
Comment #7
boombatower CreditAttribution: boombatower commentedCommitted.
Looks great.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.