[Top][All Lists]

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

Marking translations outdated

From: Ineiev
Subject: Marking translations outdated
Date: Sun, 16 Jan 2011 09:30:42 +0000
User-agent: Thunderbird (X11/20080501)


These are suggestions on how to mark the existing translations
outdated. it is a precondition for making automatically honor
the user language preferences, which is a hypothetical way
to make localized images possible.

When the translation HTML file is present, there can be four cases:

(0) POT and PO are present
(1) POT but no PO is present
(2) PO but no POT is present
(3) POT and PO are absent

(0) POT and PO are present

The outdated translations are tracked via msgfmt --statistics;
a note can be added to the HTML files after /server/banner.$lang.html
this way:

--- GNUmakefile.orig    2011-01-16 08:23:21.727324144 +0000
+++ GNUmakefile 2011-01-16 08:47:11.699074394 +0000
@@ -89,5 +89,6 @@
                  body-include-1 \
                  body-include-2 \
-                 footer-text
+                 footer-text \
+                 outdated
 template-translated-base := $(addprefix $(template-dir)/,$(template-files))
 template-pots := $(addsuffix .pot, \
@@ -176,5 +177,9 @@
 define generate-html
-  --master $$< --po $$$$PO --localized $$$$OUT
+  --master $$< --po $$$$PO --localized $$$$OUT; \
+  $(MSGFMT) --statistics -o /dev/null $$$$PO  2>&1 \
+           | $(EGREP) '(fuzzy|untranslated)' > /dev/null \
+           && $(SED) --in-place \
+ "/^<!--#include virtual=\"\/server\/banner/s%^\(.*\)$$$$%\1\n<!--#include virtual=\"/server/outdated.$$$$LANG_CODE.html\" -->%" $$$$OUT;

@@ -288,5 +293,6 @@
          || (touch $$$$PO ; exit 1)
-       PO=$(template-dir)/po/$$(*F).$(1).po OUT=$$@ ; $(generate-html)
+       PO=$(template-dir)/po/$$(*F).$(1).po OUT=$$@ LANG_CODE=$(1) ; \
+         $(generate-html)
        $(SED) --in-place \
          ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' $$@
@@ -445,6 +451,6 @@
-       PO=$(rootdir)/po/home.$(1).po OUT=$(rootdir)/po/home.$(1).m4 ; \
-         $(generate-html)
+       PO=$(rootdir)/po/home.$(1).po OUT=$(rootdir)/po/home.$(1).m4 \
+         LANG_CODE=$(1) ; $(generate-html)
        $(SED) --in-place \
          "s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(1)\2/g" \
@@ -527,5 +533,5 @@
 # is no real need to determine them and run the command conditionally.
-       PO=$(1).po OUT=$(1).m4 ; $(generate-html)
+       PO=$(1).po OUT=$(1).m4 LANG_CODE=$(2) ; $(generate-html)
        $(SED) --in-place \
          "s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(2)\2/g" $(1).m4

Where /server/outdated.html might look like
<!-- begin server/outdated.html -->
<div class="outdated-notice">
  <p>Attention! This translation is likely to be out-of-date.</p>
<!-- end server/outdated.html -->

The missing bits are the definition of outdated-notice class in some CSS
and translations for server/outdated.html; the translations need not to be added
immediately, though: when there is no translation, GNUN will put
the English text.

(1) POT but no PO is present

Most probably all such translations should be marked outdated this way:

#! /bin/bash
# marks unGNUNified translatios outdated;
# to be invoked from top directory of a working copy of web pages

mark-outdated () {

  if grep "<\(body\)\|\(BODY\).*>" $1 >/dev/null; then
    echo sedding BODY $1..
    sed -i "/\(<body\)\|\(<BODY\).*>/"\
"s%^\(.*\)$%\1\n<!--#include virtual=\"/server/outdated.$2.html\" -->%" $1;
    if grep "^ *<!--#include virtual=\"/server/banner" $1 >/dev/null; then
      echo sedding banner $1..
      sed -i "/^<!--#include virtual=\"\/server\/banner/"\
"s%^\(.*\)$%\1\n<!--#include virtual=\"/server/outdated.$2.html\" -->%" $1;

check-pot-file () {

  echo POT: $1
  ls $(echo $1 | sed "s%/po/\(.*\).pot%/\1.%")* \
    | grep "\.\(..\)\(-..\)\?\.s\?html$" | while read trans_file;
        lang_suffix=$(echo $trans_file \
                        | sed "s/.*\.\(..\)\(-..\)\?\.s\?html$/\1\2/")
        po_file=$(echo $1 | sed "s/pot$/${lang_suffix}.po/")
        if test ! -f $po_file; then
          mark-outdated $trans_file $lang_suffix

shopt -s extglob

#fix fancy line endings
sed -i "/<body/{N;s/\r \n//};s/\r\+/\n/g" philosophy/

  find . -name '*.pot' | grep -v "\./server/";
  echo server/po/08whatsnew.pot;
  echo server/po/irc-rules.pot;
  echo server/po/mirror.pot;
  echo server/po/sitemap.pot;
  echo server/po/takeaction.pot;
  echo server/po/tasks.pot;
  echo server/standards/po/README.translations.pot;
  echo server/standards/po/webmaster-quiz.pot;
) | while read i; do check-pot-file $i; done
#end of script

It will change about 800 files.

There are some unGNUNified translations that have been modified since the latest
change in the original article.

Some of them are really outdated and I think the right way to fix it is to
GNUNify them first; other are essentially up-to-date, but this won't be the
case after the next modification of the original article, so I think it will
be acceptable to mark them outdated.

The file is outdated e.g. because of broken links to /encyclopedia/announcement*

No list of links to translations.

date: 2010-12-27 16:33:17 +0000;  author: jsowoc;  state: Exp;  lines: +6 -6;  
commitid: TP520LNncjPViW1v;
fix a handful of broken links
date: 2007-06-28 20:04:37 +0000;  author: johnsu01;  state: Exp;  commitid: 

There were some changes since 2007-06-28
 ("Clarify source requirements when distributing object code over anon FTP").

 licenses/ licenses/why-assign.ja.html 
 licenses/ licenses/
Probably the translations are up-to-date since the article text has never
essentially changed (they may need reformatting, though).

date: 2010-12-27 16:33:22 +0000;  author: jsowoc;  state: Exp;  lines: +4 -4;  
commitid: TP520LNncjPViW1v;
fix a handful of broken links
date: 2008-04-26 09:28:59 +0000;  author: yavor;  state: Exp;  lines: +1 -1;  
commitid: UzfJ4AgBcXAdiB0t;

Out-of-date since philosophy/motif.html has changed
(2010-02-18: Delete one of the objections, because the Motif FAQ says an 

 philosophy/ philosophy/
Actually up-to-date.

(2) PO but no POT is present

Most probably this mean that the article was deleted or moved,
so the PO should be deleted or moved (after adjusting the header).

Currently there are no such cases.

(3) POT and PO are absent

Next time when the article changes, it should be GNUNified,
and all its translations should be marked outdated manually.

For translations of non-HTML entities the procedure has to be different.

reply via email to

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