typo3multilingualfluid-styled-content

TYPO3: How to handle multi language support with fluid templates


I'm working on a page with multi language support. I've managed to get it to work with realurl and the backend.

Now I'm not quite sure how to render the translated text from the backend.

For instance: I have a page in the default language (en) with the title "Contact". Now I have created a translation in german with the title "Kontakt".

With my configuration my url now says:

But my navigation rendered with a fluid template still shows the default language even on the german url. Is there a variable for {page.title.currentLanguage} or something like that?

Of course I could create a translation inside a locallang.xlf file but in order to use the f:translate viewhelper, but that would mean I have to translate the page's name twice, right?

I appreciate all the help!

My current partial for rendering the navigation:

<nav>
    <div class="container">
        <ul class="content btns">
            <f:for each="{mainnavigation}" as="mainnavigationItem">
                <li class="{f:if(condition: mainnavigationItem.active, then:'active')}">
                    <a href="{mainnavigationItem.link}" target="{mainnavigationItem.target}" title="{mainnavigationItem.title}">{mainnavigationItem.title}</a>
                    <f:if condition="{mainnavigationItem.children}">
                        <ul>
                            <f:for each="{mainnavigationItem.children}" as="child">
                                <li class="{f:if(condition: child.active, then:'active')}">
                                    <a href="{child.link}" target="{child.target}" title="{child.title}">{child.title}</a>
                                </li>
                            </f:for>
                        </ul>
                    </f:if>
                </li>
            </f:for>
        </ul>
    </div>
</nav>

Solution

  • I found the solution I was looking for:

    While setting up regular localisation settings, I added some TypoScript configuration from the Localisation documentation. I added the following lines:

    # Localization:
    config {
            linkVars = L(int)
            sys_language_uid = 0
            sys_language_overlay = 1
            sys_language_mode = content_fallback
            language = en
            locale_all = en_US.UTF-8
            htmlTag_setParams = lang="en" dir="ltr" class="no-js"
    }
    [globalVar = GP:L = 1]
            config {
                    sys_language_uid = 1
                    language = de
                    locale_all = de_DE.UTF-8
                    htmlTag_setParams = lang="de" dir="ltr" class="no-js"
            }
    [global]
    [globalVar = GP:L = 2]
            config {
                    sys_language_uid = 2
                    language = da
                    locale_all = da_DK.UTF-8
                    htmlTag_setParams = lang="da" dir="ltr" class="no-js"
            }
    [global]
    

    Using my language IDs of course. That fixed my problem, now the translated page title appears in the title tag and my navigation.

    I'm guessing the "sys_language_overlay = 1" option has that purpose.