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 @@ -416,9 +416,18 @@ humanize
416
416
``text ``
417
417
**type **: ``string ``
418
418
419
- Makes a technical name human readable (i.e. replaces underscores by spaces
420
- or transforms camelCase text like ``helloWorld `` to ``hello world ``
421
- and then capitalizes the string).
419
+ Transforms the given string into a human readable string (by replacing underscores
420
+ with spaces, capitalizing the string, etc.) It's useful e.g. when displaying
421
+ the names of PHP properties/variables to end users:
422
+
423
+ .. code-block :: twig
424
+
425
+ {{ 'dateOfBirth'|humanize }} {# renders: Date of birth #}
426
+ {{ 'DateOfBirth'|humanize }} {# renders: Date of birth #}
427
+ {{ 'date-of-birth'|humanize }} {# renders: Date-of-birth #}
428
+ {{ 'date_of_birth'|humanize }} {# renders: Date of birth #}
429
+ {{ 'date of birth'|humanize }} {# renders: Date of birth #}
430
+ {{ 'Date Of Birth'|humanize }} {# renders: Date of birth #}
422
431
423
432
.. _reference-twig-filter-trans :
424
433
You can’t perform that action at this time.
0 commit comments