The translate-client Reference Manual

This is the translate-client Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 18:06:22 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 translate-client

A client to online web-server translators, currently only google translate

Author

andy peterson

License

MIT

Dependencies
  • alexandria (system).
  • quri (system).
  • dexador (system).
  • assoc-utils (system).
  • yason (system).
Source

translate-client.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 translate-client/translate-client.asd

Source

translate-client.asd.

Parent Component

translate-client (system).

ASDF Systems

translate-client.


3.1.2 translate-client/package.lisp

Source

translate-client.asd.

Parent Component

translate-client (system).

Packages

translate-client.


3.1.3 translate-client/translate-client.lisp

Dependency

package.lisp (file).

Source

translate-client.asd.

Parent Component

translate-client (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 translate-client

Source

package.lisp.

Use List
  • alexandria.
  • common-lisp.
  • quri.
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: *google-api-key*

the default google cloud api key. You need your own key and should be set in your own code.

Package

translate-client.

Source

translate-client.lisp.

Special Variable: *source-language*

the default source language to be translated from. can be a string or keyword. must be an ISO-639-1 identifier

Package

translate-client.

Source

translate-client.lisp.

Special Variable: *target-language*

the target language to be translated to. can be a string or keyword. must be an ISO-639-1 identifier

Package

translate-client.

Source

translate-client.lisp.

Special Variable: *translation-format*

the translation format of the translated text. Must be :html for html or :text for plain-text

Package

translate-client.

Source

translate-client.lisp.

Special Variable: *uri-char-limit*

google states that the uri must not pass 2000 characters

Package

translate-client.

Source

translate-client.lisp.

Special Variable: *uri-host*

the google translation api host

Package

translate-client.

Source

translate-client.lisp.

Special Variable: *uri-path*

the google translation api path

Package

translate-client.

Source

translate-client.lisp.

Special Variable: *uri-scheme*

the google translation api scheme

Package

translate-client.

Source

translate-client.lisp.


5.1.2 Ordinary functions

Function: translate (strings &rest all-keys &key source target api-key format)

translates the string(s) from the source language to the target language.
The parameter strings is either a string or a list of strings to be translated.
Returns
Parameters source and target are strings or keywords and must be ISO-639-1 language identifiers. Api-key is a string and must be a valid google cloud api key.
format needs to be either :html or :text

Package

translate-client.

Source

translate-client.lisp.

Function: translate-to-alist (strings &rest all-keys &key source target api-key format)

similar to translate but returns an association list of translation pairs.

Package

translate-client.

Source

translate-client.lisp.


5.2 Internals


5.2.1 Ordinary functions

Function: divide-into-translation-groups (strings &rest all-keys &key source target api-key format)

returns a list of lists. the inner lists must be one of two things:
A list of strings (only) for a single http-request to translate multiple string or a list of a single list of strings when a single translation string must be divided into parts

Package

translate-client.

Source

translate-client.lisp.

Function: divide-long-string (str base-length)
Package

translate-client.

Source

translate-client.lisp.

Function: encoded-parameter-length (str)
Package

translate-client.

Source

translate-client.lisp.

Function: json-to-translated-strings (json-str)

given the json response from google, return the list of translated strings

Package

translate-client.

Source

translate-client.lisp.

Function: string-ellipsis (str max-length &key cut-point ellipsis)

this returns a string with maximum length max-length.
If the given string is larger than max-length, this returns a string with ellipsis in the middle at the cut-point.
If cut-point is nil, the ellipsis is in the middle.
If cut-point is zero, negative or :front, the ellipsis is at the beginning.
If cut-point is too large or :back, the ellipsis is at the end.

Package

translate-client.

Source

translate-client.lisp.

Function: translate-uri (strings &key source target api-key format)

create google uri to translates string(s) from the source language to the target language The parameter strings is either a string or a list of strings.
Parameters source and target are strings or keywords and must be ISO-639-1 language identifiers. Api-key is a string and must be a valid google cloud api key.
format needs to be either :html or :text

Package

translate-client.

Source

translate-client.lisp.

Function: whitespacep (ch)
Package

translate-client.

Source

translate-client.lisp.


5.2.2 Generic functions

Generic Reader: google-uri-reader (condition)
Package

translate-client.

Methods
Reader Method: google-uri-reader ((condition google-uri-character-limit-error))
Source

translate-client.lisp.

Target Slot

google-uri.


5.2.3 Conditions

Condition: google-uri-character-limit-error
Package

translate-client.

Source

translate-client.lisp.

Direct superclasses

error.

Direct methods

google-uri-reader.

Direct slots
Slot: google-uri
Initargs

:google-uri

Readers

google-uri-reader.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts