13 replies [Last post]
nicoloconte's picture
Offline
Joined: 03/20/2009
Juice: 54

Hi guys,
I founded a problem with the traslation of the address field, and maybe I fix it:

$trans = t($form[$field]['#title']);

add this code at line 461 of uc_cart_checkout_pane.inc and you will be able to see the fields translated to tour language. Attached you can find the modified uc_cart_checkout_pane.inc.

Is it a good solution?

Nicolo'

PreviewAttachmentSize
uc_cart_checkout_pane.inc_.zip5.34 KB
wendy's picture
Offline
Joined: 10/14/2009
Juice: 37
Thanks for that! I'd been

Thanks for that!

I'd been scratching my head about how I could possibly get these address field labels translated, and you showed me where to change the code!

I didn't actually add the line you suggested, instead I changed this line

$title = $form[$field]['#title'] .':';

to this

$title = t($form[$field]['#title']) .':';

Thanks again, you've saved me Smiling

wendy's picture
Offline
Joined: 10/14/2009
Juice: 37
Re: My solution to the address field (checkout) translation prob

Actually, there is no need to modify the ubercart code after all.

If you go to admin/store/settings/checkout/edit/fields you can fill in a title for each of the fields - this title is a "multilingual i18n variable". This means that if you are currently in your English page:

en/admin/store/settings/checkout/edit/fields

you can fill in the English titles there. Then you go to your Dutch page (for example):

nl/admin/store/settings/checkout/edit/fields

and you fill in the Dutch titles there! This will not overwrite your English titlles, and it will use the appropriate language during checkout.

Same for changing checkout messages to different languages.. just go to xx/admin/store/settings/checkout/edit/messages where xx is the language you want to edit.

Much better solution than modifying ubercart module itself!

burtsbees's picture
Offline
Joined: 03/24/2010
Juice: 29
Re: Re: My solution to the address field (checkout) translation

Thanks, this is great info. I don't know if you know this, but I am setting up Paypals web payments pro, which lets you use the shopping cart on your site and does all the paypal stuff behind the scenes. Do you know if I can use these edit fields for the billing info as well?

wendy's picture
Offline
Joined: 10/14/2009
Juice: 37
Re: Re: Re: My solution to the address field (checkout) translat

I'm not sure what you mean by "using these edit fields".. If you want to use similar multilingual variables that is of course possible. I'm not entirely sure how they work and how to use them in your own module, but this page should help you: http://drupal.org/node/313272

If you mean: can I use these particular address fields.. I have no idea. But I would guess you can.

Have a look at the ubercart module, and in particular at uc_store/uc_store.module because I think that is where they are defined.

Good luck!

jruberto's picture
Offline
Joined: 03/16/2010
Juice: 33
If you go to

If you go to admin/store/settings/checkout/edit/fields you can fill in a title for each of the fields - this title is a "multilingual i18n variable". This means that if you are currently in your English page:

Is this new since the current release version? I just tried this (on 6.x-2.2) and editing the fields on my Spanish page does overwrite the saved values on my English page.

wendy's picture
Offline
Joined: 10/14/2009
Juice: 37
Re: If you go to

I'm using 6.x-2.2 as well, so that can't really be the problem...

Afraid I don't know enough about how this works to see what the problem could be. I'm assuming you have installed i18n? Maybe you have to enable multilingual variables somewhere or maybe it is done by a separate module?

Sorry!

ferrangil's picture
Offline
Joined: 02/27/2009
Juice: 62
Re: If you go to

I have exactly the same problem! If I navigate to /es/admin/store/settings/checkout/edit/fields I see the translated names and I can click the "Reset to defaults" and "Save configuration" and then on the Checkout page I see the spanish words, ALWAYS. So it's not really useful at all.

Nobody has this working?

jruberto's picture
Offline
Joined: 03/16/2010
Juice: 33
Re: Re: If you go to

I need an immediate solution so I implemented the hack in comment #1 which works.

I don't know enough about i18n to understand the correct usage of a "multilingual variable" vs. a "user string", but implementing the t() function makes it the latter (right?) -- not sure if that's a good thing or not, but my site is going live today & this works for now until a real solution is found.

Wendy, can you tell me what i18n modules you have enabled?

jruberto's picture
Offline
Joined: 03/16/2010
Juice: 33
Re: Re: Re: If you go to

Okay, I got it working without the hack, and now have a deep understanding of multilingual variables. Smiling

I did not have internationalization module enabled, which manages multilingual variables. I did have to add a bunch of variable names to $conf['i18n_variables'] in my settings.php to sort of "kick start" the process, i.e. to get those variables established as i18n_variables -- there may have been a better way, but that worked.

firewing1's picture
Online
Joined: 07/07/2009
Juice: 118
Re: If you go to

The problem seems to be that Ubercart merged all of the field values into one serialized variable, however uc_store_init() hasn't been updated accordingly (this is where the i18n variables are set). See patch in #834290.

enlighten_me's picture
Offline
Joined: 04/25/2008
Juice: 83
Re: My solution to the address field (checkout) translation prob

I just changed the "Add to cart" button text, but now every page in all the languages are showing my new text "ADD TO CART". If I go try changing the variable value in say the German page, all the pages now show the German text...

enlighten_me's picture
Offline
Joined: 04/25/2008
Juice: 83
Re: My solution to the address field (checkout) translation prob

I used this workaround for now:

http://www.firewing1.com/taxonomy/term/65

eliosh@drupal.org's picture
Offline
Joined: 05/18/2009
Juice: 16
Same problem here

i18n installed (string & variable module)
ubercart 2.4
drupal 6.20

All i18n variables works good, but not the address fields...
I can find the variable in "variable" database table, but not in "i18n_variable" database table.

It's so strange, i try to investigate more