Common Lisp Package: CL-I18N-UTILS

README:

FUNCTION

Public

CONVERT-DICTIONARY-FORMAT (OLD &KEY (PLURAL-FUNCTION 'N/=1-PLURAL-FORM))

Convert an 0.4 translation table file format to the new one

CONVERT-SAVE-DICTIONARY (OLD NEW)

Convert an 0.4 translation table file format to the new one and save in a new file

GEN-TRANSLATION-FILE (PATH OUTPUT &KEY (EXT lisp$))

Scan a directory for sources files and collect all translatable strings. The strings are merged with a translation file (if exists)

GENERATE-I18N-FILE (SOURCE-FILENAME LOCALIZATION-FILENAME &KEY (FUZZINESS 3) (PLURAL-FUNCTION #'ENGLISH-PLURAL-FORM))

Reads a Lisp source file, get all #! strings and generate the translation resource, or merge with it if the translation resource already exists. Untranslated strings that show levenshtein distance less than :fuzziness with a translated one get the translation of the latter; such translation are marked as "fuzzy" in the output file

Private

GET-STRINGS (FILENAME)

Uses CL-PPCRE to get all strings on the form #!"foo", and collect them uniquely in a list.

LEVENSHTEIN-DISTANCE (STRING1 STRING2)

Compute the levenshtein distance (i. e. how much are similars) between two strings

READ-I18N-FILE (FILENAME)

Reads the i18n file, if it exists, and put the strings into a hash table

SIMILAR-PHRASE (PHRASE DICT &KEY (THRESHOLD 3))

Scan the translation table looking for the best matching string of "phrase"