Views do not work correctly in multi-language setups. I've used views to create a glossary of nodes. The ajax-based selection of nodes by letter only works for the default language not for other languages. I have tracked the problem into the file js/base.js:83:

if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') {
   var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length));

This code does not work properly if the path in a multi-language setup has the language prefix like so: http://***.com/en/glossary. I suggest the following code instead (patch attached):

  var pattern = new RegExp("[^/]*" + viewPath + "/(.*)");
  var pathmatch = pattern.exec(path);

  if (pathmatch != null) {
   var args = decodeURIComponent(pathmatch[1]);
CommentFileSizeAuthor
views_lng_prefix.patch682 bytesglorinand

Comments

glorinand’s picture

Any ideas?

dawehner’s picture

Perhaps it would help to document the regex, what the regex does.

merlinofchaos’s picture

Status: Needs review » Needs work

The regex basically cuts off anything that might precede the path. However, this could cause problems, because we're going to cut off *anything* that preceeds the view path. This means we could get false positives from paths that are similar but not actually the view path. While I think this would be a rare event, it could come up.

Which means we need to figure out some rules for figuring out what is safe to strip off. I haven't used i18n in the context where it actually adds language information to the URL at all, but I think what has to happen is that we need to be able to know what is valid there so we can properly detect it.

Leiph’s picture

Are there any updates on this? The problem remains in Views 7.x-3.5. Glossary don't work in multilingual sites with a language prefix.

chris matthews’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed: #3030347: Plan to clean process issue queue