Fluid enriched labels
Introduction
Once you have created a reference to your own Fluid base path, you can extend or overwrite labels by adding new
Fluid HTML files under /Templates/ according to the XLIFF label key of
the label to be changed.
When creating the files, each . becomes a directory separator. Each
dot-separated segment is capitalized, while existing hyphens remain unchanged.
The last segment of the label key becomes the *. file.
For example, services. maps to
Labels/.
File Structure
For example the following label with key purposes.
<trans-unit id="purposes.analytics.description">
<source>These services gather anonymous data for statistical analysis and performance optimization. Enabling analytics services assists website owners in making informed decisions to enhance online services.</source>
</trans-unit>
can be created under the following file structure if the configured base path is
EXT::
Template File
If you use the DebugViewHelper to display the available variables in the newly created template file, you will notice that all information can be used in the context of the current label.
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true" lang="en">
<f:debug>{_all}</f:debug>
</html>
Now you are free to decide what you want to use in place of the label. Please note that the extension attribute is required in the context of using the Translate ViewHelper, as we are not working in the Extbase context here.
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true" lang="en">
<f:comment><!-- Output of the label --></f:comment>
<f:translate key="{locallang.key}" extensionName="KlaroConsentManager"/>
<f:comment><!-- Or any dynamic content --></f:comment>
<f:format.date format="Y">now</f:format.date>
</html>
Note
In multi-language instances, please use the label partial instead of the translate ViewHelper (contrary to the video). This ensures (outside the Extbase context) that the correct language key is used.
{f:render(partial: 'Label', arguments: '{locallang:locallang}')}
HTML Usage
If you want to use HTML tags in the label in addition to the pure text output, you must activate the HTML Texts option.
Warning
Only enable HTML output for trusted labels and trusted Fluid templates. Klaro itself does not support HTML code in every label. In such cases, the HTML characters may be encoded.
Full Structure
Based on the currently used labels, the expected structure in the Labels directory is as follows. Depending on your requirements, you can create one or more files for modifying the label under this structure.
-
-
-
-
Title.html
-
-
-
Title.html
-
-
Reset.html
-
Show.html
-
-
-
-
Name.html
-
Text.html
-
-
Description.html
-
Title.html
-
-
-
-
Name.html
-
-
-
Name.html
-
-
ChangeDescription.html
-
Description.html
-
LearnMore.html
-
Testing.html
-
Title.html
-
-
-
AcceptAlways.html
-
AcceptOnce.html
-
Description.html
-
DescriptionEmptyStore.html
-
ModalLinkText.html
-
-
-
-
Name.html
-
Path.html
-
Domain.html
-
ExpiresAfter.html
-
-
Description.html
-
Title.html
-
-
-
Name.html
-
Text.html
-
-
-
Service.html
-
Services.html
-
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
Purposes.html
-
Purpose.html
-
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
-
Description.html
-
Title.html
-
-
-
-
NoServices.html
-
NoServicesPersonalized.html
-
-
AcceptAll.html
-
AcceptSelected.html
-
Close.html
-
Day.html
-
Days.html
-
Decline.html
-
End-of-session.html
-
Hour.html
-
Hours.html
-
Minute.html
-
Minutes.html
-
Month.html
-
Months.html
-
Ok.html
-
PoweredBy.html
-
Persistent.html
-
Save.html
-
Second.html
-
Seconds.html
-
Year.html
-
Years.html
-
Append/Prepend Content
In addition to the manipulation of labels, it is also possible to display additional content before and/or after all titles and/or descriptions of purposes and/or services. The built-in cookie info table uses this mechanism for service descriptions.
The following files can be used for this purpose as required: