1

In my drupal site, I want to add a prompt informing editors that they must add a french version of an article (or any content type). I tried doing this using Rules but there is no way to check if a content type has been translated to French.. CAn anyone shed some light? Thanks!

1

In the answer to "How to implement side-by-side translation?", I describe how to do side my side translation by adding an entity reference field and linking back to the original English article.

For your case, you could use rules to create a French node when an English node is created, save the entity reference and redirect to node/*/translate where the French node would be displayed next to the English one.

If you want to take this approach, I can add more details. I think it would give a very nice workflow.

0

Even though I have seen people using Rules for translation but still I am not sure whether Rules has got this check(translation) as condition or not.

But even if it doesn't, you can create your own condition by hook_rules_condition_info & then use existing Rules action to show message to any user type when he visit node.

I have done similar kind of thing using hook_node_view, where I checked available translation & if it's not available, I did set message using drupal_set_message.

Something like (not tested)-

// Replace your own module name to HOOK
function HOOK_node_view($node, $view_mode, $langcode) {
  // If content type is article & node is being viewed in full mode.
  if ($node->type == 'article' && $view_mode == 'full') {
    global $user;
    //If French translation isn't available & User is of type moderator.
    if (!isset($node->translations->data['fr']) && $user->type == 'moderator') {
      drupal_set_message(t('Please add French translation for the node'), 'status', FALSE);
    }
  }
}
0

So I ended up creating a custom module instead and checking if $node->tnid == 0 then run drupal_set_message('Add FR article.. blah blah');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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