interlude
interlude

Reputation: 853

Multilingual doc support for Clojure

Is there any kind of multilingual documentation support for functions? I am from Turkey. I want people to write in Clojure and I dream a line like

(doc hello-world "Turkish")

Upvotes: 1

Views: 73

Answers (1)

deprecated
deprecated

Reputation: 5242

As of today there's no such feature built into the language. You can attach arbitrary metadata to vars, though:

(defn ^{:docs {:en "Prints and returns its argument"
               :es "Imprime y devuelve su argumento"}}
  debug [x]
  (println x)
  x)

Recall that Clojure's documentation system uses the :doc metadata keyword name. So you'd have to pick another name (e.g. :docs).

Then you could redefine functions such as clojure.repl/doc so they take into account your metadata.

Upvotes: 2

Related Questions