Liking cljdoc? Tell your friends :D

facilguide.core

Multi-language routing and locale utilities for Facil.guide. Provides locale detection, localized URL path construction, hreflang tag generation, and a locale registry for internationalized senior-friendly technology guides.

Multi-language routing and locale utilities for Facil.guide.
Provides locale detection, localized URL path construction,
hreflang tag generation, and a locale registry for internationalized
senior-friendly technology guides.
raw docstring

detect-localeclj

(detect-locale path)

Detect the locale from a URL path by checking for a language prefix. Returns the locale keyword if found, or :en as the default.

(detect-locale "/es/guia/iphone") ;; => :es

(detect-locale "/guides/setup") ;; => :en

Detect the locale from a URL path by checking for a language prefix.
Returns the locale keyword if found, or :en as the default.

(detect-locale "/es/guia/iphone")
;; => :es

(detect-locale "/guides/setup")
;; => :en
sourceraw docstring

hreflang-tagsclj

(hreflang-tags base-path)

Generate a sequence of hreflang link tag maps for a given base path. Produces one entry per supported locale plus an x-default for English. Suitable for rendering into HTML head elements.

(hreflang-tags "/guides/iphone") ;; => ({:rel "alternate" :hreflang "en" :href "/guides/iphone"} ;; {:rel "alternate" :hreflang "es" :href "/es/guides/iphone"} ;; ... ;; {:rel "alternate" :hreflang "x-default" :href "/guides/iphone"})

Generate a sequence of hreflang link tag maps for a given base path.
Produces one entry per supported locale plus an x-default for English.
Suitable for rendering into HTML head elements.

(hreflang-tags "/guides/iphone")
;; => ({:rel "alternate" :hreflang "en" :href "/guides/iphone"}
;;     {:rel "alternate" :hreflang "es" :href "/es/guides/iphone"}
;;     ...
;;     {:rel "alternate" :hreflang "x-default" :href "/guides/iphone"})
sourceraw docstring

locale-switcher-dataclj

(locale-switcher-data base-path)
(locale-switcher-data base-path current-locale)

Generate data for a language switcher UI component. Returns a sequence of maps with locale info and the localized URL.

(locale-switcher-data "/guides/iphone") ;; => ({:locale :en :name "English" :native "English" :href "/guides/iphone" :active false} ;; {:locale :es :name "Spanish" :native "Espanol" :href "/es/guides/iphone" :active false} ;; ...)

Generate data for a language switcher UI component.
Returns a sequence of maps with locale info and the localized URL.

(locale-switcher-data "/guides/iphone")
;; => ({:locale :en :name "English" :native "English" :href "/guides/iphone" :active false}
;;     {:locale :es :name "Spanish" :native "Espanol" :href "/es/guides/iphone" :active false}
;;     ...)
sourceraw docstring

localesclj

Map of supported locales with display name, native name, and hreflang code.

Map of supported locales with display name, native name, and hreflang code.
sourceraw docstring

localized-pathclj

(localized-path locale base-path)

Build a localized URL path for a given locale and base path. English paths have no prefix. Other locales get their prefix prepended. Handles leading slashes correctly.

(localized-path :es "/guides/iphone") ;; => "/es/guides/iphone"

(localized-path :en "/guides/iphone") ;; => "/guides/iphone"

Build a localized URL path for a given locale and base path.
English paths have no prefix. Other locales get their prefix prepended.
Handles leading slashes correctly.

(localized-path :es "/guides/iphone")
;; => "/es/guides/iphone"

(localized-path :en "/guides/iphone")
;; => "/guides/iphone"
sourceraw docstring

supported-codesclj

Set of supported locale codes for fast lookup.

Set of supported locale codes for fast lookup.
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