I'm trying to localize terms of a localizable vocabulary. However, i18n_taxonomy_localize_terms doesn't seem to localize them because i18n_taxonomy_vocabulary_mode returns a string whereas I18N_MODE_LOCALIZE is an integer.

They are equal (value is 1), but not identical (string versus integer), so it seems like the following comparison will always return false:

if (i18n_taxonomy_vocabulary_mode($term->vid) === I18N_MODE_LOCALIZE) {

To reproduce this issue, run following code (replace $vid with the vid of your localizable vocabulary):

  $vid = 5;
  
  $taxonomy_mode = i18n_taxonomy_vocabulary_mode($vid);
  $localize_mode = I18N_MODE_LOCALIZE;
  
  if(is_string($taxonomy_mode)) dpm('taxonomy mode = '.$taxonomy_mode. ' ('.gettype($taxonomy_mode).')');
  if(is_int($localize_mode)) dpm('localizable mode = '.$localize_mode.' ('.gettype($localize_mode).')');

Comments

betz’s picture

yep, this is blocking.

jose reyero’s picture

Status: Active » Fixed

Replaced by the right usage of taxonomy modes, which is
i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE)

It uses '&' operator, so it should work now. Check out latest -dev version.

Status: Fixed » Closed (fixed)

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

clude’s picture

Same problem, but i have installed the 7.x-1.x-dev (2012-Aug-06).

Error:

Fatal error: Call to undefined function i18n_taxonomy_localize_terms() in /webseiten/sites/all/modules/advanced_forum/includes/core-overrides.inc on line

Or is that a Advanced Forum bug?

clude’s picture

Ok it`s a Advanced Forum bug.