Skip to content

Instantly share code, notes, and snippets.

@uschmelzer
Created May 10, 2015 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uschmelzer/816afad27137179b8c5c to your computer and use it in GitHub Desktop.
Save uschmelzer/816afad27137179b8c5c to your computer and use it in GitHub Desktop.
Simple language switcher
<f:layout name="Page"/>
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:section name="SimpleLanguageSwitcher">
<!-- Get current language id, e.g. 0, 1 -->
<!-- In my case 0 = German, 1 = English -->
<f:if condition="{v:page.language(normalWhenNoLanguage: 1)} == 1">
<f:then>
<!-- If current language id is 1 e.g. English, -->
<!-- create link to current page and -->
<!-- add &L=0 GET Param to switch to german language -->
<v:link.typolink configuration="{parameter: page.uid, additionalParams: '&L=0'}">Deutsch</v:link.typolink>
</f:then>
<f:else>
<v:link.typolink configuration="{parameter: page.uid, additionalParams: '&L=1'}">English</v:link.typolink>
</f:else>
</f:if>
</f:section>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment