The translate Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The translate Reference Manual

This is the translate Reference Manual, version 0.1.1, generated automatically by Declt version 2.3 "Robert April" on Tue Jan 09 15:53:34 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction


* Introduction

  =TRANSLATE= is a thin abstraction layer over the ordinary strings
  which allows the creation of a seamless translation for your
  project. The code is written in a plain Common Lisp without any
  dependencies. A system definition is provided in =ASD= format,
  although =ASDF= isn't required to run this software.

  This library is licensed under =LLGPLv2=, which means that it may be
  used in any project for any purpose although any significant
  modifications to the library should be published. It doesn't impose
  it's license on software depending on it.

  To illustrate library usage some imaginary functions are used:
  =MAKE-BUTTON= and =MAKE-LABEL=. The following sample code convention
  is used:

  - lines preceded with ==> indicate *reader* input
  - all other lines represent *printer* output

* Description

** Basic usage

   The library pollutes =*READTABLE*= with dispatch macro character
   =#t=, where "t" is abbreviation of "translate". Instead of writing
   ordinary constant strings in his/her application, the user instead
   precedes them with =#t=:

   #+BEGIN_SRC lisp
     ==> #t"dum dum dum, piję rum"
     "la la la, I drink in the spa"
   #+END_SRC

   If =TRANSLATE:*LANGUAGE*= is bound to =NIL= and
   =TRANSLATE:*RESOLUTION-TIME*= to =:LOAD-TIME=, then =#t="hello"
   will resolve to the string "hello" and the translation will have no
   effect. It is convenient, because programmer can put =#t="strings"
   for the future translation with no functional consequences at
   run-time while keeping application innards visually separated from
   the messages meant to be presented to user.

   #+BEGIN_SRC lisp
     ==> (setf translate:*language* nil)
     NIL

     ==> (make-button :label #t"hello")
     #

Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 translate

Author

Daniel ’jackdaniel’ Kochmański <daniel@turtleware.eu>

Home Page

https://gitlab.common-lisp.net/dkochmanski/translate

License

LLGPLv2

Description

Abstraction layer for translations

Version

0.1.1

Source

translate.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 translate.asd

Location

translate.asd

Systems

translate (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 translate/package.lisp

Parent

translate (system)

Location

package.lisp

Packages

translate


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 translate/translate.lisp

Dependency

package.lisp (file)

Parent

translate (system)

Location

translate.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 translate

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *language*

Language for which the translation is done

Package

translate

Source

translate.lisp (file)

Special Variable: *resolution-time*

Controlls translation resulution time - maybe be either :run-time or :load-time

Package

translate

Source

translate.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: add-single-translation LANGUAGE PHRASE TRANSLATION

Add TRANSLATION of PHRASE for given LANGUAGE

If LANGUAGE doesn’t exist, it is implicitly created and a warning is emmited.

Package

translate

Source

translate.lisp (file)

Function: add-translations LANGUAGE &rest TRANSLATIONS

Add any number of TRANSLATIONS for the given LANGUAGE

Package

translate

Source

translate.lisp (file)

Function: define-language NAME &rest TRANSLATIONS

Define language NAME with provided TRANSLATIONS

If LANGUAGE exists, a continuable error is signalled, which allows either dropping the operation or superseding the language which is already defined. TRANSLATIONS are alternating phrases and their corresponding objects.

Package

translate

Source

translate.lisp (file)

Function: missing-translations ()

Creates a list of phrases which aren’t translated for the defined languages. Returns a list of form: ({(LANG ({PHRASE}*))}*)

Package

translate

Source

translate.lisp (file)

Function: translate PHRASE &optional LANGUAGE

Find the translation of PHRASE in the store associated with LANGUAGE

If LANGUAGE is NIL, then this is the same as the the IDENTITY function. If the provided LANGUAGE isn’t defined, the store is explicitly created. If no PHRASE is defined for a given language, it is stored for later translation and replaced by PHRASE surrunded by curly brackets.

Package

translate

Source

translate.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *translations*

Table containing further translation tables

Package

translate

Source

translate.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Macros

Macro: with-language NAME (DICT MISS M-FN) &body BODY

Conveniance macro which creates lexical invironment composed of macro symbols which resolve to language list.

Package

translate

Source

translate.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Functions

Function: ensure-language NAME &optional CERROR-P

If NAME isn’t NIL and language doesn’t exist - define it. If CERROR-P non-NIL, then signal a condition if it doesn’t exist, otherwise just emmit a warning.

Package

translate

Source

translate.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, translate.asd: The translate<dot>asd file
File, Lisp, translate/package.lisp: The translate/package<dot>lisp file
File, Lisp, translate/translate.lisp: The translate/translate<dot>lisp file

L
Lisp File, translate.asd: The translate<dot>asd file
Lisp File, translate/package.lisp: The translate/package<dot>lisp file
Lisp File, translate/translate.lisp: The translate/translate<dot>lisp file

T
translate.asd: The translate<dot>asd file
translate/package.lisp: The translate/package<dot>lisp file
translate/translate.lisp: The translate/translate<dot>lisp file

Jump to:   F   L   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   A   D   E   F   M   T   W  
Index Entry  Section

A
add-single-translation: Exported functions
add-translations: Exported functions

D
define-language: Exported functions

E
ensure-language: Internal functions

F
Function, add-single-translation: Exported functions
Function, add-translations: Exported functions
Function, define-language: Exported functions
Function, ensure-language: Internal functions
Function, missing-translations: Exported functions
Function, translate: Exported functions

M
Macro, with-language: Internal macros
missing-translations: Exported functions

T
translate: Exported functions

W
with-language: Internal macros

Jump to:   A   D   E   F   M   T   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*language*: Exported special variables
*resolution-time*: Exported special variables
*translations*: Internal special variables

S
Special Variable, *language*: Exported special variables
Special Variable, *resolution-time*: Exported special variables
Special Variable, *translations*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   S   T  
Index Entry  Section

P
Package, translate: The translate package

S
System, translate: The translate system

T
translate: The translate system
translate: The translate package

Jump to:   P   S   T