You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(duration): add Duration#humanize with I18n-compatible compound units
Adds Duration.humanize(locale?) instance method that renders a duration
as a human-readable compound string ("1 hour 1 minute", "16 minutes
40 seconds"). Selects best unit(s) based on magnitude: minutes+seconds
for sub-hour, hours+minutes for sub-day, days+hours for longer.
Uses I18n.translate with {count} interpolation for localization;
falls back to English plurals when no translation key is found.
Accepts optional locale override; defaults to current I18n locale.
Also adds duration.seconds/minutes/hours/days fallback keys to
template/config/locales/en.yml.
Closes tasks/todo/add-duration-humanize-instance-method-i18n-compatible-compound-units.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
<p class="text-gray-400 mb-3">Get the duration as a human-readable compound string (e.g., "1 hour 1 minute"). Selects the most appropriate unit(s) based on the duration length.</p>
Gets the duration as a human-readable compound string (e.g., "1 hour 1 minute"). Selects the most appropriate unit(s) based on the duration length — for sub-hour durations it combines minutes + seconds; for sub-day it combines hours + minutes; for longer durations it combines days + hours. The optional locale parameter overrides the current I18n locale for translation.
2197
+
2198
+
**Parameters:**
2199
+
-`locale` (String, optional) - Locale code for translation (defaults to current I18n locale)
0 commit comments