1

I want to add a "add translation now" button on nodes and other entities too. I'm using the Entity translation module, and I added two languages to the site.

I thought about getting the original translation and then loop through the translation data, checking if there is more than just the original language inside.

Is there a better way to do this?

1 Answer 1

1

Actually if you are doing field translation then there is no point of having translate now link at Node level. For this there is always translate primary tab for this. see in screenshot. enter image description here

Still if you want to achieve this functionality, loop through this array within node object.

$node->translations->data

Do this in module file in hook_preprocess_HOOK here it will be hook_preprocess_node and pass a variable to node.tpl.php

2
  • The translate tab is always there, even if the entity is already translated. I only want the button, if the entity is not translated yet.
    – scar
    Mar 31, 2015 at 15:42
  • count the number of all enabled languages. and match with count($node->translations->data) . if not matching show the button . Mar 31, 2015 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.