i18n support on node import
millette - June 6, 2008 - 15:47
| Project: | Node import |
| Version: | 5.x-1.6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs review) |
Description
I needed to import content in different languages, using i18n for multilingual content. This short patch is a single file to add i18n support.
| Attachment | Size |
|---|---|
| i18n.inc_.gz | 0 bytes |

#1
First patch was empty, sorry.
Move the uncompressed file (upload didn't like the ".inc" extension, so I gzipped it) to node_import/supported/i18n.inc and you should now see a "I18N: Language code" field taking "en", "fr" and other supported language codes.
#2
I've tried the patch with 5.x-1.2 and 5.x-1.6 of node_import, but did not get the "I18N: Language code" field shown in any of the steps of the import process. Any ideas what might be missing, or what version would you recommend this with?
#3
I added a few stuff:
<?php
/**
* Implementation of hook_node_import_fields().
*/
function i18n_node_import_fields($type) {
return array(
'language' => t('i18n: Language for node, supply iso code'),
);
}
/**
* Implementation of hook_node_import_prepare().
*/
function i18n_node_import_prepare(&$node, $preview = FALSE) {
$errors = array();
$list= i18n_language_list();
if (empty($node->language)){// || $node->language) {
unset($node->language);
}
}
/**
* Implementation of hook_node_import_global().
*/
function i18n_node_import_global($type, $global_values) {
$list = i18n_language_list();
$default= i18n_default_language();
$form = array();
$form['language'] = array(
'#type' => 'select',
'#title' => t('Language'),
'#description' => t('Select the default values you want to assign to language fields unless specifically set otherwise in the CSV file'),
'#options' => $list,
'#default_value' => i18n_default_language()
);
return $form;
}