I've tested this with a few views and the behavior is always the same. The path for nodes with languages other then the current one, will always be "CURRENT LANGUAGE"/node/"NID" but not the aliased path. It works perfectly for nodes with current language.

Repeatable: Always

Steps to repeat:

- add at least one translation of a node with aliased path
- setup a view with only path field display and select the nid of the translated node (with contextual filters or just filters)

Expected Results:

Paths like "de/meine-erste-node" when current language is "english".

Actual Results:

Paths like "en/node/2" when current language is "english".

Is there any way to fix this? I am currently trying to replace the query for this simple view but i haven't managed to get it working.

Comments

Anonymous’s picture

I've tried this code to replace the default query created by views:

function views_node_path_views_pre_execute(&$view) {
  if($view->name == "global" && $view->current_display == "node_path_page") {
    $myQuery = db_select('url_alias', 'ua')
      ->condition('ua.source', 'node/' . $view->argument['nid']->value[0], '=')
      ->fields('ua', array('alias'));
    $view->build_info['query'] = $myQuery;
  }
}

I need to get this working with views since i render nodes with views_datasource into json and want to add translated paths to it. The paths are in url_alias table and views_datasource is not the problem. Paths still broken even when displayed plain from views.