]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Add some checking of file name.
authorBruno Haible <bruno@clisp.org>
Mon, 26 Nov 2001 22:28:41 +0000 (22:28 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 21:26:09 +0000 (23:26 +0200)
misc/ChangeLog
misc/po-mode.el

index 6d5d9d675c3980719b36a48076bbe815eeaea278..770f999deec165071983b691f117bbf5afa455fb 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-25  Karl Eichwalder  <ke@suse.de>
+
+       * po-mode.el (po-guess-archive-name): Verify that versions provided by
+       file name and by Project-Id-Version field match.
+
 2001-11-18  Bruno Haible  <haible@clisp.cons.org>
 
        * gettextize.in: New option --intl.
index dc1b576511f5e123581996b4927f4c7f7db61eef..a8f68d485726eced4f658f59ea3c757436ee7695 100644 (file)
@@ -3139,7 +3139,8 @@ Leave point after marked string."
 
 (defun po-guess-archive-name ()
   "Return the ideal file name for this PO file in the central archives."
-  (let (start-of-header end-of-header package version team)
+  (let ((filename (file-name-nondirectory buffer-file-name))
+       start-of-header end-of-header package version team)
     (save-excursion
       ;; Find the PO file header entry.
       (goto-char (point-min))
@@ -3156,6 +3157,17 @@ Leave point after marked string."
       (if (or (not package) (string-equal package "PACKAGE")
              (not version) (string-equal version "VERSION"))
          (error (_"Project-Id-Version field does not have a proper value")))
+      ;; File name version and Project-Id-Version must match
+      (cond (;; A `filename' w/o package and version info at all
+            (string-match "^[^\\.]*\\.po\\'" filename))
+           (;; TP Robot compatible `filename': PACKAGE-VERSION.LL.po
+            (string-match (concat (regexp-quote package)
+                                  "-\\(.*\\)\\.[^\\.]*\\.po\\'") filename)
+            (if (not (equal version (po-match-string 1 filename)))
+                (error (_"\
+Version mismatch: file name: %s; header: %s.\n\
+Adjust Project-Id-Version field to match file name and try again")
+                       (po-match-string 1 filename) version))))
       ;; Get the team.
       (if (stringp po-team-name-to-code)
          (setq team po-team-name-to-code)