unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* PO files and Emacs
@ 2002-03-09 14:11 Karl Eichwalder
  2002-03-10  5:03 ` Richard Stallman
  2002-03-12 13:30 ` Bruno Haible
  0 siblings, 2 replies; 36+ messages in thread
From: Karl Eichwalder @ 2002-03-09 14:11 UTC (permalink / raw)
  Cc: sanvila, neil, haible, handa

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

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án Poo Caamaño <gpoo@ubiobio.cl>\n"
"Language-Team: es <es@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-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:


[-- Attachment #2: Type: message/rfc822, Size: 12516 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 257 bytes --]

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.


[-- Attachment #2.1.2.1: Type: text/plain, Size: 152 bytes --]

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:)


[-- Attachment #2.1.2.2: Type: text/plain, Size: 5842 bytes --]

Date: Thu, 24 May 2001 01:04:34 +0200 (CEST)
From: Bruno Haible <haible@ilog.fr>
To: emacs-pretest-bug@gnu.org, Karl Eichwalder <keichwa@gmx.net>,
	Eli Zaretskii <eliz@is.elta.co.il>, translation@IRO.UMontreal.CA,
	Bruno Haible <haible@ilog.fr>,
	Pablo Saratxaga <pablo@mandrakesoft.com>,
	Primoz Peterlin <primoz.peterlin@biofiz.mf.uni-lj.si>,
	=?iso-8859-1?q?Fran=E7ois?= Pinard <pinard@IRO.UMontreal.CA>
Subject: Re: PO files and Emacs (coding:)
Message-ID: <15116.16898.335177.134247@honolulu.ilog.fr>
References: <Pine.SUN.3.91.1001010084249.6606M-100000@is>
	<sh8zjok6c6.fsf@tux.gnu.franken.de>
	<15115.49289.625922.181172@honolulu.ilog.fr>
	<sheltf7rif.fsf_-_@tux.gnu.franken.de>
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  <haible@clisp.cons.org>

	* 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 <pinard@iro.umontreal.ca>,
;;          Greg McGary <gkm@magilla.cichlid.com>,
;;          Bruno Haible <haible@clisp.cons.org>.

;; 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))))))


--=======-=-=--

[-- Attachment #2.1.2.3: Type: text/plain, Size: 4527 bytes --]

Date: Thu, 24 May 2001 20:38:38 +0300
From: "Eli Zaretskii" <eliz@is.elta.co.il>
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: <Pine.SUN.3.91.1001010084249.6606M-100000@is>
	<sh8zjok6c6.fsf@tux.gnu.franken.de>
	<15115.49289.625922.181172@honolulu.ilog.fr>
	<sheltf7rif.fsf_-_@tux.gnu.franken.de> <15116.16898.335177.134247@honolulu.ilog.fr>
MIME-Version: 1.0

> From: Bruno Haible <haible@ilog.fr>
> 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.



[-- Attachment #2.1.2.4: Type: text/plain, Size: 919 bytes --]

Date: Sun, 3 Jun 2001 09:38:02 +0300 (IDT)
From: Eli Zaretskii <eliz@is.elta.co.il>
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 <rms@gnu.org>, Gerd Moellmann <gerd@gnu.org>
Subject: Re: PO files and Emacs (coding:)
Message-ID: <Pine.SUN.3.91.1010603093715.553B-100000@is>
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.



[-- Attachment #2.1.3: Type: text/plain, Size: 272 bytes --]


-- 
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/             |   (*)/'(*)

[-- Attachment #3: Type: text/plain, Size: 273 bytes --]



-- 
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/             |   (*)/'(*)

^ permalink raw reply	[flat|nested] 36+ messages in thread
* PO files and Emacs
@ 2002-03-12  8:44 Karl Eichwalder
  0 siblings, 0 replies; 36+ messages in thread
From: Karl Eichwalder @ 2002-03-12  8:44 UTC (permalink / raw)
  Cc: emacs-devel, haible

> Yes (although it might take a few days until I get to it).

Thanks!

> However, I'm confused: should it be called po.el or po-mode.el?  Are we
> talking about 2 different files here?

I think we should start with something small (po.el as send in my last
mail); in po-mode.el is much too much compatibility code.

For more info, please read this message again (it is also available as
a part of:
http://mail.gnu.org/pipermail/emacs-devel/2002-March/006474.html):

-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-
Date: Thu, 24 May 2001 01:04:34 +0200 (CEST)
From: Bruno Haible <haible@ilog.fr>
To: emacs-pretest-bug@gnu.org, Karl Eichwalder <keichwa@gmx.net>,  
        Eli Zaretskii <eliz@is.elta.co.il>, translation@IRO.UMontreal.CA,
        Bruno Haible <haible@ilog.fr>,
        Pablo Saratxaga <pablo@mandrakesoft.com>,
        Primoz Peterlin <primoz.peterlin@biofiz.mf.uni-lj.si>,
        =?iso-8859-1?q?Fran=E7ois?= Pinard <pinard@IRO.UMontreal.CA>
Subject: Re: PO files and Emacs (coding:)   
Message-ID: <15116.16898.335177.134247@honolulu.ilog.fr>

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  <haible@clisp.cons.org>

        * 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.
-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-


-- 
Linux frechet 2.4.16-4GB #1 Wed Dec 12 13:42:58 GMT 2001 i686 unknown
  9:37am  up 40 days, 23:01, 16 users,  load average: 0.07, 0.39, 0.73
                                             work    :      ke@suse.de
Karl Eichwalder                              home    : keichwa@gmx.net

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2002-03-17 11:42 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-09 14:11 PO files and Emacs Karl Eichwalder
2002-03-10  5:03 ` Richard Stallman
2002-03-10  5:29   ` Karl Eichwalder
2002-03-11  9:00     ` Richard Stallman
2002-03-11 11:03       ` Eli Zaretskii
2002-03-11 17:54         ` Karl Eichwalder
2002-03-11 19:29           ` Andreas Schwab
2002-03-11 20:02       ` Karl Eichwalder
2002-03-12  5:53         ` Eli Zaretskii
2002-03-12 13:41           ` Bruno Haible
2002-03-12 15:53             ` Kim F. Storm
2002-03-12 16:25               ` Karl Eichwalder
2002-03-12 17:19               ` Bruno Haible
2002-03-12 17:20               ` Bruno Haible
2002-03-15 13:53                 ` Eli Zaretskii
2002-03-16  3:41                   ` Karl Eichwalder
2002-03-12 17:17             ` Eli Zaretskii
2002-03-15 13:54       ` Eli Zaretskii
2002-03-10 11:10   ` Neil Darlow
2002-03-11  5:46     ` Eli Zaretskii
2002-03-11  6:45       ` Karl Eichwalder
2002-03-11  6:53         ` Eli Zaretskii
2002-03-12 13:30 ` Bruno Haible
2002-03-15 13:29   ` Eli Zaretskii
2002-03-15 18:43     ` Bruno Haible
2002-03-16  4:36       ` Karl Eichwalder
2002-03-16  9:26         ` Eli Zaretskii
2002-03-16 13:05           ` Karl Eichwalder
2002-03-16 17:29             ` Eli Zaretskii
2002-03-16 18:41               ` Karl Eichwalder
2002-03-17  4:35                 ` Eli Zaretskii
2002-03-17  5:26                   ` Karl Eichwalder
2002-03-17 11:40                     ` Patch for GNU gettext (Re: PO files and Emacs) Karl Eichwalder
2002-03-17 11:42                     ` PO files and Emacs Eli Zaretskii
2002-03-16 10:39       ` Alex Schroeder
  -- strict thread matches above, loose matches on Subject: below --
2002-03-12  8:44 Karl Eichwalder

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).