Answers.Body: <p>Yes. You can see all of the arguments the <code>|t</code> filter supports by looking at the docs for <a href="https://craftcms.com/classreference//Craft#t-detail">Craft::t()</a>, the function that <code>|t</code> maps to. Its <code>$language</code> argument defines the target language translation to use. So in your case you could do this:</p>
  
  <pre><code>{{ "Leer esta página en Español"|t(language="es") }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-16T05:51:27.460Z
Answers.Text: Is there a way to use this as a fallback in case the current locale string is empty? 
  
  I have a lot of incomplete translation locales and would like to fallback to the english version (100% translated) whenever a locale string is empty.
  
  Currently it's displaying the "key" value, which in my case is `snake_cased`
Answers.UserDisplayName: simonswiss
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-17T10:53:20.587Z
Answers.Text: @simonswiss You could write a macro that sets the result of the `|t` filter to a variable, and then compares the variable with the original string. If equal, run it through `|t` once more, this time translating to English. Or you could just use the English strings as the keys, like Craft and Yii do, rather than some `snake_cased` version.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-07T13:17:24.203Z
Answers.LastActivityDate: 2016-03-07T13:17:24.203Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>So I've built a language switcher as per <a href="https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher">this answer</a>.</p>
  
  <p>I want the text for each link to be in the native language, for example I want the link to the English locale to say "Read this page in English" and the link to Spanish locale to say "Leer esta página en Español" etc.</p>
  
  <p>However using the |t filter uses the locale that you're currently on, so if I'm on Spanish it says "Leer esta página en English".</p>
  
  <p>Is there a way to pass in a parameter or something to say, for example, |t(Spanish).</p>
  
  <p>Thanks!</p>
  
Tags: <localization><language>
Title: Can I choose a language for the translate filter?
ThreadText: # Can I choose a language for the translate filter?
  
  (Asked by: username_0 on 2016-03-07)
  
  So I've built a language switcher as per [this answer](https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher).
  
  I want the text for each link to be in the native language, for example I want the link to the English locale to say "Read this page in English" and the link to Spanish locale to say "Leer esta página en Español" etc.
  
  However using the |t filter uses the locale that you're currently on, so if I'm on Spanish it says "Leer esta página en English".
  
  Is there a way to pass in a parameter or something to say, for example, |t(Spanish).
  
  Thanks!
  
  **Tags:** localization, language
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-07. Score: 10 | Accepted answer
  
  Yes. You can see all of the arguments the `|t` filter supports by looking at the docs for [Craft::t()](https://craftcms.com/classreference//Craft#t-detail), the function that `|t` maps to. Its `$language` argument defines the target language translation to use. So in your case you could do this:
  
  ```
  {{ "Leer esta página en Español"|t(language="es") }}
  
  ```
  
  > **Comments:**
  > **username_2**: Is there a way to use this as a fallback in case the current locale string is empty?   I have a lot of incomplete translation locales and would like to fallback to the english version (100% translated) whenever a locale string is empty.  Currently it's displaying the "key" value, which in my case is `snake_cased`  
  > **username_1**: @username_2 You could write a macro that sets the result of the `|t` filter to a variable, and then compares the variable with the original string. If equal, run it through `|t` once more, this time translating to English. Or you could just use the English strings as the keys, like Craft and Yii do, rather than some `snake_cased` version.  
  
  ---
  
  