Translating to other than current languages

I would like to translate a string located in languages.yaml in my theme folder into all the languages with a for loop. I can’t use the t filter, as it uses the current language.

Many thanks.

Hello,

I never tried it before, but if you have a look at this page:

{% set langobj  = grav['language'] %}
{% set curlang  = langobj.getLanguage() %}
{% set fruits   = langobj.getTranslation(curlang,'FRUITS',true) %}
<span data-ticker="{{ fruits|join(',') }}">{{ random(fruits) }}</span>

I believe that you can do something like getTranslation('language you want', 'FRUITS', true)

Thank you very much. I did, however, make some changes to the code you provided:

{% for lang in langswitcher.languages %}
  {% set langobj  = grav['language'] %}
  {% set org = langobj.getTranslation(lang,'ORGANIZATION',true) %}  
  <span class="org-type">{{ org }}</span>
{% endfor %}

It’s intended use was in a for loop, where I used the langswitcher plugn, otherwise it would use the current language.
Thanks for your answer and pointing me in the direction of getTranslation. Much appreciated.

Amazing, thanks for sharing the code you used ! :slight_smile: