Desktop Documentation Presentation Options-Example-index

From FedoraProject

Jump to: navigation, search
DocsProject Header docTeam1.png


Example index.html file for Release Notes

<html>
 <head>
   <script type="text/javascript" language="JavaScript1.2">
     if (navigator.appName == 'Netscape')
       var lang = navigator.language;
     else
       var lang = navigator.browserLanguage;
   </script>
 
   <title>Fedora 12 Release Notes</title>
   <body>
     <script type="text/javascript">
       var match = 0;
       var locales = ["es-ES", "nl-NL", "cs-CZ", "pl=PL", "pt-BR", "ru-RU", "sv-SE"];

       // Try for full match of lang_LOC
       for(locale in locales)
         {
           if(lang == locales[locale])
             {
               match = 1;
               break;
             }
         }
 
       // Else try for match of lang
       if(match == 0)
         {
           for(locale in locales)
             {
               var loc_lang = locales[locale].substring(0,2);
               var language = lang.substring(0,2);
 
               if(loc_lang == language)
                 {
                   lang = locales[locale];
                   match = 1;
                   break;
                 }
             }
         }
 
       // Else default to en-US
       if(match == 0)
         {
           lang = 'en-US';
         }
 
       window.location = lang + "/index.html";
     </script>
   </body>
</html>