Author: marcus Date: Sun Jul 13 11:52:23 2014 New Revision: 1610172 URL: http://svn.apache.org/r1610172 Log: Re-worked redirect function to show a message text that can be localized
Modified: openoffice/ooo-site/trunk/content/index_redirect.html Modified: openoffice/ooo-site/trunk/content/index_redirect.html URL: http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/index_redirect.html?rev=1610172&r1=1610171&r2=1610172&view=diff ============================================================================== --- openoffice/ooo-site/trunk/content/index_redirect.html (original) +++ openoffice/ooo-site/trunk/content/index_redirect.html Sun Jul 13 11:52:23 2014 @@ -9,6 +9,7 @@ <link href="https://plus.google.com/+openoffice" rel="publisher" /> <title>Apache OpenOffice - The Free and Open Productivity Suite</title> <script type="text/javascript" src="download/test/globalvars.js"></script> + <script type="text/javascript" src="msg_prop_l10n.js"></script> <script type="text/javascript" src="download/test/languages.js"></script> <script type="text/javascript" src="download/test/download.js"></script> <style type="text/css"> @@ -87,60 +88,38 @@ } function showRedirectBox() { - var lang_iso = ""; // The language as ISO code. - var lang_name = ""; // The language as native name. - DL.NL_LANG = ""; // Set to empty as this variable must not be used in this context. - DL.LANG_SEL = ""; // Set to empty as this variable must not be used in this context. - var redirect = false; // Should the found language be used to redirect (false/true)? - - var lang_to_redirect = [ // List all languages that should be redirected. - "ast", "eu", "bg", "zh-cn", "zh-tw", "cs", "da", "nl", "fi", "fr", "gl", "de", "el", - "he", "hi", "hu", "it", "ja", "km", "ko", "lt", "nb", "pl", "pt-br", "pt", "ru", - "gd", "sr", "sk", "sl", "es", "sv", "ta", "th", "tr", "vi" - ]; - - // Get the language ISO code from browser guessed data. - lang_iso = DL.getLanguage(); + DL.NL_LANG = ""; // Set to empty as both variables must not be used in following function. + DL.LANG_SEL = ""; + var lang_iso = DL.getLanguage(); // Get the language ISO code from browser guessed data. + var lang_text = ""; // The language as native name. + var redirect = false; // Should the found language be used to redirect (false/true)? // Query if the browser language is one of the released languages. for( var i = 0, j = DL.SEL_LANG.length; i < j; i = i + 3 ) { - - // If the language was found, set found = true. + // If the language was found. if( DL.SEL_LANG[ i ] === lang_iso ) { - lang_name = DL.SEL_LANG[ i + 1 ] + " - " + DL.SEL_LANG[ i + 2 ]; - - // Query if the released language is one of the redirect languages. - for( var k = 0, l = lang_to_redirect.length; k < l; k++ ) { - - // If the language was found, set redirect = true. - if( lang_to_redirect[ k ] === DL.SEL_LANG[ i ] ) { - redirect = true; - break; - } + // Only if the language is OK to redirect, assign the text and set redirect = true. + if( l10n.index_redirect_text[ i / 3 * 2 ] === "y" ) { + lang_text = l10n.index_redirect_text[ i / 3 * 2 + 1 ]; + redirect = true; } break; } } - alert( "Just for debugging purpose:" + "\n\n" - + "Browser language ISO code: \t" + lang_iso + "\n" - + "Found language name: \t\t" + lang_name + "\n" - + "Is it OK to redirect? \t\t\t" + redirect ); + alert( "Just for debugging purpose:" + "\n\n" + + "Browser language ISO code: \t\t" + lang_iso + "\n" + + "Is it OK to redirect? \t\t\t\t" + redirect + "\n" + + "Position in language array: \t\t" + i / 3 + "\n" + + "Found language text: \t\t\t" + lang_text ); - // Show alert box or not? + // Show redirect box or not? if( redirect ) { - // Show redirect box with defined background color. - // Show the text with link and cursor as poiner. + // Show redirect box with defined background color and the text with link and cursor as poiner. document.write( "<div id='redirect_box'" + " onclick='window.open( \"http://www.openoffice.org/" + lang_iso + "\", \"_blank\" ); return false;'>" - // Show headline and text. -// + "<h2 style='cursor: pointer;'>Want to see the text in " + lang_name + "?</h2>" -// + "<p style='cursor: pointer;'>We have localized our website into many languages and yours is one of these. " -// + "Just click this text to get more specialized information instead of the general and global in English." -// + "</p>" - + "<p>" - + "This site is also available in <b>" + lang_name + "</b>. Just click this text to get redirected." - + "</p>" +// + " onclick='window.open( \"http://www.openoffice.org/" + lang_iso + "\", \"_self\" ); return false;'>" + + "<p>" + lang_text + "</p>" + "</div>" ); // redirect box }