Support current language in path (Integration with i18n.module)

ardas - October 25, 2007 - 13:31
Project:Help Tip
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Greetings.

I have discovered the following issue: when I created helptip node (english version) for en/user/login and french version for fr/user/login id doesn't work because helptip module thinks the current url is user/login in both cases and LIKE doesn't work correctly.

I propose the following upgrade to integrate your module with i18n.module:

<?php
function _helptip_get_current_paths() {
 
$locale = locale_initialize();
 
$path = (module_exists('i18n') && $locale ? "$locale/" : ''). $_GET['q'];
 
$paths = array(db_escape_string($path));
  if (
$alias = drupal_lookup_path('alias', $_GET['q']))
   
$paths[] = db_escape_string($alias);
  return
$paths;
}
?>

Your thoughts? Thanks.

#1

ardas - October 25, 2007 - 13:35

A little bit better version:

<?php
function _helptip_get_current_paths() {
  if (
module_exists('i18n')) {
   
$locale = locale_initialize();
   
$path = "$locale/". $_GET['q'];
  } else {
   
$path = $_GET['q'];
  }
 
$paths = array(db_escape_string($path));
  if (
$alias = drupal_lookup_path('alias', $_GET['q']))
   
$paths[] = db_escape_string($alias);
  return
$paths;
}
?>

 
 

Drupal is a registered trademark of Dries Buytaert.