Creating a view that uses contextual filters to get translated taxonomy term names (Validator: Taxonomy term (i18n), Filter value type: Localised Term name/synonym converted to Term D) doesn't work as expected when the translated term has capital letters. For example given the terms with their translations:

Books (Livres)
Music (Musique)

ans a view with path /myview/(termname)

/myview/Books (works)
/myview/books (works)
/myview/Livres (works)
/myview/livres (doesn't work)

To solve the problem, the query in i18nviews.module -> function i18nviews_locale_source() needs to make a case insensitive comparison using CONVERT(lt.translation USING utf8). So the query should be:

  $select->innerJoin('locales_target', 'lt', '(ls.lid = lt.lid AND CONVERT(lt.translation USING utf8) = :translation AND lt.language = :language AND ls.textgroup = :textgroup )', array(

This way, the lowercase url will now work as expected on capitalized term names.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johan.gant’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
794 bytes

This 'fix' is specific to MySQL, but it's probably useful for anyone with a site who doesn't want to, or cannot, reconfigure their view to use term id as a contextual filter and set up a suitable URL alias for that path.

Here it is as a patch for anyone's use. Tested against 7.x-3.x-dev.

svax’s picture

I can confirm that the patch above works (using MySQL) and solved the problem. Thanks!

misthero’s picture

the patch works! please commit!