I need a custom language switcher for a website, I created succesfully the switcher, the problems have arrived when using URL alias.

With he las modification each content type can be translated and have a custom alias. The switcher was working ok when it was a single node reference, but now I need a way to find the correct URL for each language when rendering the switcher.

Old working code:

print('<li class="'.$last.'"><a href="/'.$language->prefix.'/'.$path'.'"something</a>');

I tried with path alias but I don't know what I need to put in $language_path.

$path = current_path();
$path_alias = drupal_lookup_path('alias',$path, $language_path);

print('<li class="'.$last.'"><a href="/'.$language->prefix.'/'.$path_alias'.'"something</a>');

I hope it makes sense and you can help me!

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.