When you write a custom checkout completion message, this text is not passed to t() when it's getted in line 128 in commerce_checkout.checkout_pane.inc in the function commerce_checkout_completion_message_pane_checkout_form().

That's a detail but I need it for my project ^^

Comments

rszrama’s picture

Status: Active » Closed (works as designed)

That's by design, though the text of the checkbox should probably be more strongly worded. When you store the message in a database variable, it cannot be translated using t(). The solution is to not use UI based translation and just provide alternate strings as translations of the one base string.

czigor’s picture

Status: Closed (works as designed) » Needs work

Implementing a hook_variable_info() in commerce_checkout.module would expose the variables for translation:

function commerce_checkout_variable_info() {
  $variable['commerce_checkout_completion_message'] = array(
          'title' => t('Commerce checkout message'),
          'type' => 'string',
          'description' => t('The message given after paying for an order'),
  );
  return $variable;
}

Patch is coming.

rszrama’s picture

What module uses this hook?

czigor’s picture

czigor’s picture

Status: Needs work » Needs review
StatusFileSize
new875 bytes

Here comes the patch.

rszrama’s picture

Issue tags: +1.1 blocker

Tagging to see if Variable is a module worth supporting for 1.1. Ultimately we'll need to expose many more variables besides just this one, and it might make more sense for those hooks to be implemented in a contrib (Commerce Variable) until we get them all covered and can move the support wholesale into a point release.

rfay’s picture

Hmm. I18N actually allows you to specify by name (in settings.php) variables that should be exposed to it for translation. (Or at least it did in D6). Isn't that the standard way to do this? If so, it requires no action here.

rfay’s picture

Status: Needs review » Needs work

IMO using variable would require a more explicit choice here. I'm going to check i18n and make sure it works here.

rfay’s picture

I didn't know it, but i18n_variable doesn't support contrib variables unless they support the variable module hook. So I guess something like this patch will be the way to go. However, I'm not actually able to get this to work currently with this patch (the language options don't show on admin/commerce/config/checkout/form/pane/checkout_completion_message)

I also think we should go with the yourmodule.variable.inc file as a way to do this, rather than adding the code inline.

Notes: If using the default message (the checkbox is not clicked) then just use stringoverrides or locale module and translate this string:

Your order is number [commerce-order:order-number]. You can <a href="[commerce-order:url]">view your order</a> on your account page when logged in.

If you're *not* using the default message, you would use i18n_variable in the i18n package AND variable module and translate the variable 'commerce_checkout_completion_message'. Instructions on how to do this are on the i18n_variable handbook page.

rfay’s picture

StatusFileSize
new1.68 KB

I'm going to run out of time to work on this today probably, but it does actually require more than the patch in #5 - the text_format type is not currently supported by default in the variable module.

Here's my current version. However, it does not yet work in the variable_admin administration.

rfay’s picture

Status: Needs work » Postponed

I think we should probably wait on this one until #1316436: Support #format (as in #type = 'text_format') gets some progress. I wasn't able to figure out how to set #format in that context.

rszrama’s picture

Issue tags: -1.1 blocker

Ok, thanks for following this through to the roadblock. Removing this from the 1.1 blocker queue.

rfay’s picture

Status: Postponed » Needs work

#1316436: Support #format (as in #type = 'text_format') has landed, so this can open up again.

mizi65’s picture

+1

ayalon’s picture

I tested the patch with "Variable 1.2". It includes support for "text_format". Although the variable is visible in the variable admin section, it is not possible to translate the message.

The variable setting text field on admin/commerce/config/checkout/form/pane/checkout_completion_message is not multilingual. It's also not possible to translatge it via translation interface.

Maybe rfay can have a look at the patch?

quiptime’s picture

The problem still exist!

quiptime’s picture

Category: task » bug
rszrama’s picture

Title: Checkout completion message not translatable. » Add Variable module integration for custom checkout completion messages
Category: bug » feature
Priority: Minor » Normal
Status: Needs work » Active

Per my comments in #1, the current functionality is by design. I'm updating the title to more accurately reflect what needs to happen - Variable module integration for this setting. It looks like the last patch wasn't sufficient to work with the latest version of Variable, so someone with a need here and experience with Variable is going to have to pick this back up.

citlacom’s picture

Status: Active » Needs review
StatusFileSize
new3.19 KB

Here the complete patch with the variables form integration to provide UI for message translation. I used the path dmin/commerce/config/checkout_message to provide the form that allow the translation of this message.

star-szr’s picture

@citlacom - I've applied the patch in #19 and navigated to the form at admin/commerce/config/checkout_message in both of my languages (one has a path prefix with the langcode) but I'm not able to save two separate values (one for each language on my site). Am I missing something?

facine’s picture

Status: Needs review » Reviewed & tested by the community

#19 works for me.

Thanks!

ayalon’s picture

#19 works.
But you have to go to "admin/config/system/variable/realm/language/configure" (Language Realm) and enable the variable. Then you will see, that the variable is now multilingual.

Attached an updated patch

Status: Reviewed & tested by the community » Needs work

The last submitted patch, commerce_checkout-multilingual-variable-1261012.patch, failed testing.

bojanz’s picture

Status: Needs work » Closed (duplicate)

I like #1196488: Allow checkout completion message to be translated better, it integrates with i18n_string instead.