ENGLISH·COURSE API
    Preparing search index...
    • Turns a runtime in seconds into the course overview's localized label.

      Returns (seconds: number) => string

      A function that labels a runtime given in seconds

      The hero's course total, a shelf's module total and a video card's own runtime all read the same way — "8 min", "2 h", "2 h 39 min" — so the choice between the three messages lives here once instead of in each of them. formatDuration does the arithmetic; the message catalogue owns the wording and word order per locale.

      Works in Server Components as well as Client Components: it only calls useTranslations.

      const runtimeLabel = useRuntimeLabel();
      runtimeLabel(9540); // "2 h 39 min"