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 following rules export is an example that translates all articles which are not already german or undefined to german using translator called test_translator (Microsoft in this case, but any translator that supports automated checkout should work).
{ "rules_auto_translate_with_microsoft" : {
"LABEL" : "Auto-Translate with Microsoft to German",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "tmgmt" ],
"ON" : [ "node_insert", "node_update" ],
"IF" : [
{ "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "article" : "article" } } } },
{ "NOT data_is" : {
"data" : [ "node:language" ],
"op" : "IN",
"value" : { "value" : { "und" : "und", "de" : "de" } }
}
}
],
"DO" : [
{ "tmgmt_rules_create_job" : {
"USING" : { "source_language" : [ "node:language" ] },
"PROVIDE" : { "job" : { "job" : "Job" } }
}
},
{ "tmgmt_rules_job_add_item" : {
"job" : [ "job" ],
"plugin" : "entity",
"item_type" : "node",
"item_id" : [ "node:nid" ]
}
},
{ "data_set" : { "data" : [ "job:target-language" ], "value" : "de" } },
{ "data_set" : { "data" : [ "job:translator" ], "value" : "test_translator" } },
{ "tmgmt_rules_job_checkout" : { "job" : [ "job" ] } }
]
}
}