File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -408,9 +408,18 @@ humanize
408408 ``text ``
409409 **type **: ``string ``
410410
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 #}
414423
415424 .. _reference-twig-filter-trans :
416425
You can’t perform that action at this time.
0 commit comments