Project

General

Profile

Actions

Task #84926

closed

Add support for the usage of the selected flag of the site language for the LanguageMenuProcessor

Added by Simon Gilli over 6 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Frontend
Start date:
2018-05-04
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Sites SiteLanguage LanguageMenuProcessor
Complexity:
easy
Sprint Focus:

Description

The new site module introcduces the selection of a flag per site language. The usage of this flag with the LanguageMenuProcessor should be simplified.

Actions #1

Updated by Susanne Moog about 6 years ago

  • Target version changed from 9 LTS to Candidate for Major Version
Actions #2

Updated by Susanne Moog about 6 years ago

  • Parent task deleted (#84727)
Actions #3

Updated by Benjamin Kott about 6 years ago

  • Status changed from Accepted to Rejected

All information that is nessesary to identify a language is available through the language menus.
We will not provide frontend assets for the frontend.

Actions #4

Updated by Matthias Krappitz almost 6 years ago

But if I use the LanguageMenuProcessor and want to render a flag language menu in fluid I would need the information which flag was selected in the site config for each language, but this information is missing in the items of the LanguageMenuProcessor, which contains for example for my current de and en languages:

array(11 items)
   languageId => 0 (integer)
   locale => 'de_DE.UTF-8' (11 chars)
   title => 'Deutsch' (7 chars)
   navigationTitle => 'Deutsch' (7 chars)
   twoLetterIsoCode => 'de' (2 chars)
   hreflang => 'de-DE' (5 chars)
   direction => '' (0 chars)
   link => '...' (20 chars)
   active => 1 (integer)
   current => 0 (integer)
   available => 1 (integer)
array(11 items)
   languageId => 1 (integer)
   locale => 'en_UK.UTF-8' (11 chars)
   title => 'Englisch' (8 chars)
   navigationTitle => 'English' (7 chars)
   twoLetterIsoCode => 'en' (2 chars)
   hreflang => 'en-UK' (5 chars)
   direction => '' (0 chars)
   link => '...' (23 chars)
   active => 0 (integer)
   current => 0 (integer)
   available => 1 (integer)

I am missing the property flag => 'de' or flag => 'gb', that I set in my siteconfig.

Actions #5

Updated by Christian Michael about 5 years ago

@Simon Gilli and @Matthias Krappitz are completly right: I miss the property "flag" too. Here my stupid workaround:

<f:if condition="{item.locale} == en">
   <f:then>
     <img src="/typo3/sysext/core/Resources/Public/Icons/Flags/GB.png"> {item.navigationTitle}
  </f:then>
  <f:else>
    <img src="/typo3/sysext/core/Resources/Public/Icons/Flags/<f:format.case>{item.locale}</f:format.case>.png"> {item.navigationTitle}
  </f:else>
</f:if>

It could be much easier with the flag property:

<img src="/typo3/sysext/core/Resources/Public/Icons/Flags/{item.flag}.png"> 

The Flag icon is a field in the site configuration. Why not to implement it to the LanguageMenuProcessor? Nobody is asking for assets, just need that field "flag".

Actions #6

Updated by Gerrit Code Review about 4 years ago

  • Status changed from Rejected to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65800

Actions #7

Updated by Simon Gilli about 4 years ago

Testing is easy using the Introduction Package, just add the following Fluid partial to a Sitepackage or replace it in the Bootstrap Package.

Resources/Private/Partials/Page/Navigation/Language.html:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{languagenavigation}">
    <ul id="language_menu" class="language-menu">
        <f:for each="{languagenavigation}" as="item">
            <li class="{f:if(condition: item.active, then: 'active')} {f:if(condition: item.available, else: 'text-muted')}">
                <f:debug>{item}</f:debug>
                <f:if condition="{item.available}">
                    <f:then>
                        <a href="{item.link}" hreflang="{item.hreflang}" title="{item.title}">
                            <span><core:icon identifier="{item.flag}" size="small" /></span>
                            <span>{item.navigationTitle}</span>
                        </a>
                    </f:then>
                    <f:else>
                        <span><core:icon identifier="{item.flag}" size="small" /></span>
                        <span>{item.navigationTitle}</span>
                    </f:else>
                </f:if>
            </li>
        </f:for>
    </ul>
</f:if>
</html>
Actions #8

Updated by Simon Gilli about 4 years ago

  • % Done changed from 0 to 100
  • TYPO3 Version changed from 9 to 10
  • Complexity changed from medium to easy
Actions #9

Updated by Gerrit Code Review about 4 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65814

Actions #10

Updated by Simon Gilli about 4 years ago

  • Status changed from Under Review to Resolved
Actions #11

Updated by Roderick Braun almost 4 years ago

Gerrit Code Review wrote in #note-9:

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65814

This patch works fine for current LTS 9.5 too, it should be pushed to this version too.

Actions #12

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF