Commit 71c96115 authored by Steve McIntyre's avatar Steve McIntyre

Deal with translated pages including headers/footers/navbars etc.

If any of the included files use wml::debian::translation-check with a
version, that over-rides the version defined in the start file and
this can totally break the translation checks. The check is then made
against the start file, but using the version defined in the included
file. :-(

Fix things up to allow for this *and* check the versions of both the
start file *and* the included file:

 * Add a sym-link of translation-check.wml as
   "translation-check-inc.wml" to defeat wml's tracking of what files
   have been #use'd already. Otherwise we'll only check the included
   file and never check the start file.
 * Switch all the .inc files to use the new translation-check-inc.wml
   instead of translation-check.wml
 * Also add an extra argument "force_file" to allow the included files
   to declare their filename so *that* is checked instead of the start
   file

Quite involved, but it works...
parent 24a8bbc5
#use wml::debian::translation-check translation="7d6a152a603ed4837e979269b73d047605208359"
#use wml::debian::translation-check-inc translation="7d6a152a603ed4837e979269b73d047605208359" force_file="Bugs/footer.inc"
<hrline/>
<address>
......
#use wml::debian::language_names
#use wml::debian::common_tags
#use wml::debian::translation-check translation="6c09c87719ede90b6ec0d2e2480b1f57a54eb8f8"
#use wml::debian::translation-check-inc translation="6c09c87719ede90b6ec0d2e2480b1f57a54eb8f8" force_file="Bugs/pkgreport-opts.inc"
<bind-gettext-domain domain="bugs" />
......
#use wml::debian::language_names
#use wml::debian::common_tags
#use wml::debian::translation-check translation="a1e8656d43afe0da1fe31c91bbecc3ce19cd9da3"
#use wml::debian::translation-check-inc translation="a1e8656d43afe0da1fe31c91bbecc3ce19cd9da3" force_file="distrib/search_contents-form.inc"
<bind-gettext-domain domain="distrib" />
......
#use wml::debian::language_names
#use wml::debian::common_tags
#use wml::debian::translation-check translation="c9572f22f4a5fc60f741c1ce9d1f15161bcde1ea"
#use wml::debian::translation-check-inc translation="c9572f22f4a5fc60f741c1ce9d1f15161bcde1ea" force_file="distrib/search_packages-form.inc"
<bind-gettext-domain domain="distrib" />
......
#use wml::debian::translation-check translation="fce042d9dcdefa00f89c0eafd4e31a5a2d7ef7db"
#use wml::debian::translation-check-inc translation="fce042d9dcdefa00f89c0eafd4e31a5a2d7ef7db" force_file="Bugs/otherpages.inc"
<p>Druge BTS stranice:
......
#use wml::debian::blends::gis
#use wml::debian::translation-check translation="ff9649c8aa2e1aa09d934c939de35d1476aabd4a"
#use wml::debian::translation-check-inc translation="ff9649c8aa2e1aa09d934c939de35d1476aabd4a" force_file="blends/gis/navbar.inc"
{#alternate_navbar#:
<div id="second-nav">
......
#use wml::debian::blends::hamradio
#use wml::debian::translation-check translation="6e56b4e2dbb6e975651897056c57191cdc6f00b4"
#use wml::debian::translation-check-inc translation="6e56b4e2dbb6e975651897056c57191cdc6f00b4" force_file="blends/hamradio/navbar.inc"
{#alternate_navbar#:
<div id="second-nav">
......
translation-check.wml
\ No newline at end of file
......@@ -5,10 +5,10 @@
# This file is used to track when translations go out-of-date, and it is
# used by including this in the head of the translated file:
#
# #use wml::debian::translation-check translation="X.xx"
# #use wml::debian::translation-check translation="XXXXXXXXXXXXXXXXXX"
#
# where X.xx is the current GIT revision number of the file you have
# translated.
# where XXXXXXXXXXXXXXXXXX is the current git revision of the file you
# have translated.
#
# There are also some additional parameters that you can use on the #use
# line:
......@@ -19,13 +19,13 @@
# to the name in languages.wml
#
# mindelta="number"
# which defines the maximum difference in GIT revisions before the
# which defines the maximum difference in git revisions before the
# translation is considered aged. The default value is 1. For less important
# pages, set it to 2, which means that not every change is considered making
# the translation aged. The value for the <aged/> tag is displayed.
#
# maxdelta="number"
# which defines the maximum difference in GIT revisions before the
# which defines the maximum difference in git revisions before the
# translation is considered to be outdated (and the value of the <outdated/>
# tag is displayed). The default value is 5. For very important pages, set
# it to be less. A value of 1 means that every change is considered making
......@@ -72,7 +72,7 @@ use Local::VCS ':all';
sub check_translation {
# Input parameters:
my ($translation, $file, $original, $mindelta, $maxdelta) = @_;
my ($translation, $file, $original, $mindelta, $maxdelta, $force_file) = @_;
my $parents, $level, $relative_dir, $output;
my @relative_dir = ();
......@@ -86,7 +86,7 @@ sub check_translation {
$min_versions = $mindelta || 1;
# Set this to >= 1 to get debugging output.
# Remember, if you checkin to GIT this needs to be set to 0!
# Remember, if you commit to git this needs to be set to 0!
$debug = 0;
# This is the language code of the original (to make a link)
......@@ -111,8 +111,18 @@ sub check_translation {
pop @relative_dir;
@relative_dir = reverse @relative_dir;
$relative_dir = join '/', @relative_dir;
my $orig_file = "$parents/$original_dir/$relative_dir/$file";
my $orig_file = "$parents/$original_dir/$relative_dir/$file";
if (defined $force_file && length($force_file) > 1) {
if ($debug) {
print "Ignoring $file, forcing to $force_file instead\n";
print "original $orig_file\n";
}
$orig_file = "$parents/$original_dir/$force_file";
if ($debug) {
print "now $orig_file\n";
}
}
my $VCS = Local::VCS->new();
my %file_info = $VCS->file_info($orig_file);
$version = $file_info{'cmt_rev'};
......@@ -157,7 +167,7 @@ sub check_translation {
# The call to the subroutine is done here
{#check_trans#:\
<: check_translation ("$(translation)","$WML_SRC_FILENAME","$(original)","$(mindelta)","$(maxdelta)") :>\
<: check_translation ("$(translation)","$WML_SRC_FILENAME","$(original)","$(mindelta)","$(maxdelta)","$(force_file)") :>\
:#check_trans#}
# This template was originally made by Javier Fernández-Sanguino, described
......
#use wml::debian::translation-check translation="c57eea2e295b4c8e57b0998c9edc22613239fa0f"
#use wml::debian::translation-check-inc translation="c57eea2e295b4c8e57b0998c9edc22613239fa0f" force_file="Bugs/otherpages.inc"
<p>További oldalak:</p>
<ul>
......
#use wml::debian::blends::gis
#use wml::debian::translation-check translation="ff9649c8aa2e1aa09d934c939de35d1476aabd4a" maintainer="Ana Custura"
#use wml::debian::translation-check-inc translation="ff9649c8aa2e1aa09d934c939de35d1476aabd4a" maintainer="Ana Custura" force_file="blends/gis/navbar.inc"
{#alternate_navbar#:
<div id="second-nav">
<p><a href="$(HOME)/blends/gis/">Debian&nbsp;GIS&nbsp;Blend</a></p>
......@@ -23,3 +23,4 @@
</ul>
</div>
:#alternate_navbar#}
#use wml::debian::blends::hamradio
#use wml::debian::translation-check translation="6e56b4e2dbb6e975651897056c57191cdc6f00b4" maintainer="Ana Custura"
#use wml::debian::translation-check-inc translation="6e56b4e2dbb6e975651897056c57191cdc6f00b4" maintainer="Ana Custura" force_file="blends/hamradio/navbar.inc"
{#alternate_navbar#:
<div id="second-nav">
<p><a href="$(HOME)/blends/hamradio/">Debian&nbsp;Hamradio&nbsp;Blend</a></p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment