<p>Not sure if this is a good idea, but it does work. You simply got the syntax wrong, it should be:</p>

<pre><code>{{ url('a-url-slug'|t) }}
</code></pre>

CC BY-SA 3.0
2014-12-04T14:17:33.210Z
Would you look at that. Wicked! I want to avoid having to run multiple IF-statements in my template for different URL's for different static localized links.
naboovalley
CC BY-SA 3.0
2014-12-04T14:19:52.470Z
What about using macro or do it with a plugin? But can't you just avoid using static links at all and make all these URL become entries, that's what I would try to do, @naboovalley!
carlcs
CC BY-SA 3.0
2014-12-04T14:23:00.570Z
Naa.. for example I have a button "Sign up" which is just inserted a little here and there in my templates. "/signup" for English and "/registrera-dig" for Swedish to keep SEO intact. Since I'm also translating the name of the button translating the link as well seems like a good approach. No? If I add a third language I can just update the translation-file.
naboovalley
CC BY-SA 3.0
2014-12-04T12:43:02.497Z
2014-12-04T12:43:02.497Z
carlcs
<p>I'm wondering if there's some build in function in Craft that can "translate" a URL the same as a string?</p>

<p>For example when I want to translate a static string I'll use the "t" Twig filer like so:</p>

<pre><code>{{ "String"|t }}
</code></pre>

<p>Let's say I want to do the same, but with my localized URL's. Imaging this:</p>

<pre><code>{{ url('a-url-slug')|t }}
</code></pre>

<p>Then in my translation file I can add different URL's that's localized (but loading the same template, I'm solving this using Routes).</p>

<templating><localization>
Can I "translate" static URL's?
# Can I "translate" static URL's?

(Asked by: username_0 on 2014-12-04)

I'm wondering if there's some build in function in Craft that can "translate" a URL the same as a string?
For example when I want to translate a static string I'll use the "t" Twig filer like so:
{{ "String"|t }}

Let's say I want to do the same, but with my localized URL's. Imaging this:
{{ url('a-url-slug')|t }}

Then in my translation file I can add different URL's that's localized (but loading the same template, I'm solving this using Routes).

**Tags:** templating, localization

---

## 1 answers

### Answer by username_1 on 2014-12-04. Score: 2 | Accepted answer

Not sure if this is a good idea, but it does work. You simply got the syntax wrong, it should be:
{{ url('a-url-slug'|t) }}

> **Comments:**
> **username_0**: Would you look at that. Wicked! I want to avoid having to run multiple IF-statements in my template for different URL's for different static localized links.  
> **username_1**: What about using macro or do it with a plugin? But can't you just avoid using static links at all and make all these URL become entries, that's what I would try to do, @naboovalley!  
> **username_0**: Naa.. for example I have a button "Sign up" which is just inserted a little here and there in my templates. "/signup" for English and "/registrera-dig" for Swedish to keep SEO intact. Since I'm also translating the name of the button translating the link as well seems like a good approach. No? If I add a third language I can just update the translation-file.  

---

