Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Seem to be unable to translate attributes the appear on the add to cart forms. Including the Attribute title, it's help text and it's values.
Comment | File | Size | Author |
---|---|---|---|
#46 | uc_attribute_locale_d7-436684-46.patch | 1.33 KB | betz |
#33 | uc_attribute_locale_d7-436684-32.patch | 3.04 KB | betz |
#32 | uc_attribute_locale_d7-436684-32.patch | 3.03 KB | betz |
#25 | 436684-uc_attribute-translate.patch | 2.67 KB | longwave |
#24 | 436684-uc_attribute-translate.patch | 2.71 KB | longwave |
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedThat's because these values are coming from data stored in the database, not string literals in modules. This is a long standing issue without a direct fix available to us at the moment.
Comment #2
mrfelton CreditAttribution: mrfelton commenteddamn. What a pain... impossible to run a multi language site then. Wish I knew that before I built one!
Comment #3
rszrama CreditAttribution: rszrama commentedNot impossible, you just have to get creative. Other people are working on the issue, though. Look for solutions to things like multi-lingual menu items and taxonomy terms and you should find a solution by way of analogy.
Comment #4
mikejoconnor CreditAttribution: mikejoconnor commentedHere's a patch to add support for attribute translation. Please review and provide feedback.
Comment #5
rszrama CreditAttribution: rszrama commentedWell, remember, we can only wrap string literals in t(). I think other modules provide ways to translate non-literal strings that we'd have to tap into.
Comment #6
patchak CreditAttribution: patchak commentedIs there any activity around this issue? We need to translate options and attributes as well, so really interested in this. We are willing to work on this, if someone would point us to the right direction??
Thanks
Comment #7
joostvdl CreditAttribution: joostvdl commentedI installed the patch from #4. I tested it Successfuly.
Comment #8
longwaveAs noted in #5, you are not allowed to use t() to translate user-defined data like that, so #4 won't be committed as-is.
Comment #9
TR CreditAttribution: TR commentedSee also #1066364: META: Make custom data translatable.
Comment #10
daamy CreditAttribution: daamy commentedthanks mikejoconnor for the patch.
I didn't run the patch but modified the code manually.
it worked for me.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedHi !
Here’s a patch that brings internationalization to UC Attribute module by the means of String translation module (i18nstrings). As recommended, it does not use t() function for the translation.
I’ve also tried to make it work with UC Dependent Attributes and UC Ajax Attribute Calculations (seems to also work :-) ).
IMPORTANT : It seems to work at first glance but needs some deeper review to be sure it does not break anything elsewhere, so don’t use it on a production site !
If someone could make some tests…
Comment #12
TR CreditAttribution: TR commentedWrong status - should be "needs review". Let's give the testbot a shot at it ...
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedWhich format of patch should I use ?
Comment #15
longwaveThe easiest way to create patches is with "git diff" from the main Ubercart directory.
Also retitling this issue, as technically it is not a bug; translation was never supported in the first place.
Comment #16
hachreak CreditAttribution: hachreak commented+1
This feature is very necessary in my projects... there are some news on how to allow translation? :)
What is the problem to intregrate last patch?
I try to create this patch with "git diff". Someone can tell me if it works? :)
Best,
hachreak
Comment #17
longwaveComment #18
TR CreditAttribution: TR commentedLots of coding standards and documentation standards issues.
Comment #19
hachreak CreditAttribution: hachreak commentedI have fix the patch because there is a dot that broke the code... :-P
Comment #20
hachreak CreditAttribution: hachreak commentedSomeone can help me? I have not much experience in "coding standards and documentation standards" issues.. :)
What should I do?
Thanks
hachreak.
Comment #21
longwaveYou can use the Coder module to ensure your changes follow standards: http://drupal.org/project/coder - see also http://drupal.org/coding-standards/ for full details of the Drupal standards.
As an example:
if(!function_exists('i18nstrings_update')) return FALSE;
should be
(ie. a space between if and (, and we always use { } braces in statements even if there is only one line)
Comment #22
hachreak CreditAttribution: hachreak commentedOk, I fixed all the things that coder module return back (I update only code relative to my patch, not to complicate things and maybe add bug.. :-P).
Now what can I do?
Comment #23
longwaveWait for someone to review and test it!
Comment #24
longwaveI updated and simplified the patch from #22, works for me on product pages, cart and checkout at least but untested with other modules.
@hachreak: Are you able to test this?
Comment #25
longwaveWrong patch, use this one.
Comment #26
hachreak CreditAttribution: hachreak commentedHi Longwave,
thank you for your patch! :D
I try it and it seems to work for me... XD
I'm not using special ubercart modules, so I don't know if it works with them, but I don't think there are big problems.. :-P
Best,
hachreak
Comment #27
longwaveCommitted #25, needs porting to 7.x.
Comment #28
hachreak CreditAttribution: hachreak commentedYeah! Thanks... :D
When can I download the new release of ubercart with this patch? :)
Comment #29
longwaveIt will be included in 6.x-2.x-dev tomorrow, or wait for 6.x-2.10 - but there is no set release date.
Comment #30
Ken Hawkins CreditAttribution: Ken Hawkins commentedWanted to add a foot note here that while this patch largely works for me, I'm having some sort of error where the language codes were flipped.
It's a dual language site and the German text was showing on the English products, though the other translations worked fine.
I just went through a rough site move so it could be related to that. In a perfect world I'd have the time to setup a test site and try again.
Adding this comment in case someone else should encounter the same issue.
Comment #31
TR CreditAttribution: TR commentedCommitted coding standards fixes to address #18, see commit 030c644b1c545e001650e. Please ensure the 7.x-3.x patch takes these into account.
Comment #32
betz CreditAttribution: betz commentedAnd a drupal 7 patch...
Comment #33
betz CreditAttribution: betz commentedAnd with coding standard fixed :)
Comment #35
longwave#33: uc_attribute_locale_d7-436684-32.patch queued for re-testing.
Comment #36
betz CreditAttribution: betz commenteddon't get it, everything passed, but on #34 we get the message the patch failed?
Comment #37
longwave#34 failed in the credit card tests, which this patch does not touch. There is an occasional random failure in those tests but I have not yet figured out exactly what causes it.
Comment #38
longwaveThanks for the patch, but #33 doesn't work for me.
After enabling i18n_string I can translate the attribute and option strings at /admin/config/regional/translate/translate but then the translations don't show up on the product pages or in the cart; they're just shown in the original language.
Comment #39
betz CreditAttribution: betz commentedWeird.
Are you sure that you are seeing the ubercart attributes strings?
Have a look at http://www.evernote.com/shard/s88/sh/e032f484-a41f-4394-96a8-8b3205352d0...
Also, refresh the strings at en/admin/config/regional/translate/i18n_string
Comment #40
betz CreditAttribution: betz commentedAlso, are you using the default product contenttype? Or a product class?
Comment #41
longwaveI am seeing the Ubercart attribute strings, I can see and translate them in the screen from your screenshot, but the translations never show up on the front end. I have the attribute attached to two products, one is the default product content type and the other is a new class I created for testing, though I am not sure why this should make a difference. I also wasn't running the latest i18n module either, but I have upgraded to that and it still isn't working.
Comment #42
longwaveConfiguration error on my part, sorry! I forgot I had been messing with the settings at /admin/config/regional/language/configure and switched off URL detection for user interface translation, which is the method I was using to switch language (it was still on for content, but these strings are considered UI).
Comment #43
betz CreditAttribution: betz commentedSo you got it to work then?
Comment #44
longwaveYes it works for me, after some more testing everything seems fine, so I committed it with some minor changes to keep the comments in line with 6.x-2.x. Thanks for your work on the patch!
Comment #46
betz CreditAttribution: betz commentedOk, so I was missing the attributes and options that are attached to the product.
I only had the general attributes and options refreshed.
Attached patch fixes this.
Comment #48
longwave#46: uc_attribute_locale_d7-436684-46.patch queued for re-testing.
Comment #49
longwaveShouldn't we add $nid to the key somehow here, and anywhere else product attribute translations are used? It seems like we would be using duplicate keys in the case where you have two different labels on the different products that share the same $aid.
Comment #50
betz CreditAttribution: betz commentedMy first code was like that, but i thought when the text is the same, it ignores that key?
Comment #51
longwaveI am not sure; maybe this needs handling in uc_attribute_translate() as well? Not entirely sure how we would do it at first glance, though. I guess this needs testing to see if it's an actual problem or not.
Comment #52
pcorbett CreditAttribution: pcorbett commented46: uc_attribute_locale_d7-436684-46.patch queued for re-testing.
Comment #53
markdcI have translation working, but the correct translation isn't always displayed for the current user language; it’s 50/50. Has anyone else experienced this symptom? Could it be a caching problem?