The system-locale Reference Manual

Table of Contents

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

The system-locale Reference Manual

This is the system-locale Reference Manual, version 1.0.0, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Jul 29 16:43:54 2019 GMT+0.


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

1 Introduction

About System-Locale

This library retrieves locale information configured on the system. This is helpful if you want to write applications and libraries that display messages in the user's native language.

How To

Primarily you'll want to use the functions locale and language to retrieve the information. You can also setf them if you want to force a particular setting.

(system-locale:locale)   ; => "en_GB.UTF-8"
(system-locale:language) ; => "en"

The functions discover-active-locales and discover-active-languages describe how the locale and language discovery is handled.


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 system-locale

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

Home Page

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

License

zlib

Description

System locale and language discovery

Version

1.0.0

Dependencies
Source

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

Location

system-locale.asd

Systems

system-locale (system)


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

3.1.2 system-locale/package.lisp

Parent

system-locale (system)

Location

package.lisp

Packages

system-locale


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

3.1.3 system-locale/toolkit.lisp

Dependency

package.lisp (file)

Parent

system-locale (system)

Location

toolkit.lisp

Internal Definitions

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

3.1.4 system-locale/windows.lisp

If Feature

(or windows win32 win)

Dependency

toolkit.lisp (file)

Parent

system-locale (system)

Location

windows.lisp


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

3.1.5 system-locale/locale.lisp

Dependency

windows.lisp (file)

Parent

system-locale (system)

Location

locale.lisp

Exported Definitions

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

3.1.6 system-locale/documentation.lisp

Dependency

locale.lisp (file)

Parent

system-locale (system)

Location

documentation.lisp


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

4 Packages

Packages are listed by definition order.


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

4.1 system-locale

Source

package.lisp (file)

Nickname

org.shirakumo.system-locale

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: *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 (file)

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 (file)

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 (file)


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

5.1.2 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 (file)

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 (file)

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 (file)

Writer

(setf language) (function)

Function: (setf language) LANGUAGE
Package

system-locale

Source

locale.lisp (file)

Reader

language (function)

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 (file)

Writer

(setf languages) (function)

Function: (setf languages) LANGUAGES
Package

system-locale

Source

locale.lisp (file)

Reader

languages (function)

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 (file)

Writer

(setf locale) (function)

Function: (setf locale) LOCALE
Package

system-locale

Source

locale.lisp (file)

Reader

locale (function)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

Writer

(setf locales) (function)

Function: (setf locales) LOCALES
Package

system-locale

Source

locale.lisp (file)

Reader

locales (function)


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

5.2 Internal definitions


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

5.2.1 Macros

Macro: whenlet (VAR VAL) &body BODY
Package

system-locale

Source

toolkit.lisp (file)


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

5.2.2 Functions

Function: %getenv X
Package

system-locale

Source

toolkit.lisp (file)

Function: getenv X
Package

system-locale

Source

toolkit.lisp (file)

Function: split SPLIT STRING
Package

system-locale

Source

toolkit.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   S  
Index Entry  Section

F
File, Lisp, system-locale.asd: The system-locale<dot>asd file
File, Lisp, system-locale/documentation.lisp: The system-locale/documentation<dot>lisp file
File, Lisp, system-locale/locale.lisp: The system-locale/locale<dot>lisp file
File, Lisp, system-locale/package.lisp: The system-locale/package<dot>lisp file
File, Lisp, system-locale/toolkit.lisp: The system-locale/toolkit<dot>lisp file
File, Lisp, system-locale/windows.lisp: The system-locale/windows<dot>lisp file

L
Lisp File, system-locale.asd: The system-locale<dot>asd file
Lisp File, system-locale/documentation.lisp: The system-locale/documentation<dot>lisp file
Lisp File, system-locale/locale.lisp: The system-locale/locale<dot>lisp file
Lisp File, system-locale/package.lisp: The system-locale/package<dot>lisp file
Lisp File, system-locale/toolkit.lisp: The system-locale/toolkit<dot>lisp file
Lisp File, system-locale/windows.lisp: The system-locale/windows<dot>lisp file

S
system-locale.asd: The system-locale<dot>asd file
system-locale/documentation.lisp: The system-locale/documentation<dot>lisp file
system-locale/locale.lisp: The system-locale/locale<dot>lisp file
system-locale/package.lisp: The system-locale/package<dot>lisp file
system-locale/toolkit.lisp: The system-locale/toolkit<dot>lisp file
system-locale/windows.lisp: The system-locale/windows<dot>lisp file

Jump to:   F   L   S  

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

A.2 Functions

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

%
%getenv: Internal functions

(
(setf language): Exported functions
(setf languages): Exported functions
(setf locale): Exported functions
(setf locales): Exported functions

D
discover-active-languages: Exported functions
discover-active-locales: Exported functions

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

G
getenv: Internal functions

L
language: Exported functions
languages: Exported functions
locale: Exported functions
locale-charset: Exported functions
locale-equal: Exported functions
locale-language: Exported functions
locale-region: Exported functions
locales: Exported functions

M
Macro, whenlet: Internal macros

S
split: Internal functions

W
whenlet: Internal macros

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

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

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*fallback-locale*: Exported special variables
*languages*: Exported special variables
*locales*: Exported special variables

S
Special Variable, *fallback-locale*: Exported special variables
Special Variable, *languages*: Exported special variables
Special Variable, *locales*: Exported special variables

Jump to:   *  
S  

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

A.4 Data types

Jump to:   P   S  
Index Entry  Section

P
Package, system-locale: The system-locale package

S
System, system-locale: The system-locale system
system-locale: The system-locale system
system-locale: The system-locale package

Jump to:   P   S