Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jl2/cl-libre-translate
Common Lisp package for using Libre Translate.
https://github.com/jl2/cl-libre-translate
languages libre lisp translate translation
Last synced: 5 days ago
JSON representation
Common Lisp package for using Libre Translate.
- Host: GitHub
- URL: https://github.com/jl2/cl-libre-translate
- Owner: jl2
- License: isc
- Created: 2024-10-04T07:32:06.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-10-22T05:18:57.000Z (3 months ago)
- Last Synced: 2024-10-23T03:17:18.561Z (3 months ago)
- Topics: languages, libre, lisp, translate, translation
- Language: Common Lisp
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
* cl-libre-translate
** About
An easy to use Common Lisp binding for the Libre Translate service.** Using
The easiest way to use this package is with the Docker configuration from [[https://github.com/LibreTranslate/LibreTranslate][Libre Translate]].
Clone the Libre Translate repo and start the service using:
#+begin_src shell
./run.sh --port 5001
#+end_srcOnce the service has downloaded all of the language files, use the library to translate text:
#+begin_src lisp :results value
(ql:quickload :cl-libre-translate)
(use-package :st-json)
(let ((result (lt:translate "This is a test!" :source "en" :target "zt")))
(getjso "translatedText" result))
#+end_src#+RESULTS:
: 有考驗了!To see the supported languages:
#+begin_src lisp :results output
(ql:quickload :cl-libre-translate)
(use-package :st-json)
(lt:show-languages)
#+end_src#+RESULTS:
#+begin_example
To load "cl-libre-translate":
Load 1 ASDF system:
cl-libre-translate
; Loading "cl-libre-translate"Urdu (ur)
Ukranian (uk)
Turkish (tr)
Thai (th)
Tagalog (tl)
Swedish (sv)
Spanish (es)
Slovenian (sl)
Slovak (sk)
Russian (ru)
Romanian (ro)
Portuguese (pt)
Polish (pl)
Persian (fa)
Norwegian (nb)
Malay (ms)
Lithuanian (lt)
Latvian (lv)
Korean (ko)
Japanese (ja)
Italian (it)
Irish (ga)
Indonesian (id)
Hungarian (hu)
Hindi (hi)
Hebrew (he)
Greek (el)
German (de)
Galician (gl)
French (fr)
Finnish (fi)
Estonian (et)
Esperanto (eo)
Dutch (nl)
Danish (da)
Czech (cs)
Chinese (traditional) (zt)
Chinese (zh)
Catalan (ca)
Bulgarian (bg)
Bengali (bn)
Basque (eu)
Azerbaijani (az)
Arabic (ar)
Albanian (sq)
English (en)
#+end_exampleParameters (and a config file) can be used to configure the Libre Translate server and API keys.
#+begin_src lisp :results value
(ql:quickload :cl-libre-translate)
(use-package :st-json)
(let* ((lt:*libre-translate-url* "https://libretranslate.com")
(lt:*api-key* "Some API key")
(result (lt:translate "This is a test!" :source "en" :target "es")))
(getjso "translatedText" result))
#+end_src#+RESULTS:
: ¡Esto es una prueba!** Config file
Config settings can also be read from a JSON file pointed to by the ~lt:*config-file*~ parameter. The
default location is in the package directory. The default configuration is shown below.*** Example Config
#+begin_src javascript
{
"api-key": "",
"url": "http://localhost:5001",
"default-target": "es",
"default-source": "auto"
}
#+end_src** API Keys Untested
So far I've only used this package against a local Docker service, without API keys. I have little use
for the API keys right now, so I don't plan to test them. If they are not working, please let me know,
and I'll try to fix them. A PR fixing the problem would also be welcome.** License
ISCCopyright (c) 2024 Jeremiah LaRocco