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.
It could be useful to have a "Current language is [X]" condition.
Comment | File | Size | Author |
---|---|---|---|
#18 | 1472316-18-language-condition.patch | 2.01 KB | TR |
#17 | 1472316-17-language-condition.patch | 2 KB | TR |
| |||
#3 | rules_language_condition_3.patch | 2.57 KB | Letharion |
rules_language_condiation.patch | 2.47 KB | Letharion | |
Comments
Comment #1
fagoSounds good. You can do that already with the latest entity api and the language properties (in site:), however I think it's important enough to justify a separate condition.
Should start capitalized and end with a trailing point.
As there might different UI and content languages, maybe should be clear here and say "Current interface language is".
Needs a label and should use 'token' as type.
Just skip the access callback.
Comment #2
Letharion CreditAttribution: Letharion commentedComment #3
Letharion CreditAttribution: Letharion commentedComment #5
Letharion CreditAttribution: Letharion commentedAs far as I can tell, the test fail is about sending e-mails out, and unrelated to my patch?
Comment #6
ShadowMonster CreditAttribution: ShadowMonster commentedIt is already on dev or you going commit it soon? - I will be happy to see it in rules :)
Comment #7
mitchell CreditAttribution: mitchell commentedRetesting.
ShadowMonster, it hasn't been committed to dev. If you would like to help, please review the patch and post your feedback or track down why that test has failed.
Comment #8
mitchell CreditAttribution: mitchell commentedIssue to fix the broken test: #1540266: Fix broken simpletests.
Comment #9
interX CreditAttribution: interX commentedThe patch seems to work for me, thanks
Comment #10
mitchell CreditAttribution: mitchell commentedComment #11
klausiwrong comment?
There should be an empty line between the function short description and the additional description. Also elsewhere.
Label should be fixed according to fago's comment.
Comment #12
hansrossel CreditAttribution: hansrossel commentedI think this has been fixed allready in #1422996: localization and i18n integration.
[update]: I did not read fago's comment #1 well 'You can do that already with the latest entity api and the language properties (in site:), however I think it's important enough to justify a separate condition.'.
So the method below is how you can do it with site:
In the current stable Rules 2.2 you can set a condition:
there is available:
site:current-page:language, Interface language The language code of the current user interface language.
site:current-page:language-content, Content language The language code of the current content language.
Comment #13
yuseferi CreditAttribution: yuseferi commentedrules_language_condiation.patch queued for re-testing.
Comment #15
MURANJO CreditAttribution: MURANJO commented#12 worked perfectly for me. I did not install or patch anything. I only used rules and created different payment methods with different languages. Then I made them available depending of the language of current page.
Many thanks!!
Comment #17
TR CreditAttribution: TR commentedThe patch in #3 no longer applies, which is no surprise because it's so old.
Here's a re-roll against the current HEAD. Uploading so the test bot can look at it.
All the other core integrations have tests in rules.test, so this new condition should also.
Comment #18
TR CreditAttribution: TR commentedAgain, with a few coding standards fixes.
Comment #19
TR CreditAttribution: TR commentedIt's been 2 years since I re-rolled the patch, but no one has found this important enough to review or to contribute to.
D7 Rules is basically in maintenance-only mode right now, as D7 is nearing its end-of-life. So I'm moving this to the 8.x-3.x branch for consideration.
I'm still willing to consider this for D8/D9 Rules, but I'm not going to work on this myself. If you find this useful and want to see it in Rules or in a contributed module like D8RE, then what we need here is a patch for Rules 8.x-3.x along with some tests cases to prove these new features are working.
Postponing this issue until someone thinks it's worth spending time on.