Hi guys,

I am using latest dev version in a multilingual site. I'd like to be able to automatically translate the Label field for an Extra Address Field using default Interface Translation functionality. Unfortunately that doesn't seem to have been implemented.
I am looking for some guidance in what the best place would be to patch this.
Adding t( ) in function generate() for the field.class works but it might be better to do this in the function output.

Any thoughts?
Willem

CommentFileSizeAuthor
#5 patchfile.patch769 byteswjroes

Comments

megachriz’s picture

I have no experience with multilingual sites. Is it just as simple as adding a t()? The coder module complains about not using literal strings in t() in this case.

I think the best location to do translation, is indeed in the method output() in ucxf_field.class.php. I would like a patch. Probably the description should also be translatable. Also, maybe you want to test if your fix doesn't result in strings to be double translated.
Places where the label is outputted:
- checkout page
- order review page
- order page
- order edit page
- address fields setting page

maurizio.ganovelli’s picture

I think it's better to use the i18nstrings function (http://drupal.org/node/789286) to translate user defined strings.

ucefh’s picture

any solution for the translation of these fields because im unable to define theme as i18n strings

megachriz’s picture

Hi ucefh,

Because of my lack of experience with multilingual sites and because I'm currently busy with Ubercart Addresses integration I won't have time to implement this soon. Did you try to implement a solution with i18n? If so, can you explain to me why it didn't work?

wjroes’s picture

Status: Active » Needs review
StatusFileSize
new769 bytes

I have attached a patch that just adds translation functionality in the function output. This seems to be the most straight-forward and simple solution at this time.

megachriz’s picture

Status: Needs review » Needs work

Thanks for the patch, but I prefer to see this fixed with a i18n implementation, as that seems the best way to fix it. But I can commit the patch as a temporary solution if you don't have interest/time to fix this with i18n. Setting status to "needs work".

maurizio.ganovelli’s picture

Assigned: Unassigned » maurizio.ganovelli
Status: Needs work » Fixed

In last commit, there is a patch for i18nstrings integration: now user defined strings for field (label and description) can be translated (added "Ubercart Extra Fields" text group).
Please let me know if you encounter problems using this new feature.

Status: Fixed » Closed (fixed)

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

W.M.’s picture

Version: 6.x-2.x-dev » 7.x-1.0-alpha3
Issue summary: View changes

Same applies to Drupal 7 version. The proper way to do fix this is by making similar modifications as outlined under #5 to /class/UCXF_Field.class by implementing t() function.

megachriz’s picture

@W.M.
It has been a while since I last looked inside the Extra Fields Pane code, but I thought that I fixed this in the dev version?

W.M.’s picture

@MegaChriz

I have just downloaded the development version. Yes, the issue is indeed fixed there by using i18n string translation. Thank you.

megachriz’s picture

I hope I find the time to make a new release someday and I would like to create a new release of Ubercart Addresses on the same day. In order to keep Extra Fields Pane in optimal sync with Ubercart Addresses, I first need to test #2461417: Implement new hook hook_uc_addresses_order_load() against the latest dev of Ubercart Addresses again.