Skip to content

Commit 0329d06

Browse files
committed
[FEATURE] Configure default image conversion/preview formats
Wait for TYPO3-Documentation/TYPO3CMS-Reference-CoreApi#6136 to be merged so the link can work. References: TYPO3-Documentation/Changelog-To-Doc#1380 Releases: main
1 parent 6921dd5 commit 0329d06

File tree

1 file changed

+97
-14
lines changed

1 file changed

+97
-14
lines changed

Documentation/Global/Translate.rst

Lines changed: 97 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,77 @@ Translate ViewHelper `<f:translate>`
1515
.. seealso::
1616
* `Working with XLIFF files <https://docs.typo3.org/permalink/t3coreapi:xliff-api>`_
1717
* `Multi-language Fluid templates <https://docs.typo3.org/permalink/t3coreapi:extension-localization-fluid>`_
18+
* `Label references / Translation domains <https://docs.typo3.org/permalink/t3coreapi:label-reference>`_
19+
* `Feature: #107759 - TranslateViewHelper supports Translation Domain syntax <https://docs.typo3.org/permalink/changelog:feature-107759-1729433323>`_
1820

1921
.. contents:: Table of contents
2022

23+
.. note::
24+
.. versionadded:: 14.0
25+
The translate ViewHelper supports `translation domains <https://docs.typo3.org/permalink/t3coreapi:label-reference>`_,
26+
a short and convenient way to reference language labels without
27+
requiring `LLL:` paths or explicit extension names.
28+
29+
The translation domain syntax is the **preferred** and **future-proof** way
30+
to reference translations.
31+
32+
The traditional `LLL:` and `extension` arguments remain available for
33+
**backward compatibility**.
34+
35+
All existing syntax forms remain fully supported, ensuring backward
36+
compatibility. The new syntax can be adopted incrementally within a
37+
project, and both old and new forms can coexist in the same template.
38+
2139
.. _typo3-fluid-translate-example:
40+
.. _typo3-fluid-translate-example-domain:
41+
42+
Using translation domains
43+
=========================
44+
45+
The translation domain syntax is the **recommended** and preferred way to
46+
reference labels. It allows concise and clear label identifiers without
47+
`LLL:` paths or extension names.
48+
49+
There are two equivalent ways to use domains:
50+
51+
1. **Provide the domain separately** and reference only the identifier
52+
(recommended):
53+
54+
.. code-block:: html
55+
56+
<f:translate domain="backend.toolbar" key="save" />
57+
<f:translate domain="my_extension.messages" id="greeting.hello" />
58+
59+
2. **Use the combined domain + identifier syntax** directly in `key`/`id`:
60+
61+
.. code-block:: html
2262

23-
Examples
24-
========
63+
<f:translate key="backend.toolbar:save" />
64+
<f:translate id="my_extension.messages:greeting.hello" />
65+
66+
* The **domain** syntax is the preferred way for all new templates.
67+
* If both `domain` and `extension` are set, property **domain takes precedence**.
68+
* Traditional `key="LLL:EXT:..."` or `extension` arguments are still supported for
69+
backward compatibility.
70+
71+
.. tip::
72+
You can list all available translation domains and their corresponding
73+
language file mappings by running the console command:
74+
75+
.. code-block:: bash
76+
77+
vendor/bin/typo3 language:domain:list
78+
79+
This helps identify existing domains when migrating from `LLL:` paths
80+
to the new translation domain syntax.
81+
82+
.. _typo3-fluid-translate-example-backward:
83+
84+
Backward compatible syntax
85+
==========================
86+
87+
The following forms remain supported for older templates and extensions.
88+
New code should use translation domains instead.
2589

2690
.. _typo3-fluid-translate-example-key-only:
2791

@@ -69,6 +133,11 @@ pass the extension name or use the full `LLL:` reference for the key.
69133
The default language file must be saved in the extension specified in the
70134
argument, in the file :file:`Resources/Private/Language/locallang.xlf`.
71135

136+
.. versionchanged:: 14.0
137+
The translation domain syntax replaces this form as the preferred way
138+
to reference labels. The `extension` argument continues to work for
139+
backward compatibility.
140+
72141
.. _typo3-fluid-translate-example-key-full:
73142

74143
Full `LLL:` reference key
@@ -83,10 +152,13 @@ file can be used.
83152
key="LLL:EXT:my_extension/Resources/Private/Language/my_locallang.xlf:domain_model.title"
84153
/>
85154

155+
.. note::
156+
This legacy form remains fully supported for backward compatibility.
157+
The domain syntax should be used for all new templates.
86158
.. _typo3-fluid-translate-example-html:
87159

88160
Keeping HTML tags within translations
89-
-------------------------------------
161+
=====================================
90162

91163
HTML in language labels can be used when you surround the translate ViewHelper
92164
with a ViewHelper that allows HTML output, such as the
@@ -102,7 +174,8 @@ in the frontend.
102174

103175
<f:format.html>
104176
<f:translate
105-
key="LLL:EXT:my_extension/Resources/Private/Language/my_locallang.xlf:myKey"
177+
domain="my_extension.messages"
178+
key="content.withHtml"
106179
/>
107180
</f:format.html>
108181

@@ -121,7 +194,7 @@ The entry in the `.xlf` language file must be surrounded by `<![CDATA[...]]>`.
121194
.. _typo3-fluid-translate-example-placeholder:
122195

123196
Displaying translated labels with placeholders
124-
----------------------------------------------
197+
==============================================
125198

126199
.. tabs::
127200

@@ -130,14 +203,16 @@ Displaying translated labels with placeholders
130203
.. code-block:: html
131204

132205
<f:translate
133-
key="LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:domain_model.title"
206+
domain="my_extension.domainmodel"
207+
key="title"
134208
arguments="{0: '{myVariable}'}"
135209
/>
136210

137211
Or with several numbered placeholders:
138212

139213
<f:translate
140-
key="LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:domain_model.title"
214+
domain="my_extension.domainmodel"
215+
key="title"
141216
arguments="{1: '{myVariable}', 2: 'Some String'}"
142217
/>
143218

@@ -154,34 +229,34 @@ subsequent array entries in order.
154229
To avoid dependency on order, use indexed placeholders like `%1$s`. This
155230
explicitly refers to the first value and ensures that it is treated as a string
156231
(`$s`). This method is based on PHP’s
157-
`vsprintf function <https://www.php.net/manual/en/function.vsprintf.php>`,
232+
`vsprintf function <https://www.php.net/manual/en/function.vsprintf.php>`_,
158233
which allows for more flexible and readable formatting.
159234

160235
.. _typo3-fluid-translate-example-inline:
161236

162237
Inline notation with arguments and default value
163-
------------------------------------------------
238+
================================================
164239

165240
Like all other ViewHelpers, the translate ViewHelper can be used with the
166241
`Inline syntax <https://docs.typo3.org/permalink/fluid:viewhelper-inline-notation>`_.
167242

168243
.. code-block:: html
169244

170-
{f:translate(key: 'someKey', arguments: {0: 'dog', 1: 'fox'}, default: 'default value')}
245+
{f:translate(domain: 'my_extension.messages', key: 'animal.sentence', arguments: {0: 'dog', 1: 'fox'}, default: 'default value')}
171246

172247
This is especially useful if you want to pass the translated label to another
173248
ViewHelper, for example, as the `alt` parameter of an image:
174249

175250
.. code-block:: html
176251

177252
<f:image src="EXT:my_extension/Resources/Public/icons/Edit.svg"
178-
alt="{f:translate(key: 'icons.edit', default: 'Edit')}"
253+
alt="{f:translate(domain: 'my_extension.icons', key: 'edit', default: 'Edit')}"
179254
/>
180255

181256
.. _typo3-fluid-translate-example-console:
182257

183258
The translation ViewHelper in console/CLI context
184-
-------------------------------------------------
259+
=================================================
185260

186261
The translation ViewHelper determines the target language based on the current
187262
frontend or backend request.
@@ -195,21 +270,29 @@ to specify the desired language for the ViewHelper:
195270

196271
Salutation in Danish:
197272
<f:translate
198-
key="LLL:EXT:my_extension/Resources/Private/Language/my_locallang.xlf:salutation"
273+
domain="my_extension.messages"
274+
key="salutation"
199275
languageKey="da"
200276
/>
201277

202278
Salutation in English:
203279
<f:translate
204-
key="LLL:EXT:my_extension/Resources/Private/Language/my_locallang.xlf:salutation"
280+
domain="my_extension.messages"
281+
key="salutation"
205282
languageKey="default"
206283
/>
207284

285+
208286
.. _typo3-fluid-translate-arguments:
209287

210288
Arguments of the f:translate ViewHelper
211289
=======================================
212290

291+
.. versionadded:: 14.0
292+
The `domain` argument was added. It selects a **translation domain**
293+
and should be preferred over `extension` or `extensionName`.
294+
When both are given, `domain` takes precedence.
295+
213296
.. typo3:viewhelper:: translate
214297
:source: /Global.json
215298
:display: arguments-only

0 commit comments

Comments
 (0)