Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Internationalization
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
19 Jan 2011 at 09:30 UTC
Updated:
17 Jul 2012 at 10:33 UTC
Jump to comment: Most recent file
Comments
Comment #1
rfaysubscribe
Comment #2
das-peter commentedtagging
Comment #3
rfayWhat fantastic work!
There's no need to use module_invoke() is there? Seems a rather obscure technique. We could also just wrap with if (module_exists()) or use:
Same issue again...
if (function_exists('translation_enabled') && translation_enabled('commerce_product', TRUE)) {
Does this have to go at the beginning of the submit handlers? Comment why, in that case.
Does this have to go at the beginning of the submit handlers? If so, comment on why.
Please add comments for all of these, and explain why they're overridden.
Is the title actually adequate for human readable ID?
Powered by Dreditor.
Comment #4
das-peter commentedFixed some stupid issue and changed some stuff according to rfay's comments.
There's still the need to review the handler class itself.
Comment #5
das-peter commentedPatch updated after evaluating these issues:
#1032602: hook_translation_info() doc shows 'path' instead of 'base path'
#1032728: Fatal error: Cannot access empty property in ...sites/all/modules/translation/includes/translation.handler.inc on line 207
Comment #6
das-peter commentedCleaned up translation handler class according to: #1032816: Is method getHumanReadableId() superfluous?
Added documentation to translation handler class.
Comment #7
rfayI ran through an install of this again today and it all seems to work fine.
Comment #8
bojanz commentedtranslation is also the name of the core translation module. And that module doesn't have the translation_enabled() function.
You'd need to do module_exists('translation') && function_exists('translation_enabled') && translation_enabled('commerce_product').
You can see the tricks we tried in #1006176: Add support for field based translation, from field_is_translatable($entity_type, $field) to
This is all because I tried to target the field translation API in general, instead of targeting the specific contrib Content Translation module (even though it will probably be the only solution...)
Comment #9
das-peter commented@bojanz: Thanks for the hint.
Affected conditions changed.
Comment #10
pcambraTranslation module is now Entity translation, I've updated this patch to the latest version of it. For this to work smoothly, you also need the patch for entity translation here #1098106: Translated fields aren't validated (or processed with presave and submit field_attach_ hooks)
Also we are going to want to integrate this with Title module, which requires this extra property in the entity info:
I wonder if we should "spin off" all these changes in a contrib for commerce translation support.
Comment #11
pcambraThis needs some more work, the product attributes aren't being displayed the right way
Comment #12
pcambraI've added a entity_presave invoke in the save of the product because entity translation uses that an we'd probably need it anyways
This patch should be ok now
Comment #13
pcambraComment #14
pcambraThese changes add multilanguage options for entity translation at product type level so the translate tab in the product translation screen is displayed correctly
Comment #15
rszrama commentedIt looks like these if statements have redundant conditions:
If that module exists, that function will necessarily exist. Is there any reason you're checking for both?
Also, I'm not sure why you didn't declare the translation stuff for the product entity in commerce_product.module. It seems the UI module should purely instantiate this while the definition of translation stuff happens in the API module. See for example the fact that our product forms are defined in the API module and only instantiated in the UI module.
Comment #16
pcambraI think that the "double check" of the function exists is an heritage from the entity translation module that uses that structure.
I've changed that not to be redundant, I've moved the api functions to commerce_product and also removed one of them that we're not using because we don't have the approach of having a product as translation of another but field translation.
Comment #17
rszrama commentedTwo things I noticed in this latest iteration:
Comment #18
pcambraOk, changed the content_type references, but it looks that hook_translation_info is going to disappear really soon, see #1114410: Replace hook_translation_info() with hook_entity_info() so I put all the translation info directly into hook_entity_info of comerce_product and the ui parts into the hook_entity_info_alter of commerce_product_ui
Repo: git.drupal.org:sandbox/pcambra/1081200.git
Branch: 1032302
Diff: http://drupalcode.org/sandbox/pcambra/1081200.git/commitdiff/da3e87dacae...
Comment #19
rszrama commentedThis applies cleanly, and I've updated it a little bit. In order to test, you need to:
However, two things stand out as needing addressed before we can commit this:
Comment #20
pcambra1: What checkbox list are you referring to?
2: For title translations you need to enable the title module (http://drupal.org/project/title) that transforms the title into a field and then it gets translatable.
Comment #21
rszrama commentedThe checkboxes list on the entity translation settings form where you select which entities should be translatable. It's at step 3 in my instructions.
Comment #22
pcambraI'm attaching a patch with the title support integrated. Note that I've added the "field replacement" property to the product entity info as we can't add that to the product entity info alter of commerce_product_ui, which would make more sense, but title module has a really low weight so the alter doesn't have effect.
Step by step with title module:
I've also added a form alter to hide line items, orders and customer profiles as entity translation uses the property "fieldable" for displaying an entity in the config screen.
I think we'd need to add tests to this.
Comment #23
rszrama commentedAlrighty, I'm committing the changes from your patch and merging it all into dev, as it all appears to work. However, I think there are some general problems with the modules we're depending on that I hope to see sorted out... I was able to get to fatal errors thanks to the Title module when I attempted to add a Spanish translation of a node. Additionally, for some reason the Title module does not load the value of the title field it creates into the entity title on load.
However, by changing my user account language to Spanish, I was able to see that a referenced product was loaded in Spanish w/ its Spanish title.
I'll move this to postponed, as we certainly need tests, particularly for Title translation... but it may be a fool's errand until that module hits a stable release.
Comment #24
das-peter commentedHey Ryan,
thank you for giving this a test.
I'll attend at the i18n sprint in Berlin, which brings hopefully more structure in the multi-language topic, and it's foreseeable that I've to enable multilingual support in our installation soon. Thus I assign this ticket to me, hopefully I'm able to push this a little bit ;)
Comment #25
plachsubscribe
Comment #26
plach@rszrama:
If they are reported be sure I'm working on them ;)
A patch for this is available at #1146724-7: Replacing field values are not always initialized.
Comment #27
rszrama commentedGreat, thanks for chiming in. : )
Comment #28
guy_schneerson commentedIssue: Entity Title picked up by Cart instead on the new Title Field
Hi Guys
We are in the process of evaluating Drupal commerce for a multi-language /multi-currency e-commerce site (I can't see us using anything but commerce, you guys are doing an amazing job on it).
I have set my commerce site using the entity translation and title modules and I almost got it to work: the problem I am getting is that my Cart is showing an empty description for the line item title, to make things even more confusing, when I design the view it work fine.
While attempting to figure this out I entered test text into the empty “commerce_product” table “title” fields and it displays in my Cart.
I can get around this problem by updating all the views – joining in the product and displaying it's title instead of the line item, however this is not ideal.
As Ryan mentioned above this may be an issue with one of the other modules and as I know I can always get around it, we can wait to see if any of the updates to the other modules resolve this.
I am including an image with three views of my Cart: English French and the view in design mode.
The first product column is the one I added using the product relation and the second one is using the line item
Thanks Again
Guy
Comment #29
das-peter commented@bbguy: I think you've discovered the same issue as I on the i18n sprint in Berlin, this is the related issue: #1157446: Integrate the module entitycache to enhance the support for title translation
It seems that when the cart is built the cache is flushed - I don't know why - and since the title module isn't notified about that it can't replace the original title values by the one from the new field again.
Comment #30
guy_schneerson commentedThanks ill keep an eye on both issues
Comment #31
minff commentedjust bookmarking..
Comment #32
aturetta commentedOuch...
DC 1.0 managed to be released without it :-(
Comment #33
rszrama commented@aturetta - Not sure what you're talking about (or why this would be a release blocker ; ), but the last patch was actually committed as it was. Please review the comment chain and update if you can - notice particularly comments 22 / 23.
Comment #34
aturetta commentedsorry, you are right. I thought postponed meant 'not fixed'.
plus, a post on IRC by the original poster yesterday led me to think this patch had to be applied manually....
Surely not a blocker, but for Multilingual sites Entity Translation is necessary
Comment #35
summit commentedHi, @das-peter any news on this? Is it somehow possible now to translate products like nodes as such that you can see the different translations and the right translation is selected by product reference when the product node (display) is in the same language?
I want to have only one product-stock, and would love to be able to have my site on different sites (multidomain) in different languages (this issue I think).
Thanks a lot in advance for your update.
greetings, Martijn
Comment #36
plachI'm not sure but I think this issue has been obsoleted by #1495570: Update Entity translation integration and could be marked as a duplicate.
Comment #37
bojanz commentedYep. The code from this issue was committed.