The comment is always created with the content language, even if locale is disabled. In this situation it should have language neutral instead like node.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

peximo’s picture

To avoid this behavior we need to set default comment language to language neutral without locale enabled, like node, and set this to content language via locale module.

plach’s picture

Status: Active » Needs review

let's test this

moshe weitzman’s picture

Status: Needs review » Needs work

Would it work to simplify the last line:

BEFORE: $form['language']['#value'] = empty($form['language']['#value']) ? $language->language : $form['language']['#value'];
AFTER: $form['language']['#default_value'] = $language->language

peximo’s picture

Status: Needs work » Needs review

The form element type 'value' (and $form['language'] is a 'value' type) doesn't have a property 'default_value', so $form['language']['#default_value'] doesn't work.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
plach’s picture

+++ modules/locale/locale.module	5 Nov 2009 15:24:59 -0000
@@ -1105,3 +1105,15 @@ function locale_url_outbound_alter(&$pat
+  if (locale_multilingual_node_type($form['#node']->type)) {
+    global $language;
+    $form['language']['#value'] = empty($form['language']['#value']) ? $language->language : $form['language']['#value'];
+  }

What about the following?
(We might avoid an unecessary function call)

<?php
if (empty($form['language']['#value']) && locale_multilingual_node_type($form['#node']->type)) {
  global $language;
  $form['language']['#value'] = $language->language;
}
?>

This review is powered by Dreditor.

peximo’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.07 KB

Fixed with plach suggestion.

plach’s picture

Status: Needs review » Reviewed & tested by the community

looks good!

Dries’s picture

It seems like both the current approach, and the approach taken by this patch make assumptions about the language of a comment.

Reality is that both are potentially flawed. Admittedly, the approach taken in this patch is probably less flawed because the assumption seems better.

On my personal blog, which is written in English, the assumption would still fail -- my posts are always in English, but people sometimes reply in Dutch because they know I speak Dutch.

PS: Mollom has an API that can be used to identify the language a piece of content is written in. Maybe the Mollom module for Drupal 7 needs to be extended to set the actual language, instead of a language that has been guessed based on the context.

peximo’s picture

Hi, I fully agree that both approaches make assumptions about language. But the previous approach is IMO also incorrect because without locale all content (nodes, comments...) must be language neutral.
I have also changed #605630: Comment language administration UI to make explicit this assumption allowing user with proper permissions to select the comment language.

PS: Mollom has an API that can be used to identify the language a piece of content is written in. Maybe the Mollom module for Drupal 7 needs to be extended to set the actual language, instead of a language that has been guessed based on the context.

This whould be a great solution.

webchick’s picture

Dries, it's not clear to me your concerns with this patch? Should I commit it, or did you want some adjustments made?

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.