Hi,

the translated strings "Billing information" and "Shipping information" are not translated at the checkout-page and at "de/admin/commerce/config/checkout" but at "de/admin/commerce/customer-profiles/types" they are.

Worked fine in 1.1. Updated to 1.2 and installed shipping module. My customer will bite my head off :)

Files: 
CommentFileSizeAuthor
#86 commerce_lang_repair.zip1.6 KBhaggins
#54 1451132-54-translate-profile-labels.patch669 bytesfarald
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es).
[ View ]
#29 1451132-translate-profile-labels.patch712 bytesJax
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]
#27 1451132-translate-profile-labels.patch748 bytesJax
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1451132-translate-profile-labels.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#21 localized-customer-profile-label-1451132-21.patch1.27 KBhelior
PASSED: [[SimpleTest]]: [MySQL] 3,553 pass(es).
[ View ]
#9 screen.png49.28 KBMickL
#6 labels-switched-1451132-5.patch833 byteswillembressers
PASSED: [[SimpleTest]]: [MySQL] 3,553 pass(es).
[ View ]
#5 labels-switched-1451132-5.patch0 byteswillembressers
PASSED: [[SimpleTest]]: [MySQL] 3,553 pass(es).
[ View ]

Comments

same for "Order total" at checkout page. The string is translated when editing the view.

Category:bug» support
Priority:Major» Normal

i found out that i needed to activate "field translations". it is already part of the internationalization module. now i could theoretically translate the strings Billing information and Shipping information BUT when I click on edit there is the field "english" (original text) instead of "german" (default language). When adding a third language (dutch) i COULD translate it into dutch but still not into german.

I created an issue for that with screenshots but maybe it is a problem of commerce?

http://drupal.org/node/1454360

The translation of "order total" is a duplicate of http://drupal.org/node/1121722 which is still not solved.

Same problem, didn't work for me
After installing the "field translation" module I found the strings "Billing information" and "Shipping information" at translate interface.
But after translation, I see http://example.com/user/39/orders/77 with both strings untranslated

Sorry, I found it, it is not under translate interface, but if you go to:
http://example.com/admin/commerce/config/order/fields
and then to edit fields "Billing information" and "Shipping information" you will find a "translate" tab where to manage those strings!

StatusFileSize
new0 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,553 pass(es).
[ View ]

I have the same issue..

I wrote this patch.. haven't tested it yet

StatusFileSize
new833 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,553 pass(es).
[ View ]

whoops...

wrong directory..

The (dutch) translation of "Billing information" is now working on my site.. so i would suggest the patch..
I haven't implemented the Commerce Shipping module yet.. so maybe one of you guys could test it for me..

The problem was that the original code used an untranslated instance label, where the profile type name should be used.

Status:Active» Reviewed & tested by the community

Works for me with billing and shipping.

StatusFileSize
new49.28 KB

does it fix the problem? I attached a screenshot of the problem.

Version:7.x-1.2» 7.x-1.x-dev
Category:support» bug

The patch by wbressers (#6) works for me, too.
Please commit this.

The patch works great for me but the same problem is on the view oders page. As example, "Billing information:" does not translate in user/1/orders/2. Have anyone a hint to find the right place to fix this?

subscribe

As example, "Billing information:" does not translate in user/1/orders/2.

It is translated at my site.
But I don't know if it is translated because of the patch (#6) or if it worked before.

I've noticed also similar translation issues on other parts of the commerce module..

i'll try to fix them as soon as i've found the time..

wbressers maybe this can help you: #1454360: Field translation - only english ?!

The patch #6 works for "Billing information" label, but not for "Order total". :(

So, the patch #37 works fine for "Order total" string.

#6 works fine for me (for "Shipping information"), thanks

Assigned:Unassigned» helior
Status:Reviewed & tested by the community» Needs review
Issue tags:+1.3 review

Let's get a review in of this before 1.3. We'll need to reproduce the multi-lingual scenario before we can commit it, because a simple reading of the patch doesn't make it immediately obvious to me how this is fixing the problem. I would've expected us to want to preserve the old ordering. With the patch, it just appears to prioritize the name coming from the customer profile type itself, which I wouldn't have supposed would be translatable through the interface.

Status:Needs review» Reviewed & tested by the community

field_info_instance() does not return localized info, so it's not a reliable source for getting a localized label for the pane header. The documentation for hook_commerce_customer_profile_type_info() specifies that the "name" key should be translatable, so taking preference to this info is the right direction.

Status:Reviewed & tested by the community» Needs work

Ahh, I must have taken the red herring about field translation up above. I suppose that's what was needed for other parts of the interface but that that wasn't sufficient for the checkout form. The thing is... $profile_type['name'] will never turn up empty. It's a required parameter of customer profile types, so we'll never have a fallback to the instance label. I'm wondering what we should do about that.

For example, right now on a single language website, I can go change the label of the customer profile reference field on the order to anything else and have that appear as the title of the checkout pane. This patch will remove that possibility, because the name of the profile type will always be used.

Perhaps we just need an extra bit of optional integration to the field translation module to pick the language specific instance label if it exists. I feel like we're doing that elsewhere in the code... ahh, for attribute field options in the Cart module (grep the source for i18n to see where).

Moving back to needs work, as this is a feature regression as is.

Status:Needs work» Needs review
StatusFileSize
new1.27 KB
PASSED: [[SimpleTest]]: [MySQL] 3,553 pass(es).
[ View ]

Makes sense. i18n_field integration added - best of both worlds :)

Status:Needs review» Fixed

Huzzah! With the patch applied, I was able to translate "Billing information" to "Informations de facturation" in the Translate interface for field labels and have it show up just fine when visiting /fr/checkout/[order-id]. Committing #21, which is dependent on i18n_field.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Hi,

This patch works great.

For documentation purposes:

1)
You have to go to this page admin/config/regional/i18n/strings
And set the language to english..than the translation strings can be made to your language.

2)
You need to go to admin/config/regional/translate/i18n_string and enable

Select text groups
Fields

3)
Then the fields are between the normal translation page to be able to translate: admin/config/regional/translate/translate

4)
After adding translation and nothing showing, back to admin/config/regional/translate/i18n_string
Enable Fields and click REFRESH.

Greetings, Martijn

The label is escaped twice. Try to translate the shipping information label to: "Données d'expédition" and you will see the html entity in the fieldset legend. Should I reopen this ticket or create a new one?

It's the check_plain that is too much for the title. The title will be escaped again when it is rendered.

Assigned:helior» Unassigned
Status:Closed (fixed)» Needs review
StatusFileSize
new748 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1451132-translate-profile-labels.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

And the patch.

Status:Needs review» Needs work

The last submitted patch, 1451132-translate-profile-labels.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new712 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]

Patch against HEAD instead of 1.3.

All this translations could be achieved just by using Field translation (i18n_field) module from i18n package.
No patch needed.
I am using Drupal Commerce 7.x-1.3 and i18n 7.x-1.5

p.s. : without Field translation (i18n_field) module i am not able to have the translations.

Status:Needs work» Needs review

I think the translation should be done by core modules OR i18n module. I have only 1 language and i won't install a complex module to translate one string, it has no sense.

Status:Needs review» Needs work

Hey Jax, I can't commit the patch as is, because for untranslated fields you actually don't get sanitization on the instance label. For example, I was able to execute JavaScript if I just added it to the instance label on a single language site. I'm happy to update the code so that we only sanitize the label for output if translation does not occur, but I'm actually at a loss to know why this is being sanitized in the first place. When I follow the code through for field translation, it looks like sanitization should be off by default. Do you have any insight there? I'd hate to just always assume translated instance labels are sanitized and open up a security hole.

Sometimes sanitized and sometimes not? That isn't very practical. I'll try to find time to have a look at that this week.

Yeah, it really is odd. And really I can't figure out why i18n_field is sanitizing when by all appearances it sets sanitize => FALSE by default for object translation. : ?

Status:Needs review» Needs work

I found that if on admin/commerce/config/checkout/form/pane/customer_profile_billing
I chenge the Checkout pane configuration -> Related customer profile reference field -> -None-
then the "Billing information" fieldset display translate.
I want to Related customer profile reference field to Billing information but ....
Hopes will help anything.
Thanks

i think this issue is (very) related with #1121722: Improve DX of instance translation issue, if not they are the same.

Translate "Billing information", "Shipping information" and "Order total" is possible and works.

But,

the problem is the missing documentation to do this.

So, how do you translate it? Using i18n is not an option for me because the website only has one language. Installing such a huge package just for this is insane.

Using i18n is not an option for me because the website only has one language. Installing such a huge package just for this is insane.

Exactly that is the problem.

Needed modules:

Entity Translation
Field translation (i18n part module)

@AdamGerthel. I have the same issue, i will not install i18n for two words. Try patch #6, it works for me, but i think it's not te correct way to go.

#29 works for me but I agree it is a bit overkill

The patch in #29 is insecure per my comments in #32.

You are right but it is a moderated security flaw because specific permissions are needed to exploit it.
Actually, only my user#1 can access this settings so I prefer something working instead of an untranslated string on my client's website :/

So... Is there a temporary workaround? Having mixed languages in the checkout is very likely to scare customers off.

I'm not particularly interested in committing a half solution, so honestly this just needs to be pursued through i18n as described in my comments above.

Title:Translation issue "Billing information" + "Shipping information"Translation issue "Billing information" + "Shipping information" + "order total" + ... "or" !!!

... one more with the "or" at the foot of each page of the checkout;
a good idea if you can't sleep : open your favorite editor and try to find "or" in kickout ;oD !
i mean :-((((

yeah...'or' word is a pain. it's redundant, since there are two buttons, one next to the other.
cleanup =)

i'd like to clean it up .. but where is it ?!

Title:Translation issue "Billing information" + "Shipping information" + "order total" + ... "or" !!!Translation issue "Billing information" + "Shipping information"

The "or" comes from commerce_checkout.pages.inc and was included to imitate other checkout systems (such as Shopify). That said, it's fully translatable through the normal translation interface and is not related to this issue. Additionally, there's a separate issue that will wrap that "or" in a class so it's easily themed out, and in the meantime it can just be form altered out. ; )

And again, all this issue needs is for my someone to research the lead I give in comment 32. None of the comments have changed anything since then.

Comment #24 works fine for me. Try it before applying any patch.

If you just want to quick-fix the translation on checkout, you can do this:

<?php
/**
* Implements hook_form_alter();
*/
function custom_stuff_form_alter(&$form, &$form_state, $form_id) {
 
// Fix translation on checkout form
 
if ($form['#id'] == 'commerce-checkout-form-checkout'){
    if(isset(
$form['customer_profile_billing'])){
     
$form['customer_profile_billing']['#title'] = t('Billing information');
    }
    if (isset(
$form['customer_profile_shipping'])){
     
$form['customer_profile_shipping']['#title'] = t('Shipping information');
    }
  }
 
// Fix translation on checkout review
 
if ($form['#id'] == 'commerce-checkout-form-review'){
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_billing'])){
     
$form['checkout_review']['review']['#data']['customer_profile_billing']['title'] = t('Billing information');
    }
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_shipping'])){
     
$form['checkout_review']['review']['#data']['customer_profile_shipping']['title'] = t('Shipping information');
    }
  }
};
?>

Much more lightweight than adding a bunch of modules :)

I used the solution in #51 and added a translation for 'Order total' also. Probably there are better ways to handle this, but it does the job. Just add the following to your template.php file:

<?php
/**
* Implements hook_form_alter();
*/
function YOURTHEME_form_alter(&$form, &$form_state, $form_id) {
 
// Fix order total translation
 
if (isset($form['cart_contents'])){
   
$form['cart_contents']['cart_contents_view']['#markup'] = str_replace('Order total', t('Order total'), $form['cart_contents']['cart_contents_view']['#markup']);
  }
 
// Fix translation on checkout form
 
if ($form['#id'] == 'commerce-checkout-form-checkout'){
    if(isset(
$form['customer_profile_billing'])){
     
$form['customer_profile_billing']['#title'] = t('Billing information');
    }
    if (isset(
$form['customer_profile_shipping'])){
     
$form['customer_profile_shipping']['#title'] = t('Shipping information');
    }
  }
 
// Fix translation on checkout review
 
if ($form['#id'] == 'commerce-checkout-form-review'){
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_billing'])){
     
$form['checkout_review']['review']['#data']['customer_profile_billing']['title'] = t('Billing information');
    }
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_shipping'])){
     
$form['checkout_review']['review']['#data']['customer_profile_shipping']['title'] = t('Shipping information');
    }
  }
};
?>

Both #51 and #52 only fix commerce checkout forms (btw, #52 works fine), but the translation should be done on review page too.

Status:Needs work» Needs review
StatusFileSize
new669 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es).
[ View ]

If we need the check_plain, how about just adding a t() ?

Status:Needs review» Needs work

t() cannot be used to wrap variables, as we have to point out in every issue dealing with internationalization at some point in time. : P

It can only wrap string literals per its documentation.

D'oh! Of course! :)

I just made a little module based on #52. https://github.com/kaido24/commerce_lang_repair . Its really only copy paste but its much better than use this as a theme function..

The easiest for single-language sites is to :

  1. Create a feature with the Shipping information & Billing information fields.
  2. Edit the feature code and translate the text directly there.
  3. Revert features.

Problem solved.

Thanks for your module, kaido24! It's really helpful as I don't want to use i18n. Commerce Language Repair works well during checkout but it doesn't seem to affect admin order pages like admin/commerce/orders/1. Do you intend to support the translations there, too?

Short answer is no.. I just dont have to time and motivation at this point. But if someone tracks this variable down then I can do it.

#54 worked for me, thank you

@Summit thanks for your instructions in #24 - saved me a lot of time!

The Order total and others solved by instructions in #24. This saved me a lot of time too.

But when a try to translate expressions like as

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.

I receive a message of error, saying that expression have HTML not allowed.

Any ideas?

maybe is helping?!

@ntigh52, tks to the answer.

Are you saying me to "try to clear language field in action that sending message."?

I tried to do this, but nothing. Can you help me? How you did this?

Tks

where do you try to translate this line?!
rules?!
translateion window?!?!

@ntigh, ok.

To translate this, access admin/commerce/config/checkout/form/pane/checkout_completion_message

Tks

thanks :)

The above tips work well for the translation of "Billing Information" and "Shipping Information" in the background processes of payment, but in pages like :
"user/xxx/invoices/xxx" or "user/xxx/orders/xxx" or "admin/commerce/orders/xxxx/view"
, translation does not work ... :-(

#57 is the solution for me. Well done, @kaido24. I say "If Mohammed will not go to the mountain, the mountain must come to Mohammed".

Thank you.

... But #57 doesn't translate "Order total" on Shopping Cart Summary:

user/X/orders/Y

Yes its only for this one form.. And its not really the right way to do it.. If you dont find better solution you can pm me and we will find some solution..

Ok, as a temporary solution I changed fields' label in order type's page:

admin/commerce/config/order/fields

This way I changed "Billing informations" label only.

The definitive solution is, I think, installing Internationalization module but I'll not do it because my site is shown in one only language.

Hope this helps...

And for "Order Total" label in order's detail I used this patch:

http://drupal.org/node/1776644#comment-7372464

Hope this helps, too.

Bye.

Category:bug» support
Status:Needs work» Fixed

There is nothing more to be done.
I have tested translation with i18n_field 1.8, could translate everything (billing information, order total, etc), and had no double-escaping problems.
Since the original report of that is a year old and there have been i18n releases in the meantime, I am assuming that got fixed.
(Especially since I have confirmed that the code is explicit about requesting non-sanitized strings).

You will always need i18n_string and i18n_field to fully translate a Drupal 7 site, Commerce or no Commerce.

Nono, this isn't true!

I Made dozens of drupal sites in my home language: italian, and I always used only locate module without Internationalization module.

Mine are not multilanguage sites but I have to translate everything the same. I can't install a so big module (i18n and some submodules) to translate 1 or 2 strings! Do you agree?

I suppose the question is how are you translating field labels and option values apart from i18n?

There is no way to translate a field instance label, help text, allowed values without i18n.
The Commerce team can't fix D7's multilingual problems. This is just the way it is. Feel free to help D8 become better (it already is, by a long shot).

i18n_string and i18n_field are relatively small modules (other i18n modules can remain disabled, and they are not enabled or installed), so I'm not accepting that as an argument.

Any module have to process any string and label by using t() function. So I don't need any i18n module in my translation activity, only locale module is the module I need.

If I have to install i18n to translate commerce module's string, there is something wrong in commerce module, I think...

I have to agree with gianfrasoft about installing i18n module for one-language site.
It's just too much for translating few strings.
I'm using this little function to change field labels:

function _change_field_label($field_name, $new_label) {
  $record = db_select('field_config_instance', 'inst')
    ->fields('inst')->condition('field_name', $field_name)->execute()->fetchObject();
  $data = unserialize($record->data);
  $data['label'] = check_plain($new_label);
  db_update('field_config_instance')
    ->fields(array('data'=>serialize($data)))
    ->condition('id', $record->id)
    ->execute();
}

Maybe someone will find this useful. Cheers.

You are free to ask any drupal core developer and / or multilingual expert (Gabor Hojtsy, for example) for a second opinion, and you will get the same reply.
Drupal's locale module can't translate a field instance title (such as "Billing information"). Hence, i18n_field.

This is my last reply on this subject.

#24 does the trick!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Thanks, this (#24) helped me to solve my translation issues without any source codes alteration!

For me #58 solve my probleme... thanks !

StatusFileSize
new1.6 KB

#57 is working fine. However, it misses Order total on the review form.

I also cleared the code so that it uses $form_id instead of $form['#id'].

Another issue with that fix was, that it replaces all occurences of Order total of the whole cart table - including product titles. As the shop sells event tickets and some bands may have crazy names, I won't bet on that this string doesn't occur in any title ;)
So I search and replace Order total</td> instead.

Attached is the updated helper module.

I can confirm that there is still a problem with this. I've installed DC in my German site (using i18n and co) and "Source Language" was set to "German".

The problem is, that the fields are locked and the imported Text "Billing information" / "Order total" are used as German(!) translated field titles that are not editable!
Even "Translation Table" did not help here, which is normally very helpful for these cases.

Only solution was to translate the binary field in the database...

You have to translate some commerce views, too...

I did what was possible, but that's not possible for the fields named above, because they are not editable in the views. "Order total" is part of a fixed output in the views footer - without customization possible (or am I wrong?)

"Billing information" is a not a view, but a field in the checkout. Same problem as described above. But perhaps this is not a real DC problem, but a general problem in Drupal translation. My point was firstofall to describe the steps to reproduce this problem!

This is the work around how to get translatable titles for panes:

<?php
/**
* Implements hook_commerce_checkout_pane_info_alter().
*/
function MYMODULE_commerce_checkout_pane_info_alter(&$panes) {
 
$panes['customer_profile_billing']['title'] = t($panes['customer_profile_billing']['title']);
 
$panes['customer_profile_shipping']['title'] = t($panes['customer_profile_shipping']['title']);
}
?>

If you want to get all the titles translated you can use this code:

<?php
/**
* Implements hook_commerce_checkout_pane_info_alter().
*/
function MYMODULE_commerce_checkout_pane_info_alter(&$panes) {
  foreach(
$panes as $key => $pane) {
   
$panes[$key]['title'] = t($panes[$key]['title']);
  }
}
?>

In order to translate 'Order total' you can use the theme function from commerce.price module:

<?php
/**
* Just use the theme function to translate order total
*/
function MYTHEME_commerce_price_formatted_components($variables) {
 
// Override default commerce Order total title
 
$variables['components']['commerce_price_formatted_amount']['title'] = t('Order total');
 
// Add the CSS styling to the table.
 
drupal_add_css(drupal_get_path('module', 'commerce_price') . '/theme/commerce_price.theme.css');
 
// Build table rows out of the components.
 
$rows = array();
  foreach (
$variables['components'] as $name => $component) {
   
$rows[] = array(
     
'data' => array(
        array(
         
'data' => $component['title'],
         
'class' => array('component-title'),
        ),
        array(
         
'data' => $component['formatted_price'],
         
'class' => array('component-total'),
        ),
      ),
     
'class' => array(drupal_html_class('component-type-' . $name)),
    );
  }
  return
theme('table', array('rows' => $rows, 'attributes' => array('class' => array('commerce-price-formatted-components'))));
}
?>

In order to translate Shipping, billing and order total in forms you can use this code:

<?php
/**
* Implements hook_form_alter().
*
* Fixes translation issues for Order total, Shipping Information, Billing information.
* @see http://www.konordo.com/node/90
*/
function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
 
// Fix order total translation
 
if (isset($form['cart_contents'])){
   
$form['cart_contents']['cart_contents_view']['#markup'] = str_replace('Order total', t('Order total'), $form['cart_contents']['cart_contents_view']['#markup']);
  }
 
// Fix translation on checkout form
 
if ($form['#id'] == 'commerce-checkout-form-checkout') {
    if(isset(
$form['customer_profile_billing'])){
     
$form['customer_profile_billing']['#title'] = t('Billing information');
    }
    if (isset(
$form['customer_profile_shipping'])){
     
$form['customer_profile_shipping']['#title'] = t('Shipping information');
    }
  }
 
// Fix translation on checkout review
 
if ($form['#id'] == 'commerce-checkout-form-review') {
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_billing'])){
     
$form['checkout_review']['review']['#data']['customer_profile_billing']['title'] = t('Billing information');
    }
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_shipping'])){
     
$form['checkout_review']['review']['#data']['customer_profile_shipping']['title'] = t('Shipping information');
    }
  }
}
?>

this problem still exists. I have a DC-Installation in German language, I defenetly do not want to install i18n just to translate one single string. By the way, maby you'd like to use commerce for other purposes then selling products, so it would be smart to have a opportunity to change the lable, either in the pane-settings or in the view. I belive this is more then a just a translation issue.

#91 second code worked perfectly for me, thank you! I implemented it into a custom module instead of my theme.

Issue summary:View changes

#4 worked well for my "shipping information" translation.