diff --git a/admin/index.php b/admin/index.php index a7768224..7100926d 100644 --- a/admin/index.php +++ b/admin/index.php @@ -27,18 +27,18 @@ send_header("Administration"); echo "
"; - echo "Participant Registration
"; - echo "Print / Export Reports
"; + echo "".i18n("Participant Registration")."
"; + echo "".i18n("Print / Export Reports")."
"; echo "
"; - echo "Committee Management
"; - echo "Awards Management
"; - echo "School Management
"; - echo "Judging Management
"; - echo "Translations Management
"; + echo "".i18n("Committee Management")."
"; + echo "".i18n("Awards Management")."
"; + echo "".i18n("School Management")."
"; + echo "".i18n("Judging Management")."
"; + echo "".i18n("Translations Management")."
"; echo "
"; - echo "Enter Winning Projects
"; + echo "".i18n("Enter Winning Projects")."
"; echo "
"; - echo "Communication (Send Emails)
"; + echo "".i18n("Communication (Send Emails)")."
"; send_footer(); ?> diff --git a/admin/translations.php b/admin/translations.php index ed86e04e..76fd57d8 100644 --- a/admin/translations.php +++ b/admin/translations.php @@ -27,6 +27,13 @@ send_header("Translations"); +//by default, we will edit the french translations +if($_GET['translang']) $_SESSION['translang']=$_GET['translang']; + +if(!$_SESSION['translang']) + $_SESSION['translang']="fr"; + + if($_GET['show']) $show=$_GET['show']; else if($_POST['show']) $show=$_POST['show']; if(!$show) $show="missing"; @@ -43,6 +50,23 @@ if($_GET['action']=="delete" && $_GET['delete'] && $_GET['lang']) echo happy(i18n("Translation deleted")); } +echo ""; +echo ""; +echo "
"; +echo i18n("Choose a language to manage translations for"); +echo ""; +echo "
"; +echo ""; +echo "
"; +echo "
"; + if($show=="missing") { echo i18n("Show missing translations"); @@ -55,21 +79,22 @@ else echo "  |  "; echo i18n("Show all translations"); } + echo "
"; echo "
"; echo i18n("Instructions: Enter the translation below the string and click Save. Only one translation can be saved at a time. The terms %1, %2, etc get substituded with various arguments to the string, so they must appear in the translation if they are in the original string."); echo "
"; echo "
"; -if($show=="missing") $showquery="WHERE val is null OR val=''"; +if($show=="missing") $showquery="AND ( val is null OR val='' )"; else $showquery=""; -$q=mysql_query("SELECT * FROM translations $showquery ORDER BY str"); +$q=mysql_query("SELECT * FROM translations WHERE lang='".$_SESSION['translang']."' $showquery ORDER BY str"); $num=mysql_num_rows($q); -echo i18n("Showing %1 translation strings",array($num)); +echo i18n("Showing %1 translation strings",array($num),array("number of strings")); echo ""; -echo ""; +echo ""; while($r=mysql_fetch_object($q)) { echo ""; @@ -80,7 +105,11 @@ while($r=mysql_fetch_object($q)) echo ""; + echo htmlspecialchars($r->str); + if($r->argsdesc) + echo "
".i18n("Arguments:")." $r->argsdesc "; + + echo ""; echo ""; echo ""; echo ""; diff --git a/common.inc.php b/common.inc.php index 25c07051..5fe569bb 100644 --- a/common.inc.php +++ b/common.inc.php @@ -226,7 +226,7 @@ if($_GET['switchlanguage']) } -function i18n($str,$args=array()) +function i18n($str,$args=array(),$argsdesc=array()) { if(!$str) return ""; @@ -262,18 +262,33 @@ function i18n($str,$args=array()) { $str=str_replace("%$x",$args[$x-1],$str); } - return "$str"; + return "{{".$str."}}"; } } else { - mysql_query("INSERT INTO translations (lang,strmd5,str) VALUES ('".$_SESSION['lang']."','".md5($str)."','".mysql_escape_string($str)."')"); + if(count($argsdesc)) + { + $argsdescstring=""; + $n=1; + foreach($argsdesc AS $ad) + { + $argsdescstring.="%$n=$ad, "; + $n++; + } + $argsdescstring=substr($argsdescstring,0,-2); + $argsdescstring="'".mysql_escape_string($argsdescstring)."'"; + } + else + $argsdescstring="null"; + + mysql_query("INSERT INTO translations (lang,strmd5,str,argsdesc) VALUES ('".$_SESSION['lang']."','".md5($str)."','".mysql_escape_string($str)."',$argsdescstring)"); for($x=1;$x<=count($args);$x++) { $str=str_replace("%$x",$args[$x-1],$str); } - return "$str"; + return "{{".$str."}}"; } } } @@ -750,7 +765,7 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array()) } else { - echo error(i18n("CRITICAL ERROR: email '%1' not found",array($val))); + echo error(i18n("CRITICAL ERROR: email '%1' not found",array($val),array("email address"))); } } diff --git a/config/categories.php b/config/categories.php index 8d447e04..6f3f6818 100644 --- a/config/categories.php +++ b/config/categories.php @@ -36,7 +36,7 @@ echo mysql_error(); if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id']) { - echo error(i18n("Category ID %1 already exists",array($_POST['id']))); + echo error(i18n("Category ID %1 already exists",array($_POST['id']),array("category ID"))); } else { @@ -62,7 +62,7 @@ $q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)) { - echo error(i18n("Category ID %1 already exists",array($_POST['id']))); + echo error(i18n("Category ID %1 already exists",array($_POST['id']),array("category ID"))); } else { @@ -131,7 +131,7 @@ { echo ""; echo " "; - echo " "; + echo " "; echo " "; echo " "; echo "
".i18n("English / French")."".i18n("Save")."
".i18n("English")." / ".$translangname."".i18n("Save")."
"; echo "strmd5&lang=$r->lang\">"; echo " "; - echo "$r->str
$r->id$r->category".i18n($r->category)."$r->mingrade$r->maxgrade"; diff --git a/config/dates.php b/config/dates.php index b16c30c8..f17e1502 100644 --- a/config/dates.php +++ b/config/dates.php @@ -43,7 +43,7 @@ echo ""; echo "\n"; echo ""; - echo ""; + echo ""; $q=mysql_query("SELECT * FROM dates WHERE year='".$config['FAIRYEAR']."' ORDER BY date"); while($r=mysql_fetch_object($q)) diff --git a/config/divisions.php b/config/divisions.php index 74ae6339..c23d9ba8 100644 --- a/config/divisions.php +++ b/config/divisions.php @@ -34,7 +34,7 @@ $q=mysql_query("SELECT id FROM projectdivisions WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id']) { - echo error(i18n("Division ID %1 already exists",array($_POST['id']))); + echo error(i18n("Division ID %1 already exists",array($_POST['id']),array("division ID"))); } else { @@ -59,7 +59,7 @@ $q=mysql_query("SELECT id FROM projectdivisions WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)) { - echo error(i18n("Division ID %1 already exists",array($_POST['id']))); + echo error(i18n("Division ID %1 already exists",array($_POST['id']),array("division ID"))); } else { @@ -126,7 +126,7 @@ { echo ""; echo " "; - echo " "; + echo " "; echo " "; echo "

".i18n("Dates for fair year %1",array($config['FAIRYEAR']))."

".i18n("Dates for fair year %1",array($config['FAIRYEAR']),array("fair year"))."

$r->id$r->division".i18n($r->division)."$r->division_shortform"; echo "id\">"; diff --git a/config/images.php b/config/images.php index b83ee0f0..dfb92c86 100644 --- a/config/images.php +++ b/config/images.php @@ -54,16 +54,16 @@ if($_POST['action']=="addimage") echo ""; echo "\n"; - echo "

Fair Logo Image

"; + echo "

".i18n("Fair Logo Image")."

"; echo ""; if(file_exists("../data/logo.gif")) { echo ""; } diff --git a/config/index.php b/config/index.php index b282fd37..ca7379c8 100644 --- a/config/index.php +++ b/config/index.php @@ -27,16 +27,16 @@ send_header("Configuration"); - echo "Configuration Variables
"; - echo "Important Dates
"; - echo "Project Age Categories
"; - echo "Project Divisons
"; - echo "Project Sub-Divisons
"; - echo "Page Texts
"; - echo "Project Safety Questions
"; - echo "Images (Fair Logo)
"; + echo "".i18n("Configuration Variables")."
"; + echo "".i18n("Important Dates")."
"; + echo "".i18n("Project Age Categories")."
"; + echo "".i18n("Project Divisons")."
"; + echo "".i18n("Project Sub-Divisons")."
"; + echo "".i18n("Page Texts")."
"; + echo "".i18n("Project Safety Questions")."
"; + echo "".i18n("Images (Fair Logo)")."
"; echo "
"; - echo "Rollover Fair Year
"; + echo "".i18n("Rollover Fair Year")."
"; send_footer(); ?> diff --git a/config/pagetexts.php b/config/pagetexts.php index 32a86142..8656e8cb 100644 --- a/config/pagetexts.php +++ b/config/pagetexts.php @@ -72,7 +72,7 @@ echo "
"; echo ""; echo ""; - echo "Original size
"; - echo "100 Pixel width
"; - echo "200 Pixel width
"; + echo "",i18n("Original size")."
"; + echo "".i18n("100 Pixel width")."
"; + echo "".i18n("200 Pixel width")."
"; echo "500 Pixel width
"; echo "
"; $q=mysql_query("SELECT * FROM pagetext WHERE year='".$config['FAIRYEAR']."' ORDER BY textname"); - echo ""; + echo ""; while($r=mysql_fetch_object($q)) { echo ""; diff --git a/config/safetyquestions.php b/config/safetyquestions.php index 71810343..f5982400 100644 --- a/config/safetyquestions.php +++ b/config/safetyquestions.php @@ -125,7 +125,7 @@ } } echo "
"; - echo "Add new safety question"; + echo "".i18n("Add new safety question").""; echo "
Page Text NameLast Update
".i18n("Page Text Name")."".i18n("Last Update")."
textname\">$r->textname
"; $q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord"); diff --git a/config/variables.php b/config/variables.php index 46ba8c83..2e6cf84b 100644 --- a/config/variables.php +++ b/config/variables.php @@ -75,7 +75,7 @@ } } - echo ""; + echo ""; $q=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."' ORDER BY var"); while($r=mysql_fetch_object($q)) diff --git a/db/db.update.12.sql b/db/db.update.12.sql index 7f743ba5..b6cbd09e 100644 --- a/db/db.update.12.sql +++ b/db/db.update.12.sql @@ -1,3 +1,4 @@ UPDATE `config` SET `description` = 'Self nominations for special awards are due either with registration or on a specific date. If "date" is used, it must be configured under "Important Dates" section. If you do not wish to allow students to self-nominate for special awards, set to "none" (none|date|registration)' WHERE `var` = 'specialawardnomination'; ALTER TABLE `schools` ADD `projectlimit` INT NOT NULL , ADD `projectlimitper` ENUM( 'total', 'agecategory' ) NOT NULL ; INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'participant_student_tshirt', 'yes', 'Ask for students their T-Shirt size (yes/no).', '-1'); +ALTER TABLE `translations` ADD `argsdesc` TEXT DEFAULT NULL ; diff --git a/register_judges.php b/register_judges.php index 87c7854f..50d831cd 100644 --- a/register_judges.php +++ b/register_judges.php @@ -101,7 +101,7 @@ { email_send("register_judges_resend_password",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("PASSWORD"=>$r->password,"EMAIL"=>$r->email)); send_header("Judges Registration"); - echo notice(i18n("Your judge registration password has been sent to your email addess %1",array($_SESSION['email']))); + echo notice(i18n("Your judge registration password has been sent to your email addess %1",array($_SESSION['email']),array("email address") )); } else { @@ -272,7 +272,7 @@ } else { - echo i18n("Judges registration for the %1 %2 is now closed",array($config['FAIRYEAR'],$config['fairname'])); + echo i18n("Judges registration for the %1 %2 is now closed",array($config['FAIRYEAR'],$config['fairname']),array("Fair year","Fair name")); } } send_footer(); diff --git a/register_participants.php b/register_participants.php index a8dad415..d9d7a08b 100644 --- a/register_participants.php +++ b/register_participants.php @@ -45,7 +45,7 @@ else { send_header("Participant Registration"); - echo error(i18n("Invalid registration number (%1) for email address %2",array($_POST['regnum'],$_SESSION['email']))); + echo error(i18n("Invalid registration number (%1) for email address %2",array($_POST['regnum'],$_SESSION['email']),array("registration number","email address"))); $_POST['action']="login"; } @@ -71,7 +71,7 @@ else { send_header("Participant Registration"); - echo error(i18n("Invalid registration number (%1) for email address %2",array($_POST['regnum'],$_SESSION['email']))); + echo error(i18n("Invalid registration number (%1) for email address %2",array($_POST['regnum'],$_SESSION['email']),array("registration number","email address"))); $_POST['action']="login"; } @@ -105,7 +105,7 @@ { email_send("register_participants_resend_regnum",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$r->num)); send_header("Participant Registration"); - echo notice(i18n("Your registration number has been resent to your email addess %1",array($_SESSION['email']))); + echo notice(i18n("Your registration number has been resent to your email addess %1",array($_SESSION['email']),array("email address"))); } else { @@ -323,7 +323,7 @@ email_send("new_participant",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$regnum)); - echo i18n("You have been identified as a new registrant. An email has been sent to %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email'])); + echo i18n("You have been identified as a new registrant. An email has been sent to %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email']),array("email address")); echo ""; } @@ -350,7 +350,7 @@ //this will return 1 if its between the dates, 0 otherwise. if($datecheck->datecheck==0) { - echo notice(i18n("Registration for the %1 %2 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($config['FAIRYEAR'],$config['fairname']))); + echo notice(i18n("Registration for the %1 %2 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($config['FAIRYEAR'],$config['fairname']),array("fair year","fair name"))); echo i18n("Please enter your email address to login"); echo "
"; echo "
";


".i18n("Configuration settings for fair year %1",array($config['FAIRYEAR']))."



".i18n("Configuration settings for fair year %1",array($config['FAIRYEAR']),array("fair year"))."