Skip to content

Allow DateTimeHelper::humanDuration to support custom language localization#16332

Closed
kabel wants to merge 1 commit intocraftcms:4.xfrom
kabel:feature/twig-duration-localization
Closed

Allow DateTimeHelper::humanDuration to support custom language localization#16332
kabel wants to merge 1 commit intocraftcms:4.xfrom
kabel:feature/twig-duration-localization

Conversation

@kabel
Copy link
Copy Markdown

@kabel kabel commented Dec 13, 2024

Description

This helper is exposed through the twig filter |duration and it would be helpful to pass a custom language to this function without having to override the site language.

Related issues

N/A

…lization

This also allows the twig filter `|duration(language = 'es')` for content that might be in a different language than the current site.
brandonkelly added a commit that referenced this pull request Dec 14, 2024
@brandonkelly
Copy link
Copy Markdown
Member

brandonkelly commented Dec 14, 2024

Thanks for the PR! Added via 761208f instead (for Craft 4.14 and 5.6), as it needed a test case.

@brandonkelly
Copy link
Copy Markdown
Member

Craft 4.14.0 and 5.6.0 are out with that change. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants