diff --git a/i18nviews.module b/i18nviews.module index db7b44d..7830d23 100644 --- a/i18nviews.module +++ b/i18nviews.module @@ -107,13 +107,21 @@ function i18nviews_translate_tab_access() { /** * Find the location source for a certain expression. */ -function i18nviews_locale_source($translation, $textgroup, $language = NULL) { +function i18nviews_locale_source($translation, $textgroup, $language = NULL, $transform = FALSE) { if (!isset($language)) { $language = $GLOBALS['language']->language; } $select = db_select('locales_source', 'ls'); - $select->innerJoin('locales_target', 'lt', '(ls.lid = lt.lid AND lt.translation = :translation AND lt.language = :language AND ls.textgroup = :textgroup )', array( - ':translation' => $translation, + $select->innerJoin('locales_target', 'lt', 'ls.lid = lt.lid'); + if ($transform) + $select->where("replace(convert(lt.translation using utf8), ' ', '-') like :translation", array( + ':translation' => $translation, + )); + else + $select->where('convert(lt.translation using utf8) like :translation', array( + ':translation' => $translation, + )); + $select->where('lt.language = :language AND ls.textgroup = :textgroup', array( ':language' => $language, ':textgroup' => $textgroup, )); diff --git a/includes/i18nviews_plugin_argument_validate_i18n_taxonomy_term.inc b/includes/i18nviews_plugin_argument_validate_i18n_taxonomy_term.inc index f06e39a..58aef5b 100644 --- a/includes/i18nviews_plugin_argument_validate_i18n_taxonomy_term.inc +++ b/includes/i18nviews_plugin_argument_validate_i18n_taxonomy_term.inc @@ -57,11 +57,13 @@ class i18nviews_plugin_argument_validate_i18n_taxonomy_term extends views_plugin case 'i18n_name': case 'i18n_convert': // Check to see if the term is in fact localised - $localised = i18nviews_locale_source($argument, 'taxonomy'); + $localised = i18nviews_locale_source($argument, 'taxonomy', NULL, $transform); if (!empty($localised)) { // If it is localised I set the $argument to the orginal and tell the view that the argument has been localized and to use the source $argument = $localised->source; $this->argument->argument = $localised->source; + // If it is localized, then I must not use the transform any more + $transform = false; } if ($type == 'i18n_tid' || $type == 'i18n_tids') {