I have a content type with a field related to a country via taxonomy term (country is a vocabulary) and this field is field_term_country.
I have this token as the pattern for the title: [node:field-term-country:i18n-name]
This content type has translatable nodes (english and spanish), and taxonomy vocabulary has localizable terms. I have "United States of America" as a term and its localized value is "Estados Unidos de América". When I create a new node, the only thing I need to do is to select the term, fill other fields and save new node, and the node gets its title based on term I selected. That works great, but when I translate that node (to Spanish), and save it (before save it, the edit node form shows me country terms already localized), the localized term I selected becomes the title of the new translation node in Spanish but it also assigns that localized term to my English node. In other words, each time I save the node whatever the language is, module assigns same title for both nodes.

I also tried replacing the token by this php code:

$translated = i18n_taxonomy_localize_terms(taxonomy_term_load($node->field_term_country['und'][0]['tid']));
print $translated->name;


JulienThomas’s picture

Title is a non translated field.

a) If you use field translation, this is a no brainer
b) If you use node translation, then this should be a bug, right?

But in general, I would for having the capacity to specify the language instead of i18n- as for (a), setting in English then Spanish would give you a Spanish title and saving again in English will give you an English title! Setting the language will solve that but I think this is a issue for token, not auto_nodetitle.

For this one single title, you may use [node:source:FIELD_NAME]

nimek’s picture

When vocabulary has localized term names user expects that term name used for title generation should be localized to given node language.

To achive that use the code

 $term = taxonomy_term_load($node->field_your_term_reference['und'][0]['tid']);
 $localized_term_name = i18n_taxonomy_term_name($term, $node->language);