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
Comment #1
rszrama commentedThat'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.
Comment #2
czigor commentedImplementing a hook_variable_info() in commerce_checkout.module would expose the variables for translation:
Patch is coming.
Comment #3
rszrama commentedWhat module uses this hook?
Comment #4
czigor commentedThe Variable module.
http://drupal.org/project/variable
Comment #5
czigor commentedHere comes the patch.
Comment #6
rszrama commentedTagging 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.
Comment #7
rfayHmm. 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.
Comment #8
rfayIMO using variable would require a more explicit choice here. I'm going to check i18n and make sure it works here.
Comment #9
rfayI 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:
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.
Comment #10
rfayI'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.
Comment #11
rfayI 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.
Comment #12
rszrama commentedOk, thanks for following this through to the roadblock. Removing this from the 1.1 blocker queue.
Comment #13
rfay#1316436: Support #format (as in #type = 'text_format') has landed, so this can open up again.
Comment #14
mizi65 commented+1
Comment #15
ayalon commentedI 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?
Comment #16
quiptime commentedThe problem still exist!
Comment #17
quiptime commentedComment #18
rszrama commentedPer 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.
Comment #19
citlacom commentedHere 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.
Comment #20
star-szr@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?
Comment #21
facine commented#19 works for me.
Thanks!
Comment #22
ayalon commented#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
Comment #24
bojanz commentedI like #1196488: Allow checkout completion message to be translated better, it integrates with i18n_string instead.