Entity translation is going to have its UI heavily rewritten, see #1282018: Improve UX of language-aware entity forms.

Some of the integration code needs to be updated to catch-up with those changes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

Status: Active » Postponed
FileSize
3.58 KB

Here is a working patch. We should really wait to commit this until a tagged version of ET shipping the new UI is released because the new UI relies on a core patch. Ideally we could coordinate a joint release.

rszrama’s picture

Great, thanks for putting the patch in the queue! : )

plach’s picture

Status: Postponed » Needs review

The core patch and the new ET UI have been committed. Let's test this.

plach’s picture

Small cosmetic improvement.

SaxxIng’s picture

This patch works very well on my test site. We will find it on next drupal commerce release (7.x-1.4)?

drasgardian’s picture

After applying this patch I was able to successfully create translations of products.

However, I think the 'Product SKU' field shouldn't be included on the translation form, and on the node edit form it should be marked as a shared field.

There are no options on the 'Product SKU' field to configure how it is translated, like there is on other fields. But I don't see why an sku would ever need to be translated anyway, so it could probably just be forced to always be a shared field.

rszrama’s picture

Yeah, SKUs should not be translated.

plach’s picture

SKU is not a field: it is not going to be translated...

Edit: we are still figuring out UX improvements for the language-aware entity form over at #1282018: Improve UX of language-aware entity forms.

plach’s picture

The first Entity Translation beta will be out soon: #4 really needs to be committed once it's out, otherwise product translation is likely to stop working.

@rszrama:

If you wish we can coordinate a joint release: is there a schedule or a roadmap for Commerce 1.4?

plach’s picture

rszrama’s picture

I'm planning a Commerce 1.4 as soon as possible but want to clean up the queue a bit. I'd say at the outside I'm looking at October 5. It's holding up a Commerce Shipping 2.0 full release at this point, too, so I'm eager to get it out. : )

plach’s picture

Ok, meanwhile I wrote a patch for ET that will allow to greatly simplify the integration code here. Will post an updated patch soon.

rszrama’s picture

Ok, thanks.

plach’s picture

Here is a new patch heavily depending on #1280546: Introduce a language selection widget for every entity which should be committed very soon. It seems pretty stable. Reviews/tests welcome.

Edit: it has been commited right now :)

plach’s picture

One last patch with a couple of minor adjustments. Take it or leave it ;)

bforchhammer’s picture

I just tried this out but couldn't get translation of products to work properly...

I installed the commerce kickstart distribution (2.x-dev, with the demo store), added the latest versions of entity-translation and the commerce module, and applied this patch. Then I enabled ET for the "commerce product" entity type, and enabled it on some of the pre-configured "product types". I also setup language detection and added a few more languages.

Now, when I go to an existing product I can change the language from "Language Neutral" to e.g. "English", and I'd expect the "translate" to show up. Instead, the title field looses it's contents, and the translate tab does not show up. The entity form does show the "translation" vertical tab.

That's it for my first attempt, I'll try to have another look tonight. (Probably on a "clean" version, i.e. not based on the kickstart distribution).

plach’s picture

Well, I tested the last Commerce dev, not sure about Kickstart. However the behavior you are describing might be caused by the language widget being hidden and the default language being set to LANGUAGE_NONE. This is not the intended behavior, though (see the hook_entity_info() changes).

About Title I don't know, maybe it's related to #1157446: Integrate the module entitycache to enhance the support for title translation?

bojanz’s picture

This shouldn't be tested with Kickstart v2, because Kickstart relies on Inline Entity Form to handle products, and Inline Entity Form has known problems with Entity Translation (on my todo list ;))

I'll test this patch today.

plach’s picture

@bojanz:

Thanks! The latest ET dev provides a language selector widget for every entity type it supports. The default settings for Commerce products are to show the widget and set the default language to LAGUAGE_NONE, to preserve the old behavior. If you experience the same problems Benedikt had (I didn't) be sure to check the entity translation settings.

bforchhammer’s picture

Status: Needs review » Reviewed & tested by the community

I just tried it again, this time with just the commerce module (not kickstart), and I didn't run into any of the problem mentioned in #16; the translate tab shows up, adding a translation and switching between them works; shared/original fields are hidden/shown depending on permissions.

One minor thing: the "Product SKU" and "Status" fields are not marked as "shared fields" (i.e. no "translatability clue") but are treated as them (i.e. changes in one language affect the other language). This will need to be changed in the ET module, so as far as this patch is concerned I'd say it's RTBC :)

Edit: For the shared fields issue see #1798456-7: Hide shared form elements when the user has not the related permission.

rszrama’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Needs review

@plach When do you anticipate a new release for the Entity Translation module? Is another alpha with this new patch out of the question?

plach’s picture

When do you anticipate a new release for the Entity Translation module?

Well, I was waiting for a couple of Media issues to be committed but they are not critical. I think we can ship in few days. Here is the roadmap:

#1624830: Plan for Entity Translation 7.x-1.0 release

Is another alpha with this new patch out of the question?

The code in the dev is radically different from the alpha2 and I wanted to give the other projects the idea that we are reaching a stable status and that they can trust the API to be solid and reliable. Another alpha would be detrimental from this point of view. Not sure which patch you are referring to: if you mean #1798456: Hide shared form elements when the user has not the related permission, it's going to be part of the new release. Everything required by the patch here is already committed.

Btw, are you waiting for @bojanz to test/review this? Is there anything we can do to get this RTBC again?

rszrama’s picture

Good to know - I wasn't requesting another alpha for any particular reason, just ignorant about your roadmap. Basically, I don't want to roll a release of Commerce that depends on the dev version of another module for some functionality. I don't think that will be the case, as I anticipate at least another 1.5 weeks to get Commerce 1.4 packaged and released, so I should be able to go ahead and commit this. I'll see if Bojan beats me to a quick review. ; )

plach’s picture

Great news, I definitely think we should ship our new releases together. I'll stay tuned.
Moreover this should give us the time to have the Media stuff committed.

rszrama’s picture

I've applied this patch and updated to the latest Entity Translation, but I simply can't get access to a product translation tab. Am I missing something? I can't even hack commerce_product_entity_translation_tab_access() and have it return TRUE to make the tab appear or direct visit to the link work. Not sure what's goin' on.

plach’s picture

If ET was already installed you might need to clear the caches. Also make sure you product has not LANGUAGE_NONE as entity language.

rszrama’s picture

Yeah, I'd saved it as English before trying to translate, but I'll give it another shot. I installed ET, updated / ran update.php, and obsessively cc all'ed to no avail. : P

plach’s picture

Did you enable Commerce product translation in the Entity Translation settings? You'll find a link in the product type page below the multilingual settings.

Edit: You should also make sure you have translatable fields on you product otherwise there will be nothing to translate. However this won't prevent the translate tab from appearing.

rszrama’s picture

Yep, I had turned that on, but I don't think I had translatable fields. Will give that a shot as well. : )

plach’s picture

Any news here? :)

dimitriseng’s picture

Is there an update on this, as it seems to be holding up the entity translation beta?

das-peter’s picture

I gave the patch a try and it seems to work quite well.
It was deployed on our production environment today.

cvangysel’s picture

I can confirm that this patch works fine on the dev branch of Commerce.

krishworks’s picture

Status: Needs review » Reviewed & tested by the community

yep, this patch works fine on the dev branch of commerce. without this patch, there were many errors. First, I was not able to access product listing page as detailed #1818496: Warning: Missing argument 2 for entity_translation_tab_access() and then if I edit a few products, I got access denied message.

The patch in #15 above resolves these.

good time to RTBC?

bforchhammer’s picture

Note: j2b has tested the patch above as well and reported on his experience in #1811956-11: Why commerce products become "Access denied"?. Following plach's suggestion, I created a documentation page based on his comment (pretty much just copy&paste at the moment); once this patch is committed it would be good if that page was updated to properly reflect the state/process of how to translate commerce products with entity translation.

rszrama’s picture

Status: Reviewed & tested by the community » Fixed

Way too many good reviews for this to wait on me finally getting an environment that can test this properly. Committing now - thanks to all for the reviews. : )

plach’s picture

Wonderful, thanks!

Status: Fixed » Closed (fixed)

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

adam1’s picture

Issue summary: View changes

I got the same issues as @rszrama: despite entity translation is enabled and product types are configured for entity translation and some fields too, the translation tab is not available on any product type! I got an up-to-date installation: drupal core 7.44, entity_translation 7.x-1.0-beta5 and commerce 7.x-1.13
Are the issues persistent 'till now? It's kind of tough for me, because I made a whole commerce-shop and now, in the end I realised translation isn't working. Any help very appreciated!

adam1’s picture

Now i've found out what's going wrong (#39): it is a bug in the module commerce_backoffice that's enabled on my site, see here: https://drupalcommerce.org/questions/7427/cant-add-product-type