How to get absolute url with different domain language prefix What is the best way to get absolute url with correct language prefix?
The url() function accepts language parameter but it seems that it is not using it to generate the prefix - only to get translated alias. I don't care about aliases - I need correct domain prefix.

When I'm on http://en.example.com/something and use this code:

&lt;?php
$all_languages = language_list();
url('something-else', array('language' =&gt; $all_languages['nl'], 'absolute' =&gt; true));
?&gt;


I will get this: http://en.example.com/something-else (en prefix).

How can I get this: http://nl.example.com/something-else (nl prefix).
This was pulled from my theme file, but as long as you have access to $node and $language, it will do the trick:

&lt;?php
    if (isset($node))
    {
?&gt;
&lt;div class="language-switcher"&gt;
        &lt;?php
            $nodes = translation_path_get_translations("node/" . $node-&gt;nid);
            $path  = "";
            if ($language-&gt;language == "en")
            {
                if (array_key_exists("nl", $nodes))
                {
                    $path = drupal_get_path_alias($nodes["nl"], "nl");
                }
        ?&gt;
        &lt;a href="http://nl.example.com/&lt;?php print $path; ?&gt;"&gt;Change to NL&lt;/a&gt;
        &lt;?php
            }
            else
            {
                if (array_key_exists("en", $nodes))
                {
                    $path = drupal_get_path_alias($nodes["en"], "en");
                }
        ?&gt;
        &lt;a href="http://en.example.com/&lt;?php print $path; ?&gt;"&gt;Change to EN&lt;/a&gt;
        &lt;?php
            }
        ?&gt;
&lt;/div&gt;
&lt;?php
    }
?&gt;


The URL's are hard coded with the path information calculated.