Translatable boolean fields data comparison doesn't work. I don't mean translatable field properties (name, help text, etc...) but the field itself set as translatable (through entity translation). I know this might not be an usual use case, but you might want a checkbox that has different values for each language, which is how I found this bug.

To reproduce:

  • Install and activate Entity Translation module
  • Attach a boolean field to the users entity (Configuration > Account settings > Manage fields). Set this field as translatable at the end of the form (check "Users may translate all occurrences of this field")
  • Create a new rule that fires on Drupal initialization. As condition set "Data comparison", select the users' boolean field as TRUE or FALSE, it doesn't matter. As action set the system to show a message so you can see if it triggers or not.
  • Modify your user's boolean field and reload a page. See how, if you set the data comparison to TRUE, the message never shows, even when you check the boolean field.
  • Now if you go back to manage the accounts' fields, disable translation (and clear all caches), you will see that the rule triggers as expected depending on the data comparison. If you enable the field translation again, it won't work.

It took me some time to understand what was happening and I tried a lot of things before realizing what the problem was, so I can say I think the problem is in the rules.core.inc file in the includes folder, RulesPlugin class, getArgument function, line return isset($return[0]) ? $this->settings[$name . ':process']->process($return[0], $info, $state, $this) : NULL;. Apparently it calls the i18n function for text fields when making the comparison when the field translation is enabled. I'm not certain about it though, because I realized what the problem was at this point.