0

what is the token used to get the curent language, I want to use this token on a link in the block body, like that:

<a href="/[curent-language]/about-us">About us</a>

I find this token [site:url] is good, but in default language the link become //about-us two slashes, otherwise /fr/about-us in the french language(good).

1
  • the token is: [node:language]
    – Jack-PL
    Commented May 13, 2013 at 11:39

2 Answers 2

0

try <a href="/[node:source:language]/about-us">About us</a>

0

use this module http://drupal.org/project/token_custom to create your own token, I create a Token Type Language that containt my path token, the content of this token is the result of the PHP code(use PHP Filter module to include PHP code):

<?php 
  global $language;

  return ($language->language === 'en' ? '/' : '/'.$language->language.'/');
?>

In the block body, I can use my token like this:

<a href="[language:path]about-us">About us</a>

You can post a comment for any Help, thank you.

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.