The system-locale Reference Manual

This is the system-locale Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 18:00:12 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 system-locale

System locale and language discovery

Maintainer

Yukari Hafner <>

Author

Yukari Hafner <>

Home Page

https://github.com/Shinmera/system-language

License

zlib

Version

1.0.0

Dependencies
  • documentation-utils (system).
  • cffi (system)., for feature (:or :windows :win32 :win)
Source

system-locale.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 system-locale/system-locale.asd

Source

system-locale.asd.

Parent Component

system-locale (system).

ASDF Systems

system-locale.


3.1.2 system-locale/package.lisp

Source

system-locale.asd.

Parent Component

system-locale (system).

Packages

system-locale.


3.1.3 system-locale/toolkit.lisp

Dependency

package.lisp (file).

Source

system-locale.asd.

Parent Component

system-locale (system).

Internals

3.1.4 system-locale/windows.lisp

If Feature

(:or :windows :win32 :win)

Dependency

toolkit.lisp (file).

Source

system-locale.asd.

Parent Component

system-locale (system).


3.1.5 system-locale/locale.lisp

Dependencies
Source

system-locale.asd.

Parent Component

system-locale (system).

Public Interface

3.1.6 system-locale/documentation.lisp

Dependency

locale.lisp (file).

Source

system-locale.asd.

Parent Component

system-locale (system).


4 Packages

Packages are listed by definition order.


4.1 system-locale

Source

package.lisp.

Nickname

org.shirakumo.system-locale

Use List

common-lisp.

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: *fallback-locale*

The default fallback locale used if no system locale can be discovered.

This is, by default, en_US.UTF-8.

See LOCALE

Package

system-locale.

Source

locale.lisp.

Special Variable: *languages*

The list of user-preferred languages, with the most preferred first.

This list is empty if no user-preferences could be found.
This variable is unbound if LANGUAGES has not yet been called.

See LANGUAGES
See LANGUAGE

Package

system-locale.

Source

locale.lisp.

Special Variable: *locales*

The list of user-preferred locales, with the most preferred first.

This list is empty if no user-preferences could be found.
This variable is unbound if LOCALES has not yet been called.

See LOCALES
See LOCALE

Package

system-locale.

Source

locale.lisp.


5.1.2 Ordinary functions

Function: discover-active-languages ()

Attempts to discover user-preferred system languages.

Returns a list of found language codes.
It considers the following environment variables:

- LANGUAGE

In addition it will extract the language code from all locales returned by DISCOVER-ACTIVE-LOCALES.

See DISCOVER-ACTIVE-LOCALES
See LANGUAGES

Package

system-locale.

Source

locale.lisp.

Function: discover-active-locales ()

Attempts to discover user-preferred system locales.

Returns a list of found locales.
It considers the following environment variables:

- LC_ALL
- LC_MESSAGES
- LANG

On Windows, it also considers the following WINAPI calls:

- GetUserDefaultLocaleName
- GetSystemDefaultLocaleName

See LOCALES

Package

system-locale.

Source

locale.lisp.

Function: language (&rest supported)

Accessor to the user-preferred language.

This returns the first matching item returned by LANGUAGES, or the language-code part of *FALLBACK-LOCALE* if no match by STRING-EQUAL is found.

If the fallback language was returned, the secondary value is :FALLBACK.

Setting this place will add the given language to the *LANGUAGES* list if it is not yet present, and otherwise move it to the front of the list.

See LANGUAGES
See *FALLBACK-LOCALE*

Package

system-locale.

Source

locale.lisp.

Function: (setf language) ()
Package

system-locale.

Source

locale.lisp.

Function: languages (&key rediscover)

Accessor to the list of user-preferred languages.

This may be NIL if no preferred languages have been found. If REDISCOVER is non-NIL, DISCOVER-ACTIVE-LANGUAGES is always called. Otherwise, if the *LANGUAGES* variable is bound, its value is returned instead.

See *LANGUAGES*
See DISCOVER-ACTIVE-LANGUAGES

Package

system-locale.

Source

locale.lisp.

Function: (setf languages) ()
Package

system-locale.

Source

locale.lisp.

Function: locale (&rest supported)

Accessor to the user-preferred locale.

This returns the first matching item returned by LOCALES, or *FALLBACK-LOCALE* if no match by LOCALE-EQUAL is found.

If the fallback locale was returned, the secondary value is :FALLBACK.

Setting this place will add the given locale to the *LOCALES* list if it is not yet present, and otherwise move it to the front of the list.

See LOCALE-EQUAL
See LOCALES
See *FALLBACK-LOCALE*

Package

system-locale.

Source

locale.lisp.

Function: (setf locale) ()
Package

system-locale.

Source

locale.lisp.

Function: locale-charset (locale)

Returns the charset-code part of a locale.

"en_US.UTF-8" => "UTF-8"
"en_US" => NIL
"en.UTF-8" => "UTF-8"
"en" => NIL
"_US.UTF-8" => "UTF-8"
"_US" => NIL
".UTF-8" => "UTF-8

Package

system-locale.

Source

locale.lisp.

Function: locale-equal (a b)

Returns true if the two locales are equal.

Equal means that all the locale parts that are given in both locales match.

"en" "en_US" => T
"en_GB" "_US" => NIL
etc.

Package

system-locale.

Source

locale.lisp.

Function: locale-language (locale)

Returns the language-code part of a locale.

"en_US.UTF-8" => "en"
"en_US" => "en"
"en.UTF-8" => "en"
"en" => "en"
"_US.UTF-8" => NIL
"_US" => NIL
".UTF-8" => NIL

Package

system-locale.

Source

locale.lisp.

Function: locale-region (locale)

Returns the language region-code part of a locale.

"en_US.UTF-8" => "US"
"en_US" => "US"
"en.UTF-8" => NIL
"en" => NIL
"_US.UTF-8" => "US"
"_US" => "US"
".UTF-8" => NIL

Package

system-locale.

Source

locale.lisp.

Function: locales (&key rediscover)

Accessor to the list of user-preferred locales.

This may be NIL if no preferred locales have been found. If REDISCOVER is non-NIL, DISCOVER-ACTIVE-LOCALES is always called. Otherwise, if the *LOCALES* variable is bound, its value is returned instead.

See *LOCALES*
See DISCOVER-ACTIVE-LOCALES

Package

system-locale.

Source

locale.lisp.

Function: (setf locales) ()
Package

system-locale.

Source

locale.lisp.


5.2 Internals


5.2.1 Macros

Macro: whenlet ((var val) &body body)
Package

system-locale.

Source

toolkit.lisp.


5.2.2 Ordinary functions

Function: %getenv (x)
Package

system-locale.

Source

toolkit.lisp.

Function: getenv (x)
Package

system-locale.

Source

toolkit.lisp.

Function: split (split string)
Package

system-locale.

Source

toolkit.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
D   F   G   L   M   S   W  
Index Entry  Section

%
%getenv: Private ordinary functions

(
(setf language): Public ordinary functions
(setf languages): Public ordinary functions
(setf locale): Public ordinary functions
(setf locales): Public ordinary functions

D
discover-active-languages: Public ordinary functions
discover-active-locales: Public ordinary functions

F
Function, %getenv: Private ordinary functions
Function, (setf language): Public ordinary functions
Function, (setf languages): Public ordinary functions
Function, (setf locale): Public ordinary functions
Function, (setf locales): Public ordinary functions
Function, discover-active-languages: Public ordinary functions
Function, discover-active-locales: Public ordinary functions
Function, getenv: Private ordinary functions
Function, language: Public ordinary functions
Function, languages: Public ordinary functions
Function, locale: Public ordinary functions
Function, locale-charset: Public ordinary functions
Function, locale-equal: Public ordinary functions
Function, locale-language: Public ordinary functions
Function, locale-region: Public ordinary functions
Function, locales: Public ordinary functions
Function, split: Private ordinary functions

G
getenv: Private ordinary functions

L
language: Public ordinary functions
languages: Public ordinary functions
locale: Public ordinary functions
locale-charset: Public ordinary functions
locale-equal: Public ordinary functions
locale-language: Public ordinary functions
locale-region: Public ordinary functions
locales: Public ordinary functions

M
Macro, whenlet: Private macros

S
split: Private ordinary functions

W
whenlet: Private macros