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

About english/template/debian/countries*.wml



Hi,

country translations are currently put into 2 different files, named
countries.wml and countries_perl.wml.  It would be nice to only have a
single file.
Here is a solution by generating countries.def (which supersedes
countries.wml) from countries_perl.wml, by running
     eperl -B '<:' -E ':>' countries_perl.wml
I suggest to rename countries_perl.wml into countries.wml, and add a
rule in some Makefile to make sure countries.def is regenerated when
countries.wml is updated.

Denis
Index: countries_perl.wml
===================================================================
RCS file: /cvs/webwml/webwml/english/template/debian/countries_perl.wml,v
retrieving revision 1.3
diff -u -r1.3 countries_perl.wml
--- countries_perl.wml	2001/07/23 23:25:11	1.3
+++ countries_perl.wml	2001/07/26 23:21:49
@@ -1,6 +1,8 @@
 # Format of this file
 # ('COUNTRY' => {'lang' => 'name for country in lang', ...
 
+#use def::debian::countries
+
 <:
 my %countries =
   ('AR' => {'EN' => 'Argentina',
@@ -1351,4 +1353,20 @@
 	    'ZH' => '«n«D',
            },
   );
+
+#     These lines generate the countries.def file, only when this file
+#     is processed through
+#          eperl -B '<:' -E ':>' countries_perl.wml
+#     WML will skip this block
+if ('$(DUMMY_VAR_DO_NOT_REMOVE)' ne '') {
+    open(GEN, "> countries.def");
+    print GEN "#   File generated automatically.  Do not edit!\n";
+    foreach my $c (keys %countries) {
+        print GEN "<"."define-tag ".$c."c endtag=delete>\n";
+        foreach my $t (keys %{$countries{$c}}) {
+            print GEN "    [".$t.":".$countries{$c}{$t}.":]\n";
+        }
+        print GEN "<"."/define-tag>\n";
+    }
+}
 :>

Reply to: