   :args (s/cat :s string?)
   :ret string?)
 
+(defn prepend-slash
+  "Prepend slash to string if none found."
+  [s]
+  (if (string/starts-with? s "/") s (str "/" s)))
+(s/fdef prepend-slash
+  :args (s/cat :s string?)
+  :ret string?)
+
+
+;;;; CSS modifications
+(defn toggle-class
+  "Toggle CSS class of provided DOM element. A third paramenter as boolean can
+  be provided to force removing or adding the class."
+  ([dom-element class] (.classList/toggle dom-element class))
+  ([dom-element class bool] (.classList/toggle dom-element class bool)))
+
+(defn remove-class
+  "Remove a specific class of a DOM element."
+  [dom-element class]
+  (toggle-class dom-element class false))
+
+(defn add-class
+  "Add a specific class to a DOM element."
+  [dom-element class]
+  (toggle-class dom-element class true))
+
+
+;;;; Language
+(defn language
+  "Returns currently selected language."
+  []
+  (load-from-app-state :layout/lang))
+
+(defn language-next!
+  "Set new language. Should be a keyword."
+  [lang]
+  (store-to-app-state! 'layout/lang lang))
+
+(defn language-locale
+  "Return String as a locale for DateTime instances etc. Defaults to en-US."
+  []
+  (let [lang (language)]
+    (case lang
+      :de "de-DE"
+      "en-US")))
+(s/fdef language-locale
+  :ret string?)
+
+
+;;;; Other
+(defn get-value-by-id
+  "Return value of element matching the id."
+  [id]
+  (let [element (.getElementById js/document (prefix-name id))]
+    (when element (.-value element))))
+
 (defn log
   "Print argument as JS object to be accessible from the console."
   [arg]

            [inflections.core :refer [plural]]
            [discuss.config :as config]
            [discuss.parser :as parser]
            [discuss.utils.logging :as log]))

(defn prefix-name
  "Create unique id for DOM elements."

  :args (s/cat :col coll? :namespace any?)
  :ret coll?)

(defn parse-query-parameter
  "Provide a key which should be parsed from the URL. Return nil if key was not
  found."
  [query-parameter]
  (get (:query (url/url (-> js/window .-location .-href)))
       query-parameter))
(s/fdef parse-query-parameter
  :args (s/cat :query-parameter string?)
  :ret (s/? string?))

;; -----------------------------------------------------------------------------
;; Configuration Settings
