File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -408,9 +408,18 @@ humanize
408
408
``text ``
409
409
**type **: ``string ``
410
410
411
- Makes a technical name human readable (i.e. replaces underscores by spaces
412
- or transforms camelCase text like ``helloWorld `` to ``hello world ``
413
- and then capitalizes the string).
411
+ Transforms the given string into a human readable string (by replacing underscores
412
+ with spaces, capitalizing the string, etc.) It's useful e.g. when displaying
413
+ the names of PHP properties/variables to end users:
414
+
415
+ .. code-block :: twig
416
+
417
+ {{ 'dateOfBirth'|humanize }} {# renders: Date of birth #}
418
+ {{ 'DateOfBirth'|humanize }} {# renders: Date of birth #}
419
+ {{ 'date-of-birth'|humanize }} {# renders: Date-of-birth #}
420
+ {{ 'date_of_birth'|humanize }} {# renders: Date of birth #}
421
+ {{ 'date of birth'|humanize }} {# renders: Date of birth #}
422
+ {{ 'Date Of Birth'|humanize }} {# renders: Date of birth #}
414
423
415
424
.. _reference-twig-filter-trans :
416
425
You can’t perform that action at this time.
0 commit comments