Skip to content

Feat/plural forms secondstostring - #32

Merged
ralflang merged 2 commits into
horde:FRAMEWORK_6_0from
jcdelepine:feat/plural_forms_secondstostring
Aug 26, 2026
Merged

ralflang merged 2 commits into
horde:FRAMEWORK_6_0from
jcdelepine:feat/plural_forms_secondstostring

Conversation

@jcdelepine

Copy link
Copy Markdown
Contributor

What & why

Nag::secondsToString() built duration strings using four composite translatable strings ("%d hours, %d minute", "%d hour, %d minutes", etc.) covering every singular/plural combination of hours and minutes. This produced %d hour / %d minute as plain (non-plural) msgids in nag.pot, colliding with kronolith.pot, which already defines the same strings as a proper ngettext() plural pair for the same concept (task/event duration). The mismatch made msgcat fail when building the translation compendium:

msgcat: msgid '%d minute' est utilisé sans et avec le pluriel.
msgcat: msgid '%d hour' est utilisé sans et avec le pluriel.

This PR rewrites secondsToString() to build the hour and minute parts independently via ngettext(), then joins them. This removes the four composite strings entirely, replacing them with the same plural pair pattern already used by kronolith for hours and minutes.

Translation impact

This changes the set of translatable strings: the four composite msgids become obsolete, replaced by two ngettext()-based plural pairs. This does mean existing translations of the composite strings will need to be redone by translators. Aligning with kronolith's existing plural pattern seemed preferable to preserving a structure that was already causing tooling issues."

Note on testing

I was unable to test this through the Nag UI — task due/start date fields are currently broken on my dev instance independently of this change, so I couldn't exercise secondsToString() end-to-end via the task list or portal block.

I verified the refactored function directly via CLI instead:

0 => no time
30 => no time
60 => 1 minute
61 => 1 minute
3600 => 1 hour
3660 => 1 hour, 1 minute
3720 => 1 hour, 2 minutes
7200 => 2 hours
7260 => 2 hours, 1 minute
7320 => 2 hours, 2 minutes

Output matches the original implementation's expected behavior for all singular/plural boundary cases.

@ralflang
ralflang merged commit 08613d9 into horde:FRAMEWORK_6_0 Aug 26, 2026
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