1

I'm searching for a way to get all localized paths for one path.

For non-content pages this is quite simple:

foreach (language_list() as $language)
  $paths[$language->language] = url(current_path(), array('language' => $language));
}

For content pages (node, taxonomy, …) the path might be completely different and things like translation_path_get_translations() seem more like what I need.

Is there a reliable way to get paths to all translations of a page that works whether it's a content-page or not? It feels like there has to be an API-function for that.

1 Answer 1

0

I finally found out about language_negotiation_get_switch_links($type,$path). The tricky part is the $type argument. The types are defined by implementations of hook_language_types_info() and at least for my setup $type = 'language' does the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.