When local module is enabled and I add a new language, swtich to that language but have not set a message text for that language in my message_type messages will have an empty text. Wouldn't it make sence to enable the support for "undefined messages". Users could enter undefined messages (or chose a translated text in the message type as undefined) and this message will be shown if the text for the current active language has no text set (returns '').

Files: 
CommentFileSizeAuthor
#14 message_field_undefined-lang.2006702-14.patch1.36 KBDevin Carlson
PASSED: [[SimpleTest]]: [MySQL] 69 pass(es).
[ View ]
#5 message_field_undefined-lang.2006702-5.patch500 bytespaolomainardi
FAILED: [[SimpleTest]]: [MySQL] 3 pass(es), 9 fail(s), and 1 exception(s).
[ View ]

Comments

amitaibu’s picture

Category:feature» support
Status:Active» Fixed

You can auto-copy those undefined language to the new language via admin/config/system/message

manuelBS’s picture

I see but if a user adds a new language and has not in mind to change these messages, it would be more user friendly if he will not receive an empty message but a message in a default language. Or am I wrong with that?

manuelBS’s picture

Thanks for that, this is the right issue

paolomainardi’s picture

StatusFileSize
new500 bytes
FAILED: [[SimpleTest]]: [MySQL] 3 pass(es), 9 fail(s), and 1 exception(s).
[ View ]

@Amitaibu: What's wrong with attached patch ?

paolomainardi’s picture

From what i can understand, using my patch you can have for free:

1) A "global" configuration for all untranslated fields
2) Localized fields just when you need to have it

Right now, you are forced to "translate" (using the copy function) for every active language.

amitaibu’s picture

> Right now, you are forced to "translate" (using the copy function) for every active language.

Since this is just one click of a button, and is more correct (when you enable locale, each message has a language), I think we can keep as is.

paolomainardi’s picture

@Amitaibu

I disagree, this is how locale.module works:

<?php
/**
 * Implements hook_form_BASE_FORM_ID_alter().
 */
function locale_form_node_form_alter(&$form, &$form_state) {
  if (isset(
$form['#node']->type) && locale_multilingual_node_type($form['#node']->type)) {
   
$form['language'] = array(
     
'#type' => 'select',
     
'#title' => t('Language'),
     
'#default_value' => (isset($form['#node']->language) ? $form['#node']->language : ''),
     
'#options' => array(LANGUAGE_NONE => t('Language neutral')) + locale_language_list('name'),
    );
  }
 
// Node type without language selector: assign the default for new nodes
 
elseif (!isset($form['#node']->nid)) {
   
$default = language_default();
   
$form['language'] = array(
     
'#type' => 'value',
     
'#value' => $default->language
   
);
  }
 
$form['#submit'][] = 'locale_field_node_form_submit';
}
?>
manuelBS’s picture

+1 for the patch, thanks for sharing!

amitaibu’s picture

Status:Fixed» Needs review

Re-opening. I'm not sure about it, but would like to hear others

paolomainardi’s picture

Ok, thanks Amitaibu.

Status:Needs review» Needs work

The last submitted patch, message_field_undefined-lang.2006702-5.patch, failed testing.

paolomainardi’s picture

I don't understand why SimpleTest fails with "message_type_create() undefined function" and so on.

Devin Carlson’s picture

Version:7.x-1.8» 7.x-1.x-dev
Category:support» task
Status:Needs work» Needs review
StatusFileSize
new1.36 KB
PASSED: [[SimpleTest]]: [MySQL] 69 pass(es).
[ View ]

An updated patch to use locale_language_list().

helmo’s picture

Issue summary:View changes

Even though I had the patch from #14 (included in the commons makefile) I still say empty email messages as #0. The patch from #1782134: Translatable fields: Not overriding language-none values with empty default-language values worked for me.