bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Plural-Forms (Re: gettext/doc/gettext.texi)


From: Karl Eichwalder
Subject: Re: Plural-Forms (Re: gettext/doc/gettext.texi)
Date: Sun, 17 Feb 2002 08:00:35 +0100
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu)

Bruno Haible <address@hidden> writes:

> Nein, msgmerge übernimmt ja nur den Header-Eintrag von der
> eingeschickten PO-Datei. Wenn das maschinell unterstützt werden
> sollte, gehört es in den Emacs po-mode. Und dazu bräuchten wir von
> allen Teams die Formel. (Habe sie bisher erst für cs, da, de, el, en,
> es, fr, it, ja, nl, nn, no, pl, ru, sl, sv, tr.)

Could be done this way (using header entries from gettext CVS); maybe,
the alist should be merged with 'po-team-name-to-code':

2002-02-17  Karl Eichwalder  <address@hidden>

        * po-mode.el (po-plural-formula-alist): New variable.
        * po-mode.el (po-add-plural-formula): New function.

(defcustom po-plural-formula-alist
  '(("Brazilian Portuguese" . "nplurals=2; plural=(n > 1);")
    ("Catalan" . "nplurals=2; plural=(n != 1);")
    ("Chinese" . "nplurals=1; plural=0;")
    ("Czech". "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && 
n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);")
    ("Danish" . "nplurals=2; plural=(n != 1);")
    ("Dutch" . "nplurals=2; plural=(n != 1);")
    ("Estonian" . "nplurals=2; plural=(n != 1);")
    ("French" . "nplurals=2; plural=(n > 1);")
    ("Galician" . "nplurals=2; plural=(n!=1)")
    ("German" . "nplurals=2; plural=(n != 1);")
    ("Greek" . "nplurals=2; plural=(n != 1);")
    ("Italian" . "nplurals=2; plural=(n != 1);")
    ("Japanese" . "nplurals=1; plural=0;")
    ("Korean" . "nplurals=1; plural=0;")
    ("Norwegian Nynorsk" . "nplurals=2; plural=(n != 1);")
    ("Norwegian" . "nplurals=2; plural=(n != 1);")
    ("Polish" . "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 
|| n%100>=20) ? 1 : 2);")
    ("Russian" . "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && 
n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);")
    ("Slovak" . "nplurals=3; plural= (n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0;")
    ("Slovenian" . "nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 
|| n%100==4 ? 3 : 0);")
    ("Spanisch" . "nplurals=2; plural=(n != 1);")
    ("Swedish" . "nplurals=2; plural=(n != 1);")
    ("Turkish" . "nplurals=2; plural=(n != 1);"))
  "*Association list to give plural forms for headers from team names.
A plural form (formula) is necessary when the PO file contains plural entries.
Use \\[po-add-plural-formula] to add the formual."
  :type 'sexp
  :group 'po)

(defun po-add-plural-formula ()
  "Insert `po-add-plural-formula' or ask to edit the formula manually."
  (interactive)
  (let ((buffer-read-only nil)
        formula name)
    (goto-char (point-min))
    (po-find-span-of-entry)
    (if (re-search-forward "^\"Language-Team: \\([^ ].*[^ ]\\) 
<address@hidden>\\\\n\"$"
                           po-end-of-entry t)
        (setq name (po-match-string 1))
      (error "Language name not found."))
    (if (re-search-forward "^\"Plural-Forms:" po-end-of-entry t)
        (message "\
\"Plural-Forms:\" found; type RET (`po-edit-msgstr') to edit manually.")
      (setq formula (cdr (assoc name po-plural-formula-alist)))
      (goto-char po-end-of-entry)
      (if (not formula)
          (setq formula  "/* FORMULA UNKNOWN; edit manually. */"))
      (save-excursion
        (insert "\"Plural-Forms: " formula "\\n\"\n")
        (message "%s added." formula)))))


-- 
address@hidden (work) / address@hidden (home):              |
http://www.suse.de/~ke/                                  |      ,__o
Free Translation Project:                                |    _-\_<,
http://www.iro.umontreal.ca/contrib/po/HTML/             |   (*)/'(*)




reply via email to

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