Commit b62c2419 authored by David Kågedal's avatar David Kågedal
Browse files

Fixade språkhanteringen så att man kan ha flera språk laddade

samtidigt.
parent cd680bf3
Mon Oct 21 00:54:00 1996 David Kgedal <davidk@lysator.liu.se>
* swedish-strings.el (lyskom-language-sv): Rensade bort
kom-put-files, kom-get-files och kom-list files.
* english-strings.el (lyskom-strings): Dito.
* macros.el (map-keymap): Ignorera symboler i keymapen.
* language.el (lyskom-language-keymaps): Ny variabel
(lyskom-language-keymap-internal): Ny funktion.
(lyskom-language-keymap): Nytt makro.
(lyskom-set-language-keymaps): Ny funktion.
(lyskom-set-language-vars): Ny funktion.
(lyskom-set-language): Anropa lyskom-set-language-vars och
lyskom-set-language-keymaps.
* lyskom-rest.el (lyskom-get-error-text): Anvnd
lyskom-get-string-internal.
* language.el (lyskom-language-strings): Gjorde om till ett makro.
Sun Oct 20 03:46:22 1996 David Kgedal <davidk@lysator.liu.se> Sun Oct 20 03:46:22 1996 David Kgedal <davidk@lysator.liu.se>
* lyskom-rest.el: La till ett anrop av lyskom-set-language, ngot
malplacerat.
* language.el (lyskom-set-language): Ny funktion.
* swedish-strings.el: Flyttade alla defvar till vars.el.in (med * swedish-strings.el: Flyttade alla defvar till vars.el.in (med
nil-vrden) och ersatte med lyskom-language-var. nil-vrden) och ersatte med lyskom-language-var.
......
...@@ -93,8 +93,8 @@ vars.el: vars.el.in Makefile ...@@ -93,8 +93,8 @@ vars.el: vars.el.in Makefile
sed 's/@@CLIENTVERSION@@/$(CLIENTVERSION)/' < vars.el.in > vars.el sed 's/@@CLIENTVERSION@@/$(CLIENTVERSION)/' < vars.el.in > vars.el
chmod 444 vars.el chmod 444 vars.el
lyskom.el: $(HEADER-EL) $(SWEDISH-EL) $(PARTS-EL) lyskom.el: $(HEADER-EL) $(SWEDISH-EL) $(ENGLISH-EL) $(PARTS-EL)
cat $(HEADER-EL) $(SWEDISH-EL) $(PARTS-EL) > lyskom.el cat $(HEADER-EL) $(SWEDISH-EL) $(ENGLISH-EL) $(PARTS-EL) > lyskom.el
lyskom.elc: lyskom.el lyskom.elc: lyskom.el
$(EMACS-BATCH) -f batch-byte-compile lyskom.el $(EMACS-BATCH) -f batch-byte-compile lyskom.el
......
Att göra i elisp-klienten Att göra i elisp-klienten
========================= =========================
Buggar -------- Buggar
prefix-kommandon änndras inte vid språkbyten.
Långsamma kommandon buggar, eftersom bufferten är skrivskyddad. Långsamma kommandon buggar, eftersom bufferten är skrivskyddad.
...@@ -74,7 +76,7 @@ n ...@@ -74,7 +76,7 @@ n
prompten "Läsa nästa brev" i stället för "Läsa nästa prompten "Läsa nästa brev" i stället för "Läsa nästa
kommentar". Kommentaren ligger inte i brevlådan. (LÅGPRIORITET) kommentar". Kommentaren ligger inte i brevlådan. (LÅGPRIORITET)
Allmänna förbättringar -------- Allmänna förbättringar
Modifiera interna datastrukturer vid utträd. Modifiera interna datastrukturer vid utträd.
...@@ -118,7 +120,7 @@ Allm ...@@ -118,7 +120,7 @@ Allm
Reentrant blocking-do Reentrant blocking-do
Fixade saker -------- Fixade saker
Jag har satt kom-show-footnotes-immediately till nil. Det verkar Jag har satt kom-show-footnotes-immediately till nil. Det verkar
som man inte får läsa fotnötter först då, t ex fick jag läsa som man inte får läsa fotnötter först då, t ex fick jag läsa
......
This diff is collapsed.
...@@ -41,8 +41,7 @@ ...@@ -41,8 +41,7 @@
(defvar lyskom-language-symbols nil (defvar lyskom-language-symbols nil
"Symbols with language data bound to them") "Symbols with language data bound to them")
(defvar lyskom-language-categories nil ;;; Variables
"Categories used")
(defvar lyskom-language-vars nil (defvar lyskom-language-vars nil
"A list of all language-dependent variables.") "A list of all language-dependent variables.")
...@@ -66,7 +65,62 @@ ...@@ -66,7 +65,62 @@
(put 'lyskom-language-var 'lisp-indent-function 2) (put 'lyskom-language-var 'lisp-indent-function 2)
(defun lyskom-language-strings (category language alist) (defun lyskom-set-language-vars (language)
(mapcar
(function
(lambda (var)
(if (or (not (symbol-value var))
(get var 'lyskom-language-force))
(set var (eval (cdr (assq language
(get var 'lyskom-language-var))))))))
lyskom-language-vars))
;;; Keymaps
(defvar lyskom-language-keymaps nil
"A list of all language-dependent variables.")
(defun lyskom-language-keymap-internal (keymap language langmap)
"Defines a language-local variable value."
;; If the "real" keymap has no value, set it to an empty keymap
(if (eval keymap)
nil
(set keymap (make-sparse-keymap)))
;; Add it to the list of keymaps
(or (memq keymap lyskom-language-keymaps)
(setq lyskom-language-keymaps
(cons keymap lyskom-language-keymaps)))
;; Modify the property list
(let* ((alist (get keymap 'lyskom-language-keymap))
(entry (assq language alist)))
(if entry
(setcdr entry langmap)
(put keymap 'lyskom-language-keymap
(cons (cons language langmap) alist)))))
(defmacro lyskom-language-keymap (keymap language langmap)
(list 'lyskom-language-keymap-internal
(list 'quote keymap)
(list 'quote language)
(list 'quote langmap)))
(put 'lyskom-language-keymap 'lisp-indent-function 2)
(defun lyskom-set-language-keymaps (language)
(mapcar
(function
(lambda (map)
(setcdr (symbol-value map)
(eval (cdr (assq language
(get map 'lyskom-language-keymap)))))))
lyskom-language-keymaps))
;;; String catalogs
(defvar lyskom-language-categories nil
"Categories used")
(defun lyskom-language-strings-internal (category language alist)
"Associates names to symbols. "Associates names to symbols.
CATEGORY and LANGUAGE determines what kind of association to CATEGORY and LANGUAGE determines what kind of association to
...@@ -90,6 +144,12 @@ create. ALIST is a mapping from symbols to strings." ...@@ -90,6 +144,12 @@ create. ALIST is a mapping from symbols to strings."
(cons (cons language string) llist)))))) (cons (cons language string) llist))))))
alist)) alist))
(defmacro lyskom-language-strings (category language alist)
(list 'lyskom-language-strings-internal
(list 'quote category)
(list 'quote language)
alist))
(put 'lyskom-language-strings 'lisp-indent-function 2) (put 'lyskom-language-strings 'lisp-indent-function 2)
(defsubst lyskom-get-string-internal (symbol category) (defsubst lyskom-get-string-internal (symbol category)
...@@ -140,6 +200,18 @@ if 'lyskom-menu is not found." ...@@ -140,6 +200,18 @@ if 'lyskom-menu is not found."
lyskom-language-symbols))) lyskom-language-symbols)))
(defun lyskom-define-language (language name)
;; Do nothing for now
)
(defun lyskom-set-language (language)
"Set the current language to LANGUAGE."
(setq lyskom-language language)
(lyskom-set-language-vars language)
(lyskom-set-language-keymaps language)
(lyskom-build-menus))
(provide 'lyskom-language) (provide 'lyskom-language)
;;; language.el ends here ;;; language.el ends here
...@@ -118,10 +118,11 @@ ...@@ -118,10 +118,11 @@
(defun lyskom-get-error-text (errno) (defun lyskom-get-error-text (errno)
"Get a string which is the error ERRNO in plain text." "Get a string which is the error ERRNO in plain text."
(let ((pair (assoc errno lyskom-error-texts))) (or
(if pair (lyskom-get-string-internal (intern (concat "error-"
(cdr pair) (number-to-string errno)))
(lyskom-format 'error-not-found errno)))) 'lyskom-error-texts)
(lyskom-format 'error-not-found errno)))
(defun lyskom-report-command-answer (answer) (defun lyskom-report-command-answer (answer)
"Handles a void return from call to the server." "Handles a void return from call to the server."
...@@ -2300,8 +2301,11 @@ One parameter - the prompt string." ...@@ -2300,8 +2301,11 @@ One parameter - the prompt string."
;;; This code removed (lyskom-tell-phrases-validate) ;;; This code removed (lyskom-tell-phrases-validate)
;;
(lyskom-set-language lyskom-language)
;; Build the menus ;; Build the menus
(lyskom-build-menus) ;; (lyskom-build-menus)
(or (memq 'lyskom-unread-mode-line global-mode-string) (or (memq 'lyskom-unread-mode-line global-mode-string)
......
...@@ -304,7 +304,9 @@ STRING should be given if the last search was by `string-match' on STRING." ...@@ -304,7 +304,9 @@ STRING should be given if the last search was by `string-match' on STRING."
(setq r (1+ r)))) (setq r (1+ r))))
(t (mapcar (function (t (mapcar (function
(lambda (x) (lambda (x)
(funcall fn (car x) (cdr x)))) ;; It might be an inherited keymap
(if (consp x)
(funcall fn (car x) (cdr x)))))
(cdr keymap)))))) (cdr keymap))))))
......
No preview for this file type
...@@ -737,6 +737,8 @@ Also see the function \"lyskom-add-button-action\". ...@@ -737,6 +737,8 @@ Also see the function \"lyskom-add-button-action\".
This variable is not saved in the LysKOM server.") This variable is not saved in the LysKOM server.")
(put 'lyskom-button-actions 'lyskom-language-force t)
(defvar kom-mercial nil (defvar kom-mercial nil
"*When the user has seen all texts and has reached the view-time prompt, "*When the user has seen all texts and has reached the view-time prompt,
this string is used as the argument to lyskom-tell-server. this string is used as the argument to lyskom-tell-server.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment