The cl-libre-translate Reference Manual

This is the cl-libre-translate Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Fri May 15 11:53:31 2026 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-libre-translate

A Common Lisp client for the Libre Translate API for translating between human languages. See https://github.com/LibreTranslate/LibreTranslate to setup the Libre Translate service.

Author

Jeremiah LaRocco <>

License

ISC

Version

1.0.0

Dependencies
  • alexandria (system).
  • st-json (system).
  • dexador (system).
  • uiop (system).
  • trivial-clipboard (system).
Source

cl-libre-translate.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-libre-translate/cl-libre-translate.asd

Source

cl-libre-translate.asd.

Parent Component

cl-libre-translate (system).

ASDF Systems

cl-libre-translate.


3.1.2 cl-libre-translate/package.lisp

Source

cl-libre-translate.asd.

Parent Component

cl-libre-translate (system).

Packages

cl-libre-translate.


3.1.3 cl-libre-translate/main.lisp

Dependency

package.lisp (file).

Source

cl-libre-translate.asd.

Parent Component

cl-libre-translate (system).

Public Interface

main (function).


3.1.4 cl-libre-translate/cl-libre-translate.lisp

Dependency

main.lisp (file).

Source

cl-libre-translate.asd.

Parent Component

cl-libre-translate (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 cl-libre-translate

Source

package.lisp.

Nickname

lt

Use List
  • alexandria.
  • common-lisp.
  • st-json.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *api-key*

The API key to use for the connection.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *config-file*

Name of an (optional) config file containing an API key and Libre Translate URL.~ All fields are optional and will override the defaults.~
Allowed keys are "default-source", "default-target", "url" and "api-key".~ Should be JSON like {"url": "http://libretranslate.com", "api-key": "...."}

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *libre-translate-url*

The URI of Libre Translate host that will be used.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *verbose-http-stream*

Stream to log HTTP traffic to. t to use stdout, nil to disable.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.


5.1.2 Ordinary functions

Function: cached-translate (text &key source target format)

Like translate, but returns one result, and uses a local cache to avoid API lookups.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: describe-language (which-language)
Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: detect (text)

Detect the language of text.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: frontend-settings ()
Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: languages ()

Return the list of supported languages.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: load-config (&optional config-file-name)

Read *config-file*, if it exists, and populate *libre-translate-url* and~ and *api-key* parameters if the "url" and "api-key" fields are present.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: main (args)
Package

cl-libre-translate.

Source

main.lisp.

Function: show-languages (&optional stream)

Write the list of supported languages, one per line, to stream.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: suggest (text suggested source target)
Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: translate (text &key source target alternatives full format)

Translate text from the source language to the target language.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: translate-clipboard (&rest keys &key source target full format)

Like translate, but uses trivial-clipboard to read the clipboard (supports xsel, xclip, and wayland).

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: translate-file (file-name &key output-file-name source target open-it)

Translate a file. If output-file-name is given, save the results to it.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *cache*

A cache to avoid Libre Translate API requests. Set to nil to disable.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *default-file-source*

The default source language for file translation.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *default-file-target*

The default target language for file translation.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *default-source*

The default source language.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *default-target*

The default target language.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Special Variable: *language-count*

The number of supported languages.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.


5.2.2 Ordinary functions

Function: api-req (api-path &key method content)

Low level function to make an API request.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: collect (func map)

Like mapjso, but returning the results.
Returns a list with the results of calling func on each key/value pair in a JS object.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: jso-from-alist (vals)

Construct a jso directly with an existing alist

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: jso-to-alist (jso-val)

Recursively build an alist from jso-val

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.

Function: maybe-add-api-key (content)

If *api-key* is non-nil, add the API key to the request content.~ content can be JSON or an alist.

Package

cl-libre-translate.

Source

cl-libre-translate.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   C   D   F   J   L   M   S   T  
Index Entry  Section

A
api-req: Private ordinary functions

C
cached-translate: Public ordinary functions
collect: Private ordinary functions

D
describe-language: Public ordinary functions
detect: Public ordinary functions

F
frontend-settings: Public ordinary functions
Function, api-req: Private ordinary functions
Function, cached-translate: Public ordinary functions
Function, collect: Private ordinary functions
Function, describe-language: Public ordinary functions
Function, detect: Public ordinary functions
Function, frontend-settings: Public ordinary functions
Function, jso-from-alist: Private ordinary functions
Function, jso-to-alist: Private ordinary functions
Function, languages: Public ordinary functions
Function, load-config: Public ordinary functions
Function, main: Public ordinary functions
Function, maybe-add-api-key: Private ordinary functions
Function, show-languages: Public ordinary functions
Function, suggest: Public ordinary functions
Function, translate: Public ordinary functions
Function, translate-clipboard: Public ordinary functions
Function, translate-file: Public ordinary functions

J
jso-from-alist: Private ordinary functions
jso-to-alist: Private ordinary functions

L
languages: Public ordinary functions
load-config: Public ordinary functions

M
main: Public ordinary functions
maybe-add-api-key: Private ordinary functions

S
show-languages: Public ordinary functions
suggest: Public ordinary functions

T
translate: Public ordinary functions
translate-clipboard: Public ordinary functions
translate-file: Public ordinary functions