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

Re: translation-check.wml



Now I have written the perl script. It turned out a little longer than I
suspected it would be, because it has to take care of a certain situation,
when the build never occurs at the time, when the translation is "properly"
outdated.

In order for it to run properly, the following changes should be made:

1).
--- Makefile	2000/07/12 23:18:56	1.19
+++ Makefile	2000/09/27 12:20:03
@@ -1,6 +1,6 @@
 # Top-level Makefile for the Debian Web pages
 
-LANGUAGES := arabic chinese croatian danish dutch english esperanto finnish \
+LANGUAGES := english arabic chinese croatian danish dutch esperanto finnish \
              french german hungarian italian japanese korean norwegian \
              polish portuguese romanian russian spanish swedish turkish
 LANGUAGES-install := $(addsuffix -install,${LANGUAGES})

 - because build in english directory touches translations, it should be
   moved to the beginning of the build process

2).
--- Makefile.common	2000/09/11 19:11:54	1.10
+++ Makefile.common	2000/09/27 12:20:38
@@ -17,7 +17,8 @@
 ENGLISHSRCDIR = $(WMLBASE)/../english
 endif
 
-ENGLISHDIR := $(ENGLISHSRCDIR) # this is just an alias
+ENGLISHDIR := $(ENGLISHSRCDIR)
+# this ^ is just an alias
 HTMLDIR = $(WMLBASE)/$(RELHTMLBASE)/$(CUR_DIR)
 TEMPLDIR = $(WMLBASE)/$(RELTEMPLDIR)
 
@@ -115,6 +116,9 @@
 %.$(LANGUAGE).html : %.wml $(TEMPLDIR)/template.wml $(TEMPLDIR)/languages.wml \
 		$(HTMLDEP)
 	$(WML) $(<F)
+ifeq "$(LANGUAGE)" "en"
+	$(WMLBASE)/../touch_translations.pl $(CURDIR)/$(<F)
+endif
 endif
 endif
 
3).
--- english/template/debian/translation-check.wml	2000/08/29 16:39:57	1.4
+++ english/template/debian/translation-check.wml	2000/09/27 12:21:14
@@ -1,4 +1,8 @@
 #use wml::std::tags
+#use wml::debian::translation-check-definitions
+
+# Translators: please do not modify this file, instead look at
+# "translation-check-definitions.wml"
 # EXAMPLE CODE (file translation-check.wml called as
 # #use wml::debian::translation-check translation="1.1")
 
@@ -16,16 +20,18 @@
 
 # This is the maximum difference between a translated
 # document and the original before printing the warning
-$max_versions = 5;
+
+@max_versions = (5, 10, 15);
 
 # Turn this to '1' to set debugging ouput
-# ĄOnly do this if you know what you are doing!
+# only do this if you know what you are doing!
 # If you checkin to CVS this should be set to 0
 $debug = 0;
 
-# This is the directory where the original source is kept
-# maybe it could be a parameter, since sometimes the original
-# language is NOT english
+# This is the directory where the original source is kept. Even if the
+# language you are translating from is not English, you should put the
+# revision of the English file in your #use wml::debian::translation-check
+# line
 $original_dir = "../english";
 # TODO: Should do error checking here if file does not exist...
 open (MAKE,"<Makefile");
@@ -85,11 +91,12 @@
 # TODO: check also major numbers
 print "Comparing minor $last_number to minor $last_translated_number\n" if $debug;
 
-if ( $last_number - $last_translated_number > $max_versions ) 
-{
-# TODO:This should be printed using slices in order to tell the
-# user in his language
-        print "<B>Warning!: This translations is too out of date</B><BR>";
+if ( ($last_number - $last_translated_number) >= $max_versions[2] ) {
+        print "<translation-warning3>";
+} elsif (($last_number - $last_translated_number) >= $max_versions[1]) {
+	print "<translation-warning2>";
+} elsif (($last_number - $last_translated_number) >= $max_versions[0]) {
+	print "<translation-warning1>";
 }
 close CVS_ENTRY;
 }

4). this contains slices for all languages

# Translators: Please add a slice for your language to each of these warnings.
# The first will be shown, when the translation is 5 revisions old, the
# second, when it is 10 revisions old, and the last, when it is 15 revisions
# old. (The exact numbers may be changed, but you get the idea.)

<define-tag translation-warning1>
[EN:<p>This translation of this page is a little outdated. You may consider looking at the original.<br>:]
[IT:<p>This translation of this page is a little outdated. You may consider looking at the original.<br>:]
[...truncated..]

5). check in the script (see attachment)

6). all translators should add the #use wml::debian::translation-check
translation="X.xx" tag to their files.

Please comment on this.

regards
Marcin

PS: I tested this for whole webwml tree, everything seems to work fine.

-- 
+--------------------------------+ The reason we come up with new versions
|Marcin Owsiany                  | is not to fix bugs. It's the stupidest
|porridge@pandora.info.bielsko.pl| reason to buy a new version
+--------------------------------+ I ever heard.            - Bill Gates

Attachment: touch_translations.pl
Description: Perl program


Reply to: