trans-coord-devel
[Top][All Lists]
Advanced

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

Re: Error handling


From: Yavor Doganov
Subject: Re: Error handling
Date: Wed, 12 Mar 2008 17:25:16 +0200

On ср, 2008-03-05 at 19:24 +0200, Yavor Doganov wrote:
> > Hm, I see your point but the solution is not so obvious to me.  No doubt
> > that a PO-file may be changed manually by a human, but also it can be
> > changed automatically by the update rules.  So why not run check-po on
> > both cases?
> 
> There are two cases when it can become invalid after mechanical
> intervention:
> 
> 1) A bug in po4a which leads to invalid .pot.  We are in deep trouble
> here, and msgmerge will fail so we will see what happened.
> 
> 2) A bug in msgmerge that makes the .po invalid after merging from a
> valid .pot.  I'm pretty sure the gettext maintainer will never release
> such a buggy version :-)

Actually you are right.  Here are the three valid scenarios where we
want errors to be reported to the translators:

     1. A translator commits a new PO file.  With the current code,
        po4a-translate will barf so the translator won't be informed.
     2. A translator modifies an existing PO file.  Likewise, msgmerge
        is not invoked, and the error comes from po4a-translate.
     3. A PO file is already invalid, but the translator doesn't fix it
        before the next run.  BUT a webmaster modifies the original
        article.html, so the corresponding POT gets rebuilt first, and
        msgmerge is run -- the current $(check-po) invocations serve
        their purpose.

The proposed patch takes care with all of this, and I think we're done
with this task.
--- GNUmakefile 12 мар 2008 16:34:27 +0200      1.14
+++ GNUmakefile 12 мар 2008 17:15:50 +0200      
@@ -139,8 +139,8 @@
 # The command to check the validity of a PO file.
 define check-po
 ./mailfail $(NOTIFYSKIP) $(transl_addr) \
-  "[GNUN Error] $$(subst $$(rootdir)/,,$$@) is not a valid PO file" \
-  $(VALIDATESKIP) $(MSGFMT) --check --verbose --output-file=/dev/null $$@
+  "[GNUN Error] $$$${PO#../../} is not a valid PO file" \
+  $(VALIDATESKIP) $(MSGFMT) --check --verbose --output-file=/dev/null $$$$PO
 endef
 
 # The command to mail errors from make-prototype.
@@ -185,12 +185,13 @@
 # it is OK to ignore errors from these, at least until fencepost has
 # an old version of gettext.  The XHTML validation errors should be
 # clear even if the bug is in the server templates translations.
-       -$(check-po)
+       -PO=$$@ ; $(check-po)
        @echo Updating PO file...
        $(MSGMERGE) --update $$@ $$< && touch $$@
 
 $(template_dir)/%.$(1).html: $(template_dir)/%.html 
$(template_dir)/po/%.$(1).po
        $$(addfile)
+       PO=$(template_dir)/po/$$(*F).$(1).po ; $(check-po)
        @echo Generating the translated article...
        $(PO4A-TRANSLATE) $(PO4A_XHTMLFLAGS) $(PO4A-TRANSLATEFLAGS) --master 
$$< --po \
                $(template_dir)/po/$$(*F).$(1).po --localized $$@
@@ -220,11 +221,13 @@
 
 define home_rules
 $(rootdir)/po/home.$(1).po: $(rootdir)/po/home.pot
-       $(check-po)
+       PO=$$@ ; $(check-po)
        $(MSGMERGE) --update $$@ $$<
        touch $$@
 
-$(rootdir)/home.$(1).shtml: $(rootdir)/po/home.proto 
$(rootdir)/po/home.$(1).po generic.$(1).html
+$(rootdir)/home.$(1).shtml: $(rootdir)/po/home.proto \
+                           $(rootdir)/po/home.$(1).po generic.$(1).html
+       PO=$(rootdir)/po/home.$(1).po ; $(check-po)
        $$(addfile)
        $(PO4A-TRANSLATE) $(PO4A_XHTMLFLAGS) $(PO4A-TRANSLATEFLAGS) --master 
$$< --po $(rootdir)/po/home.$(1).po --localized $(rootdir)/po/home.$(1).m4
        $(SED) --in-place 
"s/\(<gnun>include(\`.*\)\([.]html')<\/gnun>\)/\1.$(1)\2/g" 
$(rootdir)/po/home.$(1).m4
@@ -274,12 +277,14 @@
 
 define article_rules
 $(1).po: $(basename $(1)).pot
-       $(check-po)
+       PO=$$@ ; $(check-po)
        $(MSGMERGE) --update $$@ $$<
        touch $$@
 
-$(subst /po/,/,$(1).html): $(basename $(1)).proto $(basename $(1)).translinks 
$(1).po generic.$(2).html
+$(subst /po/,/,$(1).html): $(basename $(1)).proto $(basename $(1)).translinks \
+                          $(1).po generic.$(2).html
        $$(addfile)
+       PO=$(1).po ; $(check-po)
        $(PO4A-TRANSLATE) $(PO4A_XHTMLFLAGS) $(PO4A-TRANSLATEFLAGS) --master 
$$< --po $(1).po --localized $(1).m4
        $(SED) --in-place 
"s/\(<gnun>include(\`.*\)\([.]html')<\/gnun>\)/\1.$(2)\2/g" $(1).m4
        $(SED) --in-place "s/<gnun>\(.*\)<\/gnun>/\1/g" $(1).m4

reply via email to

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