The following two strings:

  • "Shipping quotes are generated automatically when you enter your address and may be updated manually with the button below." (part of uc_quote)
  • "Your billing information must match the billing address for the credit card entered below or we will be unable to process your payment." (part of uc_credit)

Cannot be translated and are always displayed in English, despite having the appropriate variable names appended to $conf['i18n_variables'] in hook_init(). Translating the strings via "Translate Interface" has no effect, and the usual "This is a multi-lingual variable" text that typically appears on text entries in the store configuration does not appear.

In i18n/i18n.module, the following check is performed in i18n_form_alter():

      if (isset($form['#theme']) && $form['#theme'] == 'system_settings_form' && $variables = variable_get('i18n_variables', 0)) {

It seems that because the $form['#theme'] is not "system_settings_form" for these two forms, they don't get blessed by i18n.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stewart.adam’s picture

Title: Shipping quotes and credit card information strings cannot be translated » Shipping quotes and credit card information strings do not show multi-lingual description message

Sorry, not sure what is going on here. This wasn't working for days, and suddenly it started working today (maybe caching issues on my side?).

Either way, the multi-lingual variables feature is working correctly however the above post is still correct in saying that the "This is a multi-lingual variable" text is not added to the text field descriptions.

krabbe’s picture

Same problem here. I translated the strings via "Translate Interface" but the German translation doesn't show up on checkout page.

So, I can hope, this issue will fix itself?

nick.dap’s picture

Status: Active » Needs review
FileSize
2.02 KB

Found the problem. If the descriptions and message were loaded from config, they weren't translated.

Status: Needs review » Needs work

The last submitted patch, shipping_quote_messages_translation.patch, failed testing.

TR’s picture

Project: Ubercart » Internationalization
Version: 6.x-2.4 » 6.x-1.x-dev
Component: User Interface » Code

@nick.dap: No. That patch is just wrong. You can't use t() like that. Read the API documentation for t() to understand why.

The problem here seems to be that the i18n module insists that multilingual variables should only be defined by a system_settings_form(). This is an incorrect assumption, and should be corrected in the i18n module.

nick.dap’s picture

Didn't know that, sorry. To be honest, I've read the doc page and still don't understand what's wrong with this. Would you please explain?

It seems that the string can be either "default" or w.e is defined in the admin page. You take either one and pass it through the translate function. Why is that wrong? Why is passing the default ok and passing the defined not ok? This is not content per-se and is analogous to passing the "description" of a form field through t(), which is done all the time it seems.

stewart.adam’s picture

> Didn't know that, sorry. To be honest, I've read the doc page and still don't understand what's wrong with this. Would you please explain?
The problem here is that t() should never be used to translate a variable. Instead, fix the problem at source - the variable itself. In this case, we should not pass the stored value of uc_quote_pane_description through t() but instead fix the problem in i18n so that uc_quote_pane_description can be translated properly.

PieterDC’s picture

Component: Code » Blocks

I agree with TR and firewing1, but it was faster for me to patch the Ubercart Quote module than patching i18n.
So, if you're looking for a partial solution, see #1257488: Make shipping quote pane description and error message really translatable

PieterDC’s picture

Component: Blocks » Compatibility

I didn't mean to change the 'Component' of this issue, but apparently 'Code' disappeared from that list.
Now choosing 'Compatibility' as we'd like that to happen with variables not edited through a system_settings form.

joseph.olstad’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)