Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.26 KB

0053-cl-locale.org

File metadata and controls

52 lines (39 loc) · 1.26 KB

cl-locale

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!