From 5e5df00c11582a49b64715ea5b0c0e94a3a8c0a2 Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 21 Mar 2002 02:18:43 +0000 Subject: [PATCH] Synch up with liece-2_0. --- etc/po/Makefile.am | 29 ++++++++++++++++++++++++++--- etc/sample.dot.emacs.in | 2 +- lisp/ChangeLog | 5 +++++ lisp/gettext.el | 27 ++++++++++++++++++++++++--- lisp/liece-intl.el | 2 +- 5 files changed, 57 insertions(+), 8 deletions(-) diff --git a/etc/po/Makefile.am b/etc/po/Makefile.am index 3077b4c..aec85c8 100644 --- a/etc/po/Makefile.am +++ b/etc/po/Makefile.am @@ -1,3 +1,26 @@ -podir = $(pkgdatadir)/po -po_DATA = $(wildcard *.po) -EXTRA_DIST = $(po_DATA) \ No newline at end of file +localedir = $(pkgdatadir)/locale + +pofiles = $(wildcard *.po) +mofiles = $(pofiles:%.po=%.mo) + +EXTRA_DIST = $(pofiles) + +all: $(mofiles) +%.mo: %.po + msgfmt -o $@ $< + +install-data-local: $(mofiles) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(localedir) + @list='$(mofiles)'; for p in $$list; do \ + lang=`basename $$p | sed s/\.mo//`; \ + $(mkinstalldirs) $(DESTDIR)$(localedir)/$$lang; \ + $(mkinstalldirs) $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/liece.mo"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/liece.mo; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/liece.mo"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/liece.mo; \ + fi; fi; \ + done diff --git a/etc/sample.dot.emacs.in b/etc/sample.dot.emacs.in index 817453d..bb3872e 100644 --- a/etc/sample.dot.emacs.in +++ b/etc/sample.dot.emacs.in @@ -1,5 +1,5 @@ ;;; -*- emacs-lisp -*- -(setq liece-intl-catalogue-directory "@pkgdatadir@/po" +(setq liece-intl-catalogue-directory "@pkgdatadir@/locale" liece-window-style-directory "@pkgdatadir@/styles" liece-icon-directory "@pkgdatadir@/icons") diff --git a/lisp/ChangeLog b/lisp/ChangeLog index df5b48c..ae290eb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2002-03-20 Daiki Ueno + * gettext.el (bind-text-domain): Respect LC_ALL and LC_MESSAGES; + reverse lang-paths. + +2002-03-20 Daiki Ueno + * gettext.el (gettext-parse-Content-Type): Bind `case-fold-search' to t to extract Content-Type: field properly. diff --git a/lisp/gettext.el b/lisp/gettext.el index 0051437..5e9cbe9 100644 --- a/lisp/gettext.el +++ b/lisp/gettext.el @@ -244,10 +244,31 @@ Return the list of results." Here's how the path to message files is constructed under SunOS 5.0: {pathname}/{LANG}/LC_MESSAGES/{domain}.mo \[XEmacs I18N level 3 emulating function]" - (let* ((lang (getenv "LANG")) + (let* ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES") (getenv "LANG"))) + (language (progn + (string-match "\\([^_.]+\\)\\(_[^.]+\\)?\\(\\.[^@]+\\)?" + lang) + (match-string 1 lang))) + (territory (match-string 2 lang)) + (code-set (match-string 3 lang)) + (lang-path (if lang + (delq nil (list (if (and territory code-set) + (concat language territory + code-set)) + (if territory + (concat language territory)) + (if code-set + (concat language code-set)) + language)))) (file (concat domain ".mo")) - (catalog (expand-file-name - file (concat pathname "/" lang "/LC_MESSAGES")))) + catalog) + (while (and (setq lang (car lang-path)) + (setq catalog + (expand-file-name file + (concat pathname + "/" lang "/LC_MESSAGES"))) + (not (file-exists-p catalog))) + (setq lang-path (cdr lang-path))) (when (file-exists-p catalog) ;;(file-exists-p (setq catalog (expand-file-name file pathname))) (push (cons domain catalog) gettext-message-domain-to-catalog-alist)))) diff --git a/lisp/liece-intl.el b/lisp/liece-intl.el index 78b9f66..7330650 100644 --- a/lisp/liece-intl.el +++ b/lisp/liece-intl.el @@ -66,7 +66,7 @@ (defun liece-intl-load-catalogue () (if (null liece-intl-catalogue-directory) (setq liece-intl-catalogue-directory - (liece-locate-path "po"))) + (liece-locate-path "locale"))) (bind-text-domain liece-intl-domain liece-intl-catalogue-directory)) (provide 'liece-intl) -- 1.7.10.4