Liking cljdoc? Tell your friends :D

wagoe.i18n.shell.render

Hiccup renderer that resolves [:t ...] markers to strings.

SHELL FUNCTION: calls hiccup2.core/html (I/O boundary for HTML output).

Marker syntax: [:t :key] → (t-fn :key) [:t :key {:param val}] → (t-fn :key {:param val}) [:t :key {:n 3} 3] → (t-fn :key {:n 3} 3) [:t :key nil 3] → (t-fn :key {} 3)

Dev mode wraps each resolved marker in: [:span {:data-i18n (str key)} translated-string]

Hiccup renderer that resolves [:t ...] markers to strings.

SHELL FUNCTION: calls hiccup2.core/html (I/O boundary for HTML output).

Marker syntax:
  [:t :key]                  → (t-fn :key)
  [:t :key {:param val}]     → (t-fn :key {:param val})
  [:t :key {:n 3} 3]         → (t-fn :key {:n 3} 3)
  [:t :key nil 3]            → (t-fn :key {} 3)

Dev mode wraps each resolved marker in:
  [:span {:data-i18n (str key)} translated-string]
raw docstring

renderclj

(render hiccup t-fn)
(render hiccup t-fn opts)

Resolve markers in a Hiccup tree and return an HTML string.

Calls resolve-markers then hiccup2.core/html.

Args: hiccup - Hiccup data structure t-fn - translation function (key params? n?) → string opts - (optional) map with :dev? boolean

Returns: HTML string

Resolve markers in a Hiccup tree and return an HTML string.

Calls resolve-markers then hiccup2.core/html.

Args:
  hiccup - Hiccup data structure
  t-fn   - translation function (key params? n?) → string
  opts   - (optional) map with :dev? boolean

Returns:
  HTML string
sourceraw docstring

resolve-markersclj

(resolve-markers hiccup t-fn)
(resolve-markers hiccup t-fn {:keys [dev?]})

Walk a Hiccup tree and resolve all [:t ...] markers.

Pure-ish function — does not call html, safe to use in core if t-fn is pure.

Subtrees without markers are returned as-is (structural sharing), so only the path from the root to each marker is rebuilt.

Args: hiccup - Hiccup data structure (nested vectors/maps) t-fn - translation function (key params? n?) → string opts - (optional) map with :dev? boolean

Returns: Hiccup structure with markers replaced by strings (or dev-mode spans)

Walk a Hiccup tree and resolve all [:t ...] markers.

Pure-ish function — does not call html, safe to use in core if t-fn is pure.

Subtrees without markers are returned as-is (structural sharing), so only
the path from the root to each marker is rebuilt.

Args:
  hiccup - Hiccup data structure (nested vectors/maps)
  t-fn   - translation function (key params? n?) → string
  opts   - (optional) map with :dev? boolean

Returns:
  Hiccup structure with markers replaced by strings (or dev-mode spans)
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close