When working on a Drupal site I saw the error message "There is already a translation in this language.". The only solution was to delete the entity and re-create it. Now I spent time to debug that issue and the problem is that Entity Translation module adds a language callback for all entity types which are enabled for entity translation. By default the entity type "node" is enabled for entity translation. The language callback for entity translation enabled entity types is entity_translation_language.

I cannot figure out why the entity language for my german entity is english but it has an english translation. Do you know sth. about this issue?

Comments

plach’s picture

Status:Active» Fixed

I cannot figure out why the entity language for my german entity is english but it has an english translation. Do you know sth. about this issue?

With entity language do you mean the value returned by entity_language()? If so when you enable ET that value will be the language of the translation you are editing when you are in an entiy form page, or the entity language in any other context.

If you have node translation enabled for that content type, entity_language() should always match the actual node language, at least this is the intended behavior.

plach’s picture

Status:Fixed» Active

Didn't mean to change the status.

yannickoo’s picture

But I edited a german node which has an english translation.

plach’s picture

Node translation or field translation?

yannickoo’s picture

Only content translation.

plach’s picture

Status:Active» Postponed (maintainer needs more info)

Then I'm afraid we have a bug, please see http://drupal.org/project/entity_translation#bugfixing.

plach’s picture

Category:support» bug
yannickoo’s picture

I'm already a module maintainer and I know that it is not easy to reproduce things but please tell me which variables I should show you (in entity_language() maybe) so that you can understand it.

plach’s picture

I'm already a module maintainer and I know that it is not easy to reproduce things

Wonderful :)

but please tell me which variables I should show you (in entity_language() maybe) so that you can understand it.

Well, if you could help me with some actual steps it would be better, so that I can use a debugger to see what's wrong. Anyway, the value returned by entity_language() is determined by the value returned by EntityTranslationNodeHandler::getFormLanguage(). Hence you should see where EntityTranslationNodeHandler::setFormLanguage() is called with the wrong language.

Also, are you on the latest dev?

plach’s picture

[duplicate comment]

yannickoo’s picture

Will try that later :)

fRd-’s picture

Issue summary:View changes

Hello,

I am having exactly the same issue.
My website has 4 languages. For 3 languages I get the message "There is already a translation in this language." when editing or previewing a change on the pages.
For the fourth language I can make edits.

Can someone advise what to do?
I am running 7.x-1.2

Thanks!