[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Marking translations outdated
From: |
Ineiev |
Subject: |
Re: Marking translations outdated |
Date: |
Fri, 26 Aug 2011 13:28:39 +0400 |
User-agent: |
Thunderbird 2.0.0.24 (X11/20100623) |
On 01/17/2011 10:51 PM, Ineiev wrote:
Generally, are there any better ideas than inserting
<!--#include virtual="/server/outdated.$lang.html" -->
after
<!--#include virtual="/server/banner.$lang.html" -->
?
Next revision (/server/outdated.html is to contain
<div id="outdated">
<p>
<strong>Warning:</strong> this translation may be out of date.
Please send updates to
<a href="mailto:address@hidden"><address@hidden></a>.
The URL for the latest translation source is:
</p>
<p><!--#echo encoding="none" var="PO_FILE" --></p>
</div>
I had to put the #echo directive into a separate paragraph because
PO4A would move all comments to the beginning of the block and there
is no other simple way to control its position in the translation):
--- src/server/gnun/GNUmakefile 2011-08-26 13:12:09.000000000 +0400
+++ ./GNUmakefile 2011-08-26 13:13:10.000000000 +0400
@@ -84,5 +84,6 @@
body-include-1 \
body-include-2 \
- footer-text
+ footer-text \
+ outdated
template-translated-base := $(addprefix $(template-dir)/,$(template-files))
template-pots := $(addsuffix .pot, \
@@ -174,4 +175,18 @@
endef
+# Add notice about the translation being out of date
+define mark-outdated
+ $(MSGFMT) --statistics -o /dev/null $$$$PO 2>&1 \
+ | ($(EGREP) '(fuzzy|untranslated)' > /dev/null \
+ && $(SED) --in-place \
+ "/^<!--#set var=\"PO_FILE\"/,+3d;\
+/^<!--#include virtual=\"\/server\/banner/a\
+<!--#set var=\"PO_FILE\"\n \
+ value='<a href=\"http://www.gnu.org$$$${PO#$(rootdir)}\">\n\
+ http://www.gnu.org$$$${PO#$(rootdir)}</a>' -->\n\
+<!--#include virtual=\"/server/outdated.$(2).html\" -->" $(1); \
+ ) || true
+endef
+
# The command to check the validity of a PO file.
define check-po
@@ -511,4 +526,5 @@
$(rootdir)/po/home.$(1).m4
$(M4) $(rootdir)/po/home.$(1).m4 > $$@
+ PO=$(rootdir)/po/home.$(1).po; $(call mark-outdated,$$@,$(1))
$(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl-addr) \
$$@ || (PO=$(rootdir)/po/home.$(1).po ; $$(touch-hook))
@@ -539,4 +555,11 @@
endef
+# Produce article HTML file, announce and validate it if needed
+define output-article-html
+$(M4) $(1).m4 > $$@ \
+$(if $(findstring $(basename $(1)),$(no-validate-articles)), , \
+ && $(announce) && $(validate-article))
+endef
+
define article-rules
$(1).po: $(basename $(1)).pot
@@ -602,9 +625,5 @@
# builds, update the target and validate the result.
ifndef GRACE
- $(M4) $(1).m4 > $$@
-# Skip HTML validation if the article is in `no-validate-articles'.
-ifneq ($(basename $(1)), $(findstring $(basename
$(1)),$(no-validate-articles)))
- $(announce); $(validate-article)
-endif
+ $(output-article-html);
# Check if the article is not in `no-grace-articles'.
else ifneq ($(basename $(1)), \
@@ -617,8 +636,7 @@
# $(addfile) -- GRACE is ignored in this case to avoid committing
# empty files to the repository.
-ifneq ($(basename $(1)), $(findstring $(basename
$(1)),$(no-validate-articles)))
if ! $(GREP) --quiet "^#, fuzzy" $(1).po || ! test -s $$@; \
then \
- ($(M4) $(1).m4 > $$@; $(announce); $(validate-article)); \
+ $(output-article-html); \
else \
if [ "`date --date="$(GRACE) days ago" +%Y%m%d`" -ge \
@@ -626,5 +644,5 @@
$(1).po`" ]; \
then \
- $(M4) $(1).m4 > $$@ && $(announce) && $(validate-article); \
+ $(output-article-html); \
else \
sleep 1; touch $(1).po; \
@@ -632,19 +650,8 @@
fi
else
- if ! $(GREP) --quiet "^#, fuzzy" $(1).po || ! test -s $$@; \
- then $(M4) $(1).m4 > $$@; else \
- if [ "`date --date="$(GRACE) days ago" +%Y%m%d`" -ge \
- "`$(AWK) '/POT-Creation-Date/ { gsub(/-/, ""); print $$$$2 }' \
- $(1).po`" ]; \
- then $(M4) $(1).m4 > $$@; \
- else sleep 1; touch $(1).po; fi; fi
-endif
-else
@echo 'Ignoring grace period for article "$(notdir $(basename $(1)))"'
- $(M4) $(1).m4 > $$@
-ifneq ($(basename $(1)), $(findstring $(basename
$(1)),$(no-validate-articles)))
- $(announce); $(validate-article)
-endif
+ $(output-article-html);
endif
+ PO=$(1).po; $(call mark-outdated,$$@,$(2))
endef
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Marking translations outdated,
Ineiev <=