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

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.

Status:Fixed» Active

Didn't mean to change the status.

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

Node translation or field translation?

Only content translation.

Status:Active» Postponed (maintainer needs more info)

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

Category:support» bug

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.

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?

[duplicate comment]

Will try that later :)