minor #4737 Update u.rst to clarify truncate method's third argument behavior (Always-Victorious)

This PR was merged into the 3.x branch.

Discussion
----------

Update u.rst to clarify truncate method's third argument behavior

Current wording "to preserve whole words" suggests setting the argument to ``true`` preserves words. However, the parameter is ``$cut`` (defaults to ``true`` for cutting at exact length), and ``false`` is required to preserve whole words.

Commits
-------

28c2606be7 Update u.rst to clarify truncate method's third argument behavior
This commit is contained in:
Fabien Potencier
2026-01-17 10:27:09 +01:00
+1 -1
View File
@@ -31,7 +31,7 @@ Truncating a string:
{{ 'Lorem ipsum'|u.truncate(8, '...') }}
Lorem...
The ``truncate`` method also accepts a third argument to preserve whole words:
By default, ``truncate`` cuts text at the exact length. Pass ``false`` as the third argument to preserve whole words:
.. code-block:: twig