unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [ Göran Uddeborg] Pattern for spell-checking in po-files.
@ 2003-05-23 17:42 Karl Eichwalder
  2003-05-23 22:26 ` [ Göran Uddeborg ] " Stefan Monnier
  2003-05-24 23:20 ` [ Göran Uddeborg] " Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Karl Eichwalder @ 2003-05-23 17:42 UTC (permalink / raw)
  Cc: emacs-devel

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

I'd like to ask for ispell support for .po files.  .po files are
translation files as used by the gettext tools collection.  Basically
they contain the english message (msgid) and translation (msgstr)
provided by the translator, plus comments (# ):

# this is the first message
#, c-format
msgid ""
"this is a message."
msgstr ""
"dies ist eine Meldung."

# this is the 2nd message
#, c-format
msgid ""
"this is the sencond message."
msgstr ""
"dies ist die zweite Meldung."

ispell should check text after "# " (but not after "#[.,:]") and inside
the field 'msgstr' only.  Göran Uddeborg already came up with the
appended extension to po-mode.el.  I'd recommend to add something along
these lines to ispell.el (as already done for 'tex).

For testing more .po files you can find here:

    http://www.iro.umontreal.ca/contrib/po/teams/PO/


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

From: "Göran Uddeborg" <goeran@uddeborg.pp.se>
To: sv@li.org, translation-i18n@lists.sourceforge.net
Subject: Pattern for spell-checking in po-files.
Date: Tue, 20 May 2003 14:11:11 +0200
Message-ID: <16074.7007.769528.285017@uebn.uddeborg.pp.se>

I made a little hook to po-mode to set up patterns for ispell so only
the translated strings and translator comments are checked.  This
might be a too trivial thing, but I haven't seen it elsewhere so I
thought I'd post it.  So I get some help with debugging! :-)

Maybe I will trigger someone to post their own much better ideas?

This is not perfect in any way.  Since the po file is in read only
mode, you can only use it to detect misspellings, but not fix them
on-the-fly in the ordinary ispell-mode way.

(defun po-mode-ispell-pattern ()
  "Add ispell patterns so that only translated messages are checked."
  (make-variable-buffer-local 'ispell-skip-region-alist)
  (add-to-list 'ispell-skip-region-alist '("^msgid" . "^msgstr"))
  (add-to-list 'ispell-skip-region-alist '("^#[:,]" . "\n")))
(add-hook 'po-mode-hook 'po-mode-ispell-pattern)

[...]


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



-- 
                                                         |      ,__o
http://www.gnu.franken.de/ke/                            |    _-\_<,
ke@suse.de (work) / keichwa@gmx.net (home)               |   (*)/'(*)

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

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

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

* Re: [G ran Uddeborg] Pattern for spell-checking in po-files.
       [not found] <1261.1053715963@ichips.intel.com>
@ 2003-05-23 21:08 ` Kenny Stevens
  0 siblings, 0 replies; 5+ messages in thread
From: Kenny Stevens @ 2003-05-23 21:08 UTC (permalink / raw)
  Cc: emacs-devel

Ken Stevens writes: 

> I'd like to ask for ispell support for .po files.  .po files are
> translation files as used by the gettext tools collection.  Basically
> they contain the english message (msgid) and translation (msgstr)
> provided by the translator, plus comments (# ):

Certainly.  Some questions:

Do we _always_ want to only check the msgstr values, or does it make
sense to check the English text as well?

I would prefer to have this automatic based on major or minor mode.  I
didn't locate any po-mode library...  can you send that to me to help
testing?

In my short evaluation, the following regexp seems to be an
improvement:

("^msgid" . "^msgstr")

replaced by:

("^\\(#~ \\)?msgid" . "^\\(#~ \\)?msgstr")

regards		    -Ken

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

* Re: [ Göran Uddeborg ] Pattern for spell-checking in po-files.
  2003-05-23 17:42 [ Göran Uddeborg] Pattern for spell-checking in po-files Karl Eichwalder
@ 2003-05-23 22:26 ` Stefan Monnier
  2003-05-24 21:51   ` Göran Uddeborg
  2003-05-24 23:20 ` [ Göran Uddeborg] " Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2003-05-23 22:26 UTC (permalink / raw)
  Cc: emacs-devel

> (defun po-mode-ispell-pattern ()
>   "Add ispell patterns so that only translated messages are checked."
>   (make-variable-buffer-local 'ispell-skip-region-alist)

Calling make-variable-buffer-local from a function doesn't make sense
(I wish it were easier for the byte-compiler to check and warn about it).
You want to use make-local-variable instead.


	Stefan

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

* Re: [ Göran Uddeborg ] Pattern for spell-checking in po-files.
  2003-05-23 22:26 ` [ Göran Uddeborg ] " Stefan Monnier
@ 2003-05-24 21:51   ` Göran Uddeborg
  0 siblings, 0 replies; 5+ messages in thread
From: Göran Uddeborg @ 2003-05-24 21:51 UTC (permalink / raw)
  Cc: emacs-devel

Stefan Monnier writes:
> Calling make-variable-buffer-local from a function doesn't make sense

> You want to use make-local-variable instead.

Thanks!  (It's a big language, Elisp, with lots left for me to learn!)

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

* Re: [ Göran Uddeborg] Pattern for spell-checking in po-files.
  2003-05-23 17:42 [ Göran Uddeborg] Pattern for spell-checking in po-files Karl Eichwalder
  2003-05-23 22:26 ` [ Göran Uddeborg ] " Stefan Monnier
@ 2003-05-24 23:20 ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2003-05-24 23:20 UTC (permalink / raw)
  Cc: emacs-devel

I agree this is a good idea.

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

end of thread, other threads:[~2003-05-24 23:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-23 17:42 [ Göran Uddeborg] Pattern for spell-checking in po-files Karl Eichwalder
2003-05-23 22:26 ` [ Göran Uddeborg ] " Stefan Monnier
2003-05-24 21:51   ` Göran Uddeborg
2003-05-24 23:20 ` [ Göran Uddeborg] " Richard Stallman
     [not found] <1261.1053715963@ichips.intel.com>
2003-05-23 21:08 ` [G ran " Kenny Stevens

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