Automatically mapping to a Vocabulary based on language detected

nmridul - August 14, 2009 - 16:27
Project:Feed Element Mapper
Version:6.x-1.0-beta7
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:feedapi mapper, taxonomy
Description

Can anyone please guide me in the right direction.

My aim -
I'm using language detect module to detect the feed item language. Now I want to map the terms/tags to the correct taxonomy vocabulary for the language (automatically for all feeds and feed items, without manually choosing in the map option). Say, if the item is in German, I want all the terms in the feed item to go to a vocabulary called "German Vocabulary", If the item is detected to be in English, all the terms should go to vocabulary named "English Vocabulary".

What I'm doing now

I created my own module "my_languagedetect" and created function my_languagedetect_feedapi_after_parse(). I have vocabularies called "GermanVocabulary", "EnglishVocabulary" etc.

I do something like this.

<?php
// This is the language detected
$item->language = $mn_lang

if (
$vocabularies = taxonomy_get_vocabularies($node->type) ) {           
     foreach (
$vocabularies as $v) {
         if(
$v->name == ($item->language." Vocabulary") ) {
             print
"ITEM = ".$item->language." Vocab ".$v->name."\n";
             break;
         }
     }
}

// my_feedapi_mapper_create_terms is a copy of _feedapi_mapper_create_terms
$item->taxonomy = array_merge($item->taxonomy, my_languagedetect_feedapi_mapper_create_terms($item->options->tags, $v->vid));
?>

my_feedapi_mapper_create_terms() is exact copy of _feedapi_mapper_create_terms, a localcopy in my module

The above code gets the terms from the feed item and adds to the correct vocabulary. But it does not link the node to the term. That is if you click on the vocabulary, all the terms are available there. But if you click any of the terms, there are no nodes.

So I try using "my_languagedetect_feedapi_mapper" to create my own custom mapper based on the developmentseed blog. Still no luck. It does not even call the mapper function while mapping (it calls the mapper function with 'list' option).

Am I missing something ? Please help me.

I'm a s/w programmer, so I can handle PHP. But I know nothing about databases and queries. Can I achieve my requirements without any database access ?

#1

nmridul - August 17, 2009 - 13:57

hello,,, any help ??

#2

staminna - August 21, 2009 - 18:18

Yes, you can use autotag project database system which enables you to an extra free tagging taxonomy field per content type.
From the above, map the feed. Talk to http://drupal.org/user/334091 and provide OG integration?

Regards,
Jorge.

#3

nmridul - September 30, 2009 - 12:45

Thank you. I now map it to a default vocabulary and the function gets called...

 
 

Drupal is a registered trademark of Dries Buytaert.