diff options
-rw-r--r-- | ellinika/i18n.scm | 79 | ||||
-rw-r--r-- | xml/lingua.conf.in | 2 |
2 files changed, 43 insertions, 38 deletions
diff --git a/ellinika/i18n.scm b/ellinika/i18n.scm index e8a0065..8d9617a 100644 --- a/ellinika/i18n.scm +++ b/ellinika/i18n.scm @@ -253,47 +253,52 @@ (access? (string-append name ".gmo") R_OK)) (return dir)))) (string-split locale-path #\:)) #f))) (define (locale-setup lang domain-name locale-path) - (cond - ((not lang) - (setenv "LC_ALL" "C") - (setlocale LC_ALL "C") - #f) - (else - (let ((curlocale (if (> (string-length lang) 2) - (string-downcase (substring lang 0 2)) - lang)) - (terr #f) - (sublocale #f) - (domaindir #f)) - - (cond - ((and (> (string-length lang) 2) (char=? (string-ref lang 2) #\-)) - (set! terr (string-upcase (substring lang 3 2))) - (set! sublocale (string-append curlocale "_" terr))) - ((assoc-ref defterr (string->symbol curlocale)) => - (lambda (elt) - (set! sublocale curlocale) - (set! terr elt))) - (else - (set! sublocale curlocale) - (set! terr "XX"))) ; Hack for languages without defined territory. - - (let ((domaindir (supported-locale-dir sublocale domain-name locale-path))) - (cond - (domaindir - (let ((locale (string-append curlocale "_" terr ".UTF-8"))) - (setenv "LC_ALL" locale) - (setlocale LC_ALL locale) - (textdomain domain-name) - (bindtextdomain domain-name domaindir) - locale)) - ((setenv "LC_ALL" "C") - (setlocale LC_ALL "C") - #f))))))) + (catch 'system-error + (lambda () + (cond + ((not lang) + (setenv "LC_ALL" "C") + (setlocale LC_ALL "C") + #f) + (else + (let ((curlocale (if (> (string-length lang) 2) + (string-downcase (substring lang 0 2)) + lang)) + (terr #f) + (sublocale #f) + (domaindir #f)) + + (cond + ((and (> (string-length lang) 2) (char=? (string-ref lang 2) #\-)) + (set! terr (string-upcase (substring lang 3 2))) + (set! sublocale (string-append curlocale "_" terr))) + ((assoc-ref defterr (string->symbol curlocale)) => + (lambda (elt) + (set! sublocale curlocale) + (set! terr elt))) + (else + (set! sublocale curlocale) + (set! terr "XX"))) ; Hack for languages without defined territory. + + (let ((domaindir + (supported-locale-dir sublocale domain-name locale-path))) + (cond + (domaindir + (let ((locale (string-append curlocale "_" terr ".UTF-8"))) + (setenv "LC_ALL" locale) + (setlocale LC_ALL locale) + (textdomain domain-name) + (bindtextdomain domain-name domaindir) + locale)) + ((setenv "LC_ALL" "C") + (setlocale LC_ALL "C") + #f))))))) + (lambda args + #f))) diff --git a/xml/lingua.conf.in b/xml/lingua.conf.in index 9b8af6e..b6b7073 100644 --- a/xml/lingua.conf.in +++ b/xml/lingua.conf.in @@ -66,13 +66,13 @@ (car lang) rest (cdr lang)))))) '(("pl" . "Polski") ("ru" . "Русский") ("uk" . "Українська")))) - (display "</li></ul></ul>"))) + (display "</ul></li></ul>"))) #f ]]> </GUILE> </CONFIG> <!-- Local Variables: --> |