follow-up from #1422996: localization and i18n integration:

We should enhance the data-selection widget to have its own language setting included optionally. For that we need to improve the import/export structures and array structures in a BC way.

Work-a-round:
In the meanwhile the "Select a translated value" action provided by the "Rules translation" module can be used to get the translated value as a separate variable which then can be selected in the target action.

Comments

guy_schneerson’s picture

Component: Rules Core » Rules Engine

Rules translation works for me, i used it on Stock V2 to translate the "out of stock" message Translating "Out of stock" and other messages set in Rules
However is there a reason why the module should not be pathing the text set by the action through t() providing localization out of the box?

geek-merlin’s picture

Component: Rules Engine » Rules Core
Issue summary: View changes
Related issues: +#2209607: "Provided" text variables are always sanitized
hosais’s picture

I would like to use rules to send translated Email message. I supposed I can use "Select a translated value" action to have the langauge content saved in message type. I make the following rule but it does not work. Anyone can tell me what is the problem? Thanks.

 { "rules_commerce_order_message_order_shipped" : {
    "LABEL" : "Commerce order message: order shipped",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_i18n", "message_notify", "entity" ],
    "ON" : { "commerce_order_update" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "commerce-order:status" ], "value" : "completed" } },
      { "NOT data_is" : { "data" : [ "commerce-order-unchanged:status" ], "value" : "completed" } }
    ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "message",
            "param_type" : "commerce_order_products_shipped",
            "param_user" : [ "commerce-order:owner" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "rules_i18n_select" : {
          "USING" : { "data" : [ "entity_created" ], "language" : "es" },
          "PROVIDE" : { "data_translated" : { "entity_created_es" : "Entity Created in Spanish" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:message-commerce-order" ],
          "value" : [ "commerce-order" ]
        }
      },
      { "entity_save" : { "data" : [ "entity-created-es" ], "immediate" : 1 } },
      { "message_notify_process" : {
          "message" : [ "entity-created-es" ],
          "save_on_fail" : 0,
          "save_on_success" : 0
        }
      }
    ]
  }
}