RSS Feed

Lisp Project of the Day

cl-locale

You can support this project by donating at:

Donate using PatreonDonate using Liberapay

Or see the list of project sponsors.

cl-localeui

Documentation😀
Docstrings🥺
Tests 😀
Examples😀
RepositoryActivity🥺
CI 😀

This project will help you to internationalize your application. Seems, it does not use files in gettext format, but you might define translations in a lispy way:

POFTHEDAY> (cl-locale:define-dictionary hello
             (:en-US '(("Hello World!" . "Hello World!")))
             (:ru-RU '(("Hello World!" . "Привет Мир!"))))

POFTHEDAY> (cl-locale:i18n "Hello World!")
"Hello World!"

;; Now I'll switch locale to Russian
POFTHEDAY> (setf cl-locale:*locale*
                 :ru-ru)
:RU-RU

POFTHEDAY> (cl-locale:i18n "Hello World!")
"Привет Мир!"
POFTHEDAY> 

;; Also, a special syntax can be used:
POFTHEDAY> (cl-locale:enable-locale-syntax)

POFTHEDAY> #i"Hello World!"
"Привет Мир!"

Also, translations can be stored in separate Lisp files.

This library does not support an important feature - pluralization.

Pluralization depends on language rules. For example in Russian it will be:

  • 0 яблок
  • 1 яблоко
  • 2 яблока
  • 5 яблок

I hope, @nitro_idiot will be able to add pluralization, or somebody will implement this feature!


Brought to you by 40Ants under Creative Commons License