#!/usr/bin/perl

use Locale::gettext;
use POSIX;

my $version = "2007";

setlocale(LC_MESSAGES, "");
bindtextdomain("CD_README","./tmp/");
textdomain("CD_README");

sub N {
	my $s = shift @_; my $t = gettext($s);
	sprintf $t, @_;
}

my $lang=$ENV{LANGUAGE};
my $html_lang="$lang";
my $dir="ltr";
my $left="left";
my $right="right";

if ( $lang =~ /ar|fa|he|ug|ur|yi/) { $dir="rtl"; $left="right"; $right="left" };
if ( $lang =~ /zh_CN/ ) { $html_lang = "zh-CN"; };
if ( $lang =~ /zh_TW/ ) { $html_lang = "zh-TW"; };
if ( $lang =~ /pt_BR/ ) { $html_lang = "pt-BR"; };
if ( $lang =~ /sr\@Latn/ ) { $html_lang = "sr"; };
if ( $lang =~ /uz\@Latn/ ) { $html_lang = "uz"; };
if ( $lang eq "C" )     { $lang = "en" ; $html_lang = "en"; };

my $google_lang="$html_lang";
if ( $html_lang =~ /nb/ ) { $google_lang = "no"; };
if ( $html_lang =~ /pa_IN/ ) { $google_lang = "pa"; };
if ( $html_lang =~ /sc/ ) { $google_lang = "it"; };















# langs for which we have pages
my $our_lang="en";
if ( $lang =~ /de/ ) { $our_lang = "de"; };
if ( $lang =~ /es/ ) { $our_lang = "es"; };
if ( $lang =~ /fi/ ) { $our_lang = "fi"; };
if ( $lang =~ /fr/ ) { $our_lang = "fr"; };
if ( $lang =~ /he/ ) { $our_lang = "he"; };
if ( $lang =~ /hi/ ) { $our_lang = "hi"; };
if ( $lang =~ /it/ ) { $our_lang = "it"; };
if ( $lang =~ /ja/ ) { $our_lang = "ja"; };
if ( $lang =~ /nl/ ) { $our_lang = "nl"; };
if ( $lang =~ /pl/ ) { $our_lang = "pl"; };
if ( $lang =~ /pt/ ) { $our_lang = "pt"; };
if ( $lang =~ /pt_BR/ ) { $our_lang = "pt-BR"; };
if ( $lang =~ /ru/ ) { $our_lang = "ru"; };
#if ( $lang =~ /sv/ ) { $our_lang = "sv"; }; seems only homepage exists
if ( $lang =~ /zh_CN/ ) { $our_lang = "zh"; };

open (INSTALL_HTML, ">tmp/install-$lang.htm") || die("can't open tmp/install-$lang.htm");
print INSTALL_HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 TRANSITIONAL//EN\"\n                      \"http://www.w3.org/TR/html4/loose.dtd\">\n";
print INSTALL_HTML "<html lang=\"$html_lang\" dir=\"$dir\">\n";
print INSTALL_HTML "<head>\n";
print INSTALL_HTML "   <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
print INSTALL_HTML "   <meta http-equiv=\"Content-Language\" content=\"text/html; language=$lang\">\n";
print INSTALL_HTML "   <title>" . N("Installation Instructions - Mandriva Linux %s",$version) . "</title>\n";
print INSTALL_HTML <<'EOF'
   <style type="text/css"><!--
     a:link       { color:            #666699;     }
     a:active     { color:            #FF0000;     }
     a:visited    { color:            #980060;     }
     body         { background-color: #FFFFFF;     }
     ol.withroman { list-style-type:  lower-roman; }
     ol.withalpha { list-style-type:  lower-alpha; }
    --></style>
</head>
<body bgcolor="#FFFFFF" link="#666699" alink="#FF0000" vlink="#980060">
<a name="top"></a>
EOF
;
#if ( $dir =~ /rtl/ ) { print INSTALL_HTML "<font dir=\"rtl\">\n\n" };
print INSTALL_HTML "<p align=\"center\">\n";
print INSTALL_HTML "<center><h1><img\n";
print INSTALL_HTML "  src=\"../images/LMDK.jpg\" alt=\"Mandriva Linux\"\n";
print INSTALL_HTML "  border=\"0\"></h1></center>\n";
print INSTALL_HTML "<p align=\"center\">\n";
print INSTALL_HTML "<center><h2>" . N("Installation Instructions") .  "</h2></center>\n";
print INSTALL_HTML "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "  <u>" . N("Required configuration") . "</u>\n";
print INSTALL_HTML "  <ul>\n";
print INSTALL_HTML "  <li>" . N("Pentium processor or compatible") . "</li>\n";
print INSTALL_HTML "  <li>" . N("CDROM drive") . "</li>\n";
print INSTALL_HTML "  <li>" . N("At least 32 MB RAM, 64 MB recommended") . "</li>\n";
print INSTALL_HTML "  </ul>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . 
# the "%s" placeholder is "point 1" or "point 2", etc.
N("Installing Mandriva Linux is, in most cases, as simple as putting
   your Installation CD in your CDROM drive, and restarting your
   machine. Please refer to %s.", 
   "<a href=\"#cd\">" . N("point 1") . "</a>") . "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   <b>" . N("NOTE:") . "</b>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   <ul>\n";
print INSTALL_HTML "   <li>" .
N("If you upgrade from 7.x, 8.x or 9.x Mandriva Linux versions,
      do not forget to backup your system.") . "</li>\n";
print INSTALL_HTML "   <li>" . 
N("Upgrading from earlier versions (prior to 7.0) is <b>NOT
      supported</b>. In that case, you need to do a <b>fresh
      installation</b> and not an update.") . "</li>\n";
print INSTALL_HTML "   </ul>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <hr width=\"100%\">\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . N("Below are listed the different ways to install Mandriva Linux:") . "<p>\n";
print INSTALL_HTML "   <ol>\n";
print INSTALL_HTML "   <li><a href=\"#cd\"     >" .
N("Boot directly from CD") . "</a></li>\n";
print INSTALL_HTML "   <li><a href=\"#floppy\" >" .
N("Make a boot floppy with Windows") . "</a></li>\n";
print INSTALL_HTML "   <li><a href=\"#other\"  >" .
N("Other installation methods") . "</a></li>\n";
print INSTALL_HTML "   </ol>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <a name=\"cd\"></a><hr width=\"100%\">\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "  <h3>" . N("1. %s", N("Boot directly from CD")) . "</h3>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . 
N("The Installation CDROM is bootable. In most cases, just insert the CD
   into the drive and reboot the machine. Follow the instructions
   displayed on screen: press the <b>[Enter]</b> key to start the
   installation, or press <b>[F1]</b> for additional help.") . "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   <b>" . N("NOTE:") . "</b>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . 
# the "%s" placeholder is "point 1" or "point 2", etc.
N("On some laptops (portable computers), the system may not be
   able to boot from the CD. In such a case, you should prepare a
   boot floppy. See %s for details.",
   "<a href=\"#floppy\">" . N("point 2") . "</a>") . "\n";
print INSTALL_HTML "<p align=\"$right\">\n";
print INSTALL_HTML "  <a href=\"#top\">[" . N("top of this page") . "]</a>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <a name=\"floppy\"></a><hr width=\"100%\">\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "  <h3>" . N("2. %s", N("Make a boot floppy with Windows")) . "</h3>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . 
N("If your computer cannot boot from the CDROM, you must make a
   boot floppy under Windows as follows:") . "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   <ul>\n";
print INSTALL_HTML "   <li>" . 
N("insert the CDROM, then open the icon
      <i>&quot;My Computer&quot;</i>, right click on the CDROM drive
      icon and select <i>&quot;Open&quot;</i>") . "</li>\n";
print INSTALL_HTML "   <li>" . 
# the "%s" placeholders are for program names ("dosutils" for the first,
# and "rawwritewin" for the second
N("go into the <i>&quot;%s&quot;</i> directory and
      double-click on the <i>&quot;%s&quot;</i> icon",
      "dosutils", "rawwritewin") . "</li>\n";
print INSTALL_HTML "   <li>" . N("insert a blank floppy in the floppy drive") .  "</li>\n";
print INSTALL_HTML "   <li>" . 
# the "%s" placeholders is for a DOS pathname
N("select <i>&quot;%s&quot;</i> in the <i>&quot;Image
      File&quot;</i> field (assuming that your CDROM drive is
      &quot;D:&quot;, otherwise replace &quot;D:&quot; as needed)",
      "D:\\images\\cdrom.img") . "</li>\n";
print INSTALL_HTML "   <li>" . 
N("select &quot;A:&quot; in the <i>&quot;Floppy Drive&quot;</i> field then
      click on <i>&quot;Write&quot;</i>.") . "</li>\n";
print INSTALL_HTML "   </ul>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . N("To begin the installation:") . "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   <ul>\n";
print INSTALL_HTML "   <li>" .
N("insert the CDROM in the drive, as well as the boot floppy, then") . "</li>\n";
print INSTALL_HTML "   <li>" . N("restart the computer.") . "</li>\n";
print INSTALL_HTML "   </ul>\n";
print INSTALL_HTML "<p align=\"$right\">\n";
print INSTALL_HTML "  <a href=\"#top\">[" . N("top of this page") . "]</a>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <a name=\"other\"></a><hr width=\"100%\">\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "  <h3>" . N("3. %s", N("Other installation methods")) . "</h3>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " .
N("If for any reason the previous methods do not fit your needs (you
   want to perform a network install, an install from pcmcia devices
   or&nbsp;...), you will also need to make a boot floppy:") . "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   <ul>\n";
print INSTALL_HTML "   <li>" .
N("Under <b>Linux</b> (or other modern UNIX systems) type at prompt:") . "<br>\n";
print INSTALL_HTML "      <tt dir=\"ltr\">\$ dd if=xxxxx.img of=/dev/fd0</tt></li>\n";
print INSTALL_HTML "   </ul>\n   <ul>\n";
print INSTALL_HTML "   <li>" .
# th "%s" placeholders are for file names (boot images)
N("Under <b>Windows</b>, follow the method described in point 2, but
      using %s (see below) instead of
      %s.",
      "<tt dir=\"ltr\">xxxxx.img</tt>",
      "<tt dir=\"ltr\">cdrom.img</tt>") . "</li>\n";
print INSTALL_HTML "   </ul>\n   <ul>\n";
print INSTALL_HTML "   <li>" .
N("Under <b>DOS</b>, assuming your CD is drive D:, type:") .
"<br>\n" . "      <tt dir=\"ltr\">" . 
"D:\\&gt; <b>dosutils\\rawrite.exe -f install\\images\\xxxxx.img -d A</b>" .
"</tt></li>\n";
print INSTALL_HTML "   </ul>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . N("Here the list of boot images:") . "\n";
print INSTALL_HTML "<p align=\"center\">\n";
print INSTALL_HTML "<center>\n";
print INSTALL_HTML "<table cellspacing=\"2\" cellpadding=\"5\" border=\"2\" dir=\"$dir\">\n";
print INSTALL_HTML "<tr><td><tt>cdrom.img</tt></td>\n";
print INSTALL_HTML "    <td>" . N("install from CD-ROM") . "</td></tr>\n";
print INSTALL_HTML "<tr><td><tt>hd_grub.img</tt></td>\n";
print INSTALL_HTML "    <td>" . N("install from hard-disk (from a Linux, Windows, or
                      ReiserFS filesystem)") . "<br>\n" . "        " .
N("you can configure it for your system at:") . "\n        " .
"<a href=\"http://qa.mandriva.com/hd_grub.cgi\">" .
"http://qa.mandriva.com/hd_grub.cgi" . 
"</a>" . "</td></tr>\n";
print INSTALL_HTML "<tr><td><tt>network.img</tt></td>\n";
print INSTALL_HTML "    <td>" . N("install from ftp/nfs/http") . "<br>" .
N("NOTE: you will need to insert %s
                      in your floppy drive when prompted",
      "<tt dir=\"ltr\">network_drivers.img</tt>") . "</td></tr>\n";
print INSTALL_HTML "<tr><td><tt>pcmcia.img</tt></td>\n";
print INSTALL_HTML "    <td>" . N("install from pcmcia devices (warning, most pcmcia
                      network adapters are now directly supported
                      from %s)",
    "<tt dir=\"ltr\">network.img</tt>") . "</td></tr>\n";
print INSTALL_HTML "</table>\n";
print INSTALL_HTML "</center>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " .
N("You may also burn %s on a CDROM and boot from it. It supports
   all installations methods, cdrom, network, and hard-disk.",
   "<tt dir=\"ltr\">boot.iso</tt>") . "\n";
print INSTALL_HTML "<p align=\"$right\">\n";
print INSTALL_HTML "  <a href=\"#top\">[" . N("top of this page") . "]</a>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <hr width=\"100%\">\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " .
N("You can also use a <b>text mode</b> installation if, for any reason,
   you have trouble with the default graphical installation. To use it,
   press <b>[F1]</b> at Mandriva Linux welcome screen, then type
   %s at the prompt.", "<tt><b>text</b></tt>") . "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " .
N("If you need to <b>rescue</b> your existing Mandriva Linux system,
   insert your Installation CDROM (or any relevant boot floppy), press
   <b>[F1]</b> at Mandriva Linux welcome screen, then type
   %s at the prompt.", "<tt><b>rescue</b></tt>") . "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . 
# the "%s" placeholder is for a long URL address
N("See %s 
   for more technical information.",
	"<a href=\"http://www.mandrivalinux.com/drakx/README\" dir=\"ltr\">http://www.mandrivalinux.com/drakx/README</a>") . "\n";
print INSTALL_HTML "<p align=\"$right\">\n";
print INSTALL_HTML "  <a href=\"#top\">[" . N("top of this page") . "]</a>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <hr width=\"100%\">\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "  <h3>" . N("Below are the main stages of installation:") .
"</h3>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   <ol>\n";
print INSTALL_HTML "   <li>" .
N("Insert your Installation CDROM (or Installation Floppy disk if
      necessary) and restart your machine.") . "</li>\n";
print INSTALL_HTML "   <li>" .
N("Press <b>[Enter]</b> when the Mandriva Linux welcome screen
      appears and carefully follow the instructions.") . "</li>\n";
print INSTALL_HTML "   <li>" .
N("When the installation is complete take out the CD-ROM when
      ejected (and any floppy disk if present in drive); your machine
      will restart. If it does not, restart it manually.") . "</li>\n";
print INSTALL_HTML "   <li>" .
N("Mandriva Linux will start. After bootup, you can login on your
      machine under the user account setup during install, or as
      &quot;%s&quot;.",
      "<i>root</i>") . "</li>\n";
print INSTALL_HTML "   </ol>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "  <b><font color=\"#FF0000\">" .
N("Important note:") . "</font></b>\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " .
# the "%s" placeholders are for "root" and commands to launch programs
N("The %s account will give you unrestricted
   access to your Linux system. Do not use it except to configure or
   administer Linux. For every day use, use a normal user account
   which you can configure with the
   %s tool, or with the commands
   %s and %s.",
   "<i>&quot;root&quot;</i>",
   "<b>&quot;userdrake&quot;</b>",
   "<b>&quot;adduser&quot;</b>",
   "<b>&quot;passwd&quot;</b>") . "\n";
print INSTALL_HTML "<p align=\"center\">\n";
print INSTALL_HTML "  <center><b>" . N("Good luck with Mandriva Linux!") .  "</b></center>\n";
print INSTALL_HTML "<p align=\"$right\">\n";
print INSTALL_HTML "  <a href=\"#top\">[" . N("top of this page") . "]</a>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <hr width=\"100%\">\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "   " . N("For additional support, see the following:") .  "\n";
print INSTALL_HTML "<p align=\"$left\">\n";
print INSTALL_HTML "  <ul>\n";
print INSTALL_HTML "  <li>" .
N("E-Support at %s", "<a href=\"http://www.mandrivaexpert.com/\">http://www.mandrivaexpert.com/</a>") . "</li>\n";
print INSTALL_HTML "  <li>" .
N("Mandriva Linux Errata at %s",
"<a href=\"http://www.mandrivalinux.com/en/errata.php3\">http://www.mandrivalinux.com/en/errata.php3</a>") . "</li>\n";

print INSTALL_HTML "  <li>" .
N("Mandriva Linux Security Advisories at %s",
"<a href=\"http://www.mandriva.com/security/advisories?wslang=$html_lang\">http://www.mandriva.com/security/advisories</a>") . "</li>\n";
print INSTALL_HTML "  <li>" .
N("On-line Documentation at %s",
"<a href=\"http://www.mandrivalinux.com/$our_lang/fdoc.php3\">http://www.mandrivalinux.com/$our_lang/fdoc.php3</a>") . "</li>\n";
print INSTALL_HTML "  <li>" .
N("Read and join the On-line Discussion Forums of Mandriva Club at %s",
"<a href=\"http://club.mandriva.com\">http://club.mandriva.com</a>") . "</li>\n";
print INSTALL_HTML "  <li>" .
N("Join the Mailing Lists at %s",
"<a href=\"http://www.mandrivalinux.com/$our_lang/flists.php3\">http://www.mandrivalinux.com/$our_lang/flists.php3</a>") . "</li>\n";
print INSTALL_HTML "  <li>" .
N("Easily Searchable Mailing List archives at %s", 
"<a href=\"http://marc.theaimsgroup.com/\">http://marc.theaimsgroup.com/</a>") . "</li>\n";
print INSTALL_HTML "  <li>" .
N("Search the Internet using Google for Linux") . " " .
"<a href=\"http://www.google.com/linux?hl=$google_lang\">http://www.google.com/linux</a>" .
"</li>\n";
print INSTALL_HTML "  <li>" .
N("Search Usenet Groups using Google Groups at %s",
"<a href=\"http://groups.google.com/groups?group=comp&amp;hl=$google_lang\">http://groups.google.com/groups?group=comp</a>") . "</li>\n";
print INSTALL_HTML "  </ul>\n";
print INSTALL_HTML "<p>\n";
print INSTALL_HTML "  <hr width=\"100%\">\n";
#if ( $dir =~ /rtl/ ) { print INSTALL_HTML "</font>\n" };
print INSTALL_HTML "</body>\n";
print INSTALL_HTML "</html>\n";


