From mboxrd@z Thu Jan 1 00:00:00 1970 Path: quimby.gnus.org!not-for-mail From: Karl Eichwalder Newsgroups: gmane.emacs.devel Subject: PO files and Emacs Date: Sat, 09 Mar 2002 15:11:19 +0100 Message-ID: Reply-To: Karl Eichwalder NNTP-Posting-Host: quimby.gnus.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: quimby.gnus.org 1015683911 12376 80.91.224.244 (9 Mar 2002 14:25:11 GMT) X-Complaints-To: usenet@quimby.gnus.org NNTP-Posting-Date: 9 Mar 2002 14:25:11 GMT Cc: sanvila@unex.es, neil@darlow.co.uk, haible@ilog.fr, handa@etl.go.jp Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16jhmY-0003DW-00 for ; Sat, 09 Mar 2002 15:25:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16jhlW-0000D9-00; Sat, 09 Mar 2002 09:24:06 -0500 Original-Received: from dns.franken.de ([193.175.24.33] helo=elvis.franken.de) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16jhjK-00007I-00 for ; Sat, 09 Mar 2002 09:21:50 -0500 Original-Received: from uucp by elvis.franken.de with local-rmail (Exim 3.22 #1) id 16jhjJ-0007hz-00 for emacs-devel@gnu.org; Sat, 09 Mar 2002 15:21:49 +0100 Original-Received: by tux.gnu.franken.de (Postfix, from userid 270) id 8FDC9A4453; Sat, 9 Mar 2002 14:20:02 +0000 (UTC) Resent-Sender: ke@gnu.franken.de Resent-To: emacs-devel@gnu.org Resent-From: Karl Eichwalder Resent-Message-ID: Resent-Date: Sat, 09 Mar 2002 15:20:01 +0100 Original-Received: from uucp by elvis.franken.de with local-rmail (Exim 3.22 #1) id 16jhad-0007Vi-00; Sat, 09 Mar 2002 15:12:51 +0100 Original-Received: by tux.gnu.franken.de (Postfix, from userid 270) id 0708DA4453; Sat, 9 Mar 2002 14:11:19 +0000 (UTC) Original-Sender: ke@gnu.franken.de Original-To: emacs-devel@gnu.org Original-Lines: 414 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: quimby.gnus.org gmane.emacs.devel:1824 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1824 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable As Eli proposed I'm forwarding this mail thread to thedevel list. Short summary: po-mode.el coming with GNU gettext helps to edit so called PO files. Thanslators provide the 'msgstr ""' fields; 'msgid ""' fields containing the original program messages: #: plugins/dif/dif.c:77 plugins/excel/ms-excel-read.c:4076 msgid "Reading file..." msgstr "Leyendo archivo..." The tough part is the very first message of every file holding meta info: msgid "" msgstr "" "Project-Id-Version: gnumeric 0.69\n" "POT-Creation-Date: 2001-07-17 22:49-0400\n" "PO-Revision-Date: 2001-08-12 16:34GMT\n" "Last-Translator: Germ=E1n Poo Caama=F1o \n" "Language-Team: es \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=3Diso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" Emacs has to learn to look for the charset info and choose the correct coding. Here are the old mails: --=-=-= Content-Type: message/rfc822 Content-Disposition: inline To: Eli Zaretskii Cc: sanvila@unex.es, neil@darlow.co.uk, haible@ilog.fr, handa@etl.go.jp Subject: PO files and Emacs From: Karl Eichwalder Reply-To: Karl Eichwalder Date: Sat, 09 Mar 2002 12:05:02 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===-=-=" --===-=-= As said in the last mail, here is the old mail thread condensed. We should start to add the contents of po.el to Emacs. Personally, I wouldn't mind to add the whole po-mode.el to Emacs; but if Bruno doesn't agree we can continue to ship it with gettext. --===-=-= Content-Type: multipart/digest; boundary="====-=-=" --====-=-= Subject: Topics MIME-Version: 1.0 Topics: Re: PO files and Emacs (coding:) Re: PO files and Emacs (coding:) Re: PO files and Emacs (coding:) --====-=-= Date: Thu, 24 May 2001 01:04:34 +0200 (CEST) From: Bruno Haible To: emacs-pretest-bug@gnu.org, Karl Eichwalder , Eli Zaretskii , translation@IRO.UMontreal.CA, Bruno Haible , Pablo Saratxaga , Primoz Peterlin , =?iso-8859-1?q?Fran=E7ois?= Pinard Subject: Re: PO files and Emacs (coding:) Message-ID: <15116.16898.335177.134247@honolulu.ilog.fr> References: <15115.49289.625922.181172@honolulu.ilog.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=======-=-=" --=======-=-= Content-Description: message body text Dear Emacs maintainers, To make Karl Eichwalder's proposition more concrete. PO file support consists of two parts: 1) Make sure that Emacs displays the file in the right encoding. All PO files contains multilingual text; the right choice of coding-system is essential for them. 2) A special editing mode for use by translators (po-mode.el by Francois Pinard et al.) I would like to push part 1) into Emacs. Part 2) is probably best maintained as part of gettext. There are probably fewer users who need 2) than 1) - it is perfectly well possible (though tedious) to edit PO files in text-mode. The support consists of three parts. 1) A new file, attached to this mail. 2001-05-23 Bruno Haible * lisp/textmodes/po.el: New file, extracted from GNU gettext's po-mode.el. 2) Make sure that loaddefs.el scans that new file for autoloads. I don't know how to do this. 3) Put the following form into startup.el or any other files that is included by startup.el in all cases: (modify-coding-system-alist 'file "\\.po[tx]?\\'\\|\\.po\\." 'po-find-file-coding-system) Thanks. --=======-=-= Content-Type: text/x-elisp; charset=utf-8 Content-Disposition: inline; filename=po.el Content-Transfer-Encoding: quoted-printable Content-Description: po.el ;;; po.el --- basic support of PO translation files -*- coding: utf-8; -*- ;; Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. ;; Authors: Fran=C3=A7ois Pinard , ;; Greg McGary , ;; Bruno Haible . ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. (defconst po-content-type-charset-alist '(; Note: Emacs 21 doesn't support all encodings, thus the missing entrie= s. (ASCII . undecided) (ANSI_X3.4-1968 . undecided) (US-ASCII . undecided) (ISO-8859-1 . iso-8859-1) (ISO_8859-1 . iso-8859-1) (ISO-8859-2 . iso-8859-2) (ISO_8859-2 . iso-8859-2) (ISO-8859-3 . iso-8859-3) (ISO_8859-3 . iso-8859-3) (ISO-8859-4 . iso-8859-4) (ISO_8859-4 . iso-8859-4) (ISO-8859-5 . iso-8859-5) (ISO_8859-5 . iso-8859-5) ;(ISO-8859-6 . ??) ;(ISO_8859-6 . ??) (ISO-8859-7 . iso-8859-7) (ISO_8859-7 . iso-8859-7) (ISO-8859-8 . iso-8859-8) (ISO_8859-8 . iso-8859-8) (ISO-8859-9 . iso-8859-9) (ISO_8859-9 . iso-8859-9) ;(ISO-8859-13 . ??) ;(ISO_8859-13 . ??) ;(ISO-8859-15 . ??) ;(ISO_8859-15 . ??) (KOI8-R . koi8-r) ;(KOI8-U . ??) ;(CP850 . ??) ;(CP866 . ??) ;(CP874 . ??) ;(CP932 . ??) ;(CP949 . ??) ;(CP950 . ??) ;(CP1250 . ??) ;(CP1251 . ??) ;(CP1252 . ??) ;(CP1253 . ??) ;(CP1254 . ??) ;(CP1255 . ??) ;(CP1256 . ??) ;(CP1257 . ??) ;(GB2312 . euc-cn) ;(EUC-JP . euc-jp) ;(EUC-KR . euc-kr) ;(EUC-TW . ??) ;(BIG5 . big5) ;(BIG5HKSCS . ??) ;(GBK . ??) ;(GB18030 . ??) ;(SJIS . shift_jis) ;(JOHAB . ??) ;(TIS-620 . th-tis620) ;(VISCII . viscii) (UTF-8 . utf-8) ) "How to convert a GNU libc/libiconv canonical charset name as seen in Content-Type into a Mule coding system.") ;;;###autoload (defun po-find-file-coding-system (arg-list) "Return a Mule (DECODING . ENCODING) pair, according to PO file charset. Called through file-coding-system-alist, before the file is visited for rea= l." (and (eq (car arg-list) 'insert-file-contents) (with-temp-buffer (let ((coding-system-for-read 'no-conversion)) (insert-file-contents (nth 1 arg-list) nil 0 4096) (if (re-search-forward "^\"Content-Type: text/plain;[ \t]*charset=3D\\([^\\]+\\)" nil t) (let* ((charset (buffer-substring (match-beginning 1) (match-end 1))) (charset-upper (intern (upcase charset))) (charset-lower (intern (downcase charset)))) (list (or (cdr (assq charset-upper po-content-type-charset-alist)) (if (memq charset-lower (coding-system-list)) charset-lower 'no-conversion)))) '(no-conversion)))))) --=======-=-=-- --====-=-= Date: Thu, 24 May 2001 20:38:38 +0300 From: "Eli Zaretskii" To: haible@ilog.fr, handa@etl.go.jp Cc: emacs-pretest-bug@gnu.org, keichwa@gmx.net, translation@IRO.UMontreal.CA, haible@ilog.fr, pablo@mandrakesoft.com, primoz.peterlin@biofiz.mf.uni-lj.si, pinard@IRO.UMontreal.CA Subject: Re: PO files and Emacs (coding:) Message-Id: <2950-Thu24May2001203837+0300-eliz@is.elta.co.il> References: <15115.49289.625922.181172@honolulu.ilog.fr> <15116.16898.335177.134247@honolulu.ilog.fr> MIME-Version: 1.0 > From: Bruno Haible > Date: Thu, 24 May 2001 01:04:34 +0200 (CEST) > > PO file support consists of two parts: > > 1) Make sure that Emacs displays the file in the right encoding. > All PO files contains multilingual text; the right choice of > coding-system is essential for them. > > 2) A special editing mode for use by translators (po-mode.el by > Francois Pinard et al.) > > I would like to push part 1) into Emacs. Part 2) is probably best > maintained as part of gettext. Personally, I think po-mode.el should be part of Emacs. If Karl (or someone else) wants to remain its maintainer, it can be easily arranged, so the danger of losing control over its development does not need to bother you. But of course, this is something the current po-mode maintainer(s) should decide. > The support consists of three parts. > 1) A new file, attached to this mail. Thanks. Some comments below. > 2) Make sure that loaddefs.el scans that new file for autoloads. > > I don't know how to do this. This is done automatically when the distribution is tarred. There's a special target in lisp/Makefile ("make autoloads") which updates loaddefs.el. > 3) Put the following form into startup.el or any other files that is > included by startup.el in all cases: > > (modify-coding-system-alist 'file "\\.po[tx]?\\'\\|\\.po\\." > 'po-find-file-coding-system) Shouldn't this go into lisp/international/mule-conf.el, where the default value of file-coding-system-alist is set up? Also, at least the *.pot files are pure ASCII, no? > ;;; po.el --- basic support of PO translation files -*- coding: utf-8; -*- This is not a good idea: Emacs does not yet support Unicode well enough to distribute files encoded in UTF. It seems like the only non-ASCII characters in this file are Latin-1 characters in a name of the author, so latin-1 encoding should be good enough. If you would like a more general encoding, please use iso-2022-7bit. > (defconst po-content-type-charset-alist > '(; Note: Emacs 21 doesn't support all encodings, thus the missing en= > tries. > (ASCII . undecided) > (ANSI_X3.4-1968 . undecided) > (US-ASCII . undecided) > (ISO-8859-1 . iso-8859-1) > (ISO_8859-1 . iso-8859-1) I don't understand why do you need the upper-case variety: it should be enough to downcase the original name, as the code already does. > ;(ISO-8859-6 . ??) Emacs doesn't yet support Arabic :-(. > ;(ISO-8859-13 . ??) Not supported yet. > ;(ISO-8859-15 . ??) This is supported: use iso-8859-15. > ;(CP850 . ??) Are there really *.po files encoded in cpNNN? I don't think I saw these in the list of charsets taht the robot says it supports. Anyway, most of these are supported, and Emacs calls them cpNNN, so just use them. One caveat: cpNNN systems need to be created before they can be used. To create a cpNNN coding system, evaluate this expression: (codepage-setup NNN) where NNN is the number of the codepage; it can be given either as a string "NNN" or as a number. > ;(GB2312 . euc-cn) > ;(EUC-JP . euc-jp) > ;(EUC-KR . euc-kr) > ;(BIG5 . big5) > ;(SJIS . shift_jis) > ;(VISCII . viscii) Why did you comment these out? > ;(EUC-TW . ??) Unsupported, I think. > ;(BIG5HKSCS . ??) > ;(GBK . ??) > ;(GB18030 . ??) > ;(JOHAB . ??) Don't know anything about these. > ;(TIS-620 . th-tis620) Use tis-620. > (if (memq charset-lower (coding-system-list)) > charset-lower > 'no-conversion)))) I think it is much more efficient to use coding-system-p instead of looking in the result of (coding-system-list). Handa-san, could you please comment on that (and also on the charsets shown above)? Thanks again for your contribution. --====-=-= Date: Sun, 3 Jun 2001 09:38:02 +0300 (IDT) From: Eli Zaretskii To: haible@ilog.fr, handa@etl.go.jp, emacs-pretest-bug@gnu.org, keichwa@gmx.net, translation@IRO.UMontreal.CA, pablo@mandrakesoft.com, primoz.peterlin@biofiz.mf.uni-lj.si, pinard@IRO.UMontreal.CA Cc: Richard Stallman , Gerd Moellmann Subject: Re: PO files and Emacs (coding:) Message-ID: MIME-Version: 1.0 On Thu, 24 May 2001, I wrote: > > The support consists of three parts. > > 1) A new file, attached to this mail. > > Thanks. Some comments below. Bruno, do you plan changing the file you sent based on those comments? Or is the conclusion of this discussion that po-mode.el should be made part of Emacs (perhaps with a `msgfmt' script)? I'd like to get some practical results out of this thread, before Emacs 21.1 hits the street, if possible. --====-=-=-- --===-=-= -- ke@suse.de (work) / keichwa@gmx.net (home): | http://www.suse.de/~ke/ | ,__o Free Translation Project: | _-\_<, http://www.iro.umontreal.ca/contrib/po/HTML/ | (*)/'(*) --===-=-=-- --=-=-= -- ke@suse.de (work) / keichwa@gmx.net (home): | http://www.suse.de/~ke/ | ,__o Free Translation Project: | _-\_<, http://www.iro.umontreal.ca/contrib/po/HTML/ | (*)/'(*) --=-=-=-- _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel