0

I both have nodes that need to be translated (using Entity Translation), and nodes that need to have a single language (which we are discussing here).

Because of some incompatibility between Entity and Content translation, I cannot enable "Content translation" and "Multilingual content".

Also, even if it was possible, all I really want is not linking translations of different nodes and the other features that come with Content translation.

I just want to let users select the node language when creating/editing a node without having the "Language neutral" option, or select language by default (based on current page language).

  • Please specify your requirement, whether do you want to know if there is an option to select language from a list, or specify the language at the time of create/edit(programmatically or not)? Also mention the Drupal version. – Ataboy Josef Nov 27 '14 at 6:24
  • I clarified the question. There is an option to select the language, but it's showing language neutral as well, which I don't want (it's a forum). Hiding the option and applying the current language to the node would be even better. – kopeboy Dec 17 '14 at 22:31
1

You can enable i18n_node module that is included in i18n module. Then:

  1. Go to edit the content type (admin/structure/types/manage/page).
  2. Open the 'Multilingual settings' tab.
  3. Check the 'Require language' checkbox.

Done.

  • I am quite sure enabling that isn't compatible with Entity Translation. Also, it requires Content translation module first, which is excluded as in my question title. But thanks for your time – kopeboy Jan 21 '15 at 18:10
0

Seems like there might be 3 different paths to solve this problem;

  1. The simplest (and least recommended way) is probably JS hack-ery that hides the specific option in the drop-down. There are MANY drawbacks to this option as well as a few different ways to get it done. I wouldn't suggest any of them under normal circumstances.
  2. Unset the "Language neutral" option on the form using a custom module hook form alter. This could lead to unknown problems and incompatibility with contrib modules in the future.
  3. Select the language by default, based on current page language, again using a custom module. This would require some error handling as well and seems most in line with what you really want. It requires the most development but with some effort is definitely the best option.

I can't point to all of the right resources, since you have not posted the version of Drupal you're using. However, key among the things you'll need is the Drupal API documentation: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/8.3.x

hth

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.