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.
Comment | File | Size | Author |
---|---|---|---|
#1 | normalise-term-name-to-lcase-mysql-comparison-1965982.patch | 794 bytes | johan.gant |
Comments
Comment #1
johan.gant CreditAttribution: johan.gant commentedThis '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.
Comment #2
svax CreditAttribution: svax commentedI can confirm that the patch above works (using MySQL) and solved the problem. Thanks!
Comment #3
misthero CreditAttribution: misthero commentedthe patch works! please commit!