Closed cschnell closed 1 year ago
I can confirm this problem with fluidtypo3/vhs 6.1.2
when using LanguageMenuViewHelper.php
:
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<v:page.languageMenu></v:page.languageMenu>
</html>
A frontend request rendering this Fluid templates provokes the following WARNING in typo3.log
:
Wed, 03 Aug 2022 16:23:04 +0200 [WARNING] request="032f6fbe81bd2" component="TYPO3.CMS.Frontend.ContentObject.ContentObjectRenderer": The image "/var/www/typo3/public/typo3/sysext/core/Resources/Public/Icons/Flags/DE.svg" could not be found and won't be included in frontend output- FolderDoesNotExistException: Folder "/typo3/sysext/core/Resources/Public/Icons/Flags/DE.svg/" does not exist., in file /var/www/typo3/public/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php:290 - {"file":"/var/www/typo3/public/typo3/sysext/core/Resources/Public/Icons/Flags/DE.svg","exception":"TYPO3\\CMS\\Core\\Resource\\Exception\\FolderDoesNotExistException: Folder \"/typo3/sysext/core/Resources/Public/Icons/Flags/DE.svg/\" does not exist. ...
Wed, 03 Aug 2022 16:23:04 +0200 [WARNING] request="032f6fbe81bd2" component="TYPO3.CMS.Frontend.ContentObject.ContentObjectRenderer": The image "/var/www/typo3/public/typo3/sysext/core/Resources/Public/Icons/Flags/EN.svg" could not be found and won't be included in frontend output- FolderDoesNotExistException: Folder "/typo3/sysext/core/Resources/Public/Icons/Flags/EN.svg/" does not exist., in file /var/www/typo3/public/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php:290 - {"file":"/var/www/typo3/public/typo3/sysext/core/Resources/Public/Icons/Flags/EN.svg","exception":"TYPO3\\CMS\\Core\\Resource\\Exception\\FolderDoesNotExistException: Folder \"/typo3/sysext/core/Resources/Public/Icons/Flags/EN.svg/\" does not exist. ...
Indeed, these files don't exist in sysext/core
since a long time; several years ago, the SVG files have been replaced by PNG files there.
i think using the ISO is probably the wrong thing anyway. seeing that using ISO is just a fallback in code, i think the issue is in expecting the Array Key "flag" to be present, which at least in my case (TYPO3 v10) it was not. Since flagIdentifier is present but is hardcoded to add "flags-" before the entry of the siteconfig, i changed it the following way:
https://github.com/lsascha/vhs/commit/dc25edcf95dc06a59569eb9a2006159abee45bff.diff
which only adds an array-key named "flag" and removes the "flags-" part.
When the flag file is rendered in
getLanguageFlag($iso, $label)
, it assumes that a flag file for the corresponding two letter iso code (iso-639-1) exists. This is sometimes not the case, a very prominent example is English. With the correct iso-639-1 codeen
in the site configuration,getLanguageFlag($iso, $label)
tries to render the image EN.png (or another file extension if the user provided a different ImageType). If no further path has been configured, the path to the core flag icons is used. This triggers a warning on every rendering of the Language Menu because noEN.png
icon exists. There is only aGB.png
icon. To prevent the warning from being triggered, I propose a check, if the file exists and if not, return an empty String. I will submit a PR for that.What also bothers me, is that the flag is rendered in any case. I think that when the user provides the layout
name
, that should not be required? Or am I overlooking something there? If you are interested in a PR for that, too, please comment in this Issue. I will then start a new issue and PR.