Problem/Motivation

No easy way to translate Payment instructions

Currently there is no non-hacking / coding way to easily translate Payment instructions in this module. I posted a comment on an issue for another module #1928796-1: Payment instructions translation, thinking it was the one I had used as the basis for my payment module but it was this module. More comments have been added to that issue and someone pointed in that issue to a solution in another issue #1567214-4: Translating "Out of stock" and other messages set in Rules that is to add a Translate a text action before the Enable payment method.

The translate text does work. Here is a screenshot of my rule:

and an export of it is attached. Orange_Einzahlungsschein_payment_method_rule.txt

Here is the translation of the text part:

The text shows up in the Translate Interface (/admin/config/regional/translate/translate) section of the administration of the site.

I was able to translate it to German and add an action to display a message on the site. I used the variable with the translated text as the message text. I had to reload the page but the message showed in German(red box) while the original untranslated English(green box) showed up in the normal place.

Proposed resolution

Change input type from text format to a rules data selector

So why can we not get the translated text in the normal display area? The input box for the Payment instructions is a text format type. Which looks like this:

The code that creates this looks like this:

/**
 * Payment method callback: settings form.
 */
function commerce_pay_in_person_settings_form($settings = NULL) {
  // Merge default settings into the stored settings array.
  $settings = (array) $settings + array(
    'instructions' => array(
      'value' => 'Please pay for your order when you pick it up.',
      'format' => NULL,
    ),
  );

  return array(
    'instructions' => array(
      '#type' => 'text_format',
      '#title' => t('Payment instructions'),
      '#default_value' => $settings['instructions']['value'],
      '#format' => $settings['instructions']['format'],
      '#required' => TRUE,
    ),
  );
}

This does not allow us to select / enter the variable that contains the translated text. If possible, I propose changing the input for the Payment instructions to a rules data selector. This would allow the variable to be selected as the text. Text can still be entered using the switch to direct input mode button.

We are now adding French to the website in addition to German and English. Having these messages in 2 language was OK but having 3 is going to look even more crowded.

I also realize that I commented on another issue #1928796: Payment instructions translation under the wrong project. I thought I had used that module as the basis for my payment module but I had actually used the Commerce pay in person module and then change the module name and labels as our bank payments made using a reference number that is currently sent to the customer by email.

Thanks for your work on this module!

Frederick

Comments

jamescook’s picture

I'm facing a similar issue - need multilanguage (currently in the Bank Transfer module you mention) for this field.

In fact in our case it would be great to have replacement patterns in the string too for adding things like the "Verwendungszweck" (Order Nr.) or even something like (in the case of Orange EZS) a generated reference number.

Did you compare "Bank Transfer" to "Commerce pay in person" - just wondering if I should change.