emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ Göran Uddeborg] Pattern for spell-checking in po-files.


From: Karl Eichwalder
Subject: [ Göran Uddeborg] Pattern for spell-checking in po-files.
Date: Fri, 23 May 2003 19:42:13 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

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/

--- Begin Message --- Subject: Pattern for spell-checking in po-files. Date: Tue, 20 May 2003 14:11:11 +0200
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)

[...]


--- End Message ---

-- 
                                                         |      ,__o
http://www.gnu.franken.de/ke/                            |    _-\_<,
address@hidden (work) / address@hidden (home)               |   (*)/'(*)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]