forked from science-ation/science-ation
Add a preliminary translation manager, mostly copied from another location that I use a similar system. It needs to be updated still to handle translations for the languages in the 'languages' table instead of only french. But this will at least allow us to begin the french translations
This commit is contained in:
parent
652e8fe321
commit
28ebf2ce30
@ -34,6 +34,7 @@
|
||||
echo "<a href=\"awards.php\">Awards Management</a> <br />";
|
||||
echo "<a href=\"schools.php\">School Management</a> <br />";
|
||||
echo "<a href=\"judges.php\">Judging Management</a> <br />";
|
||||
echo "<a href=\"translations.php\">Translations Management</a> <br />";
|
||||
echo "<hr />";
|
||||
echo "<a href=\"winners.php\">Enter Winning Projects</a> <br />";
|
||||
echo "<hr />";
|
||||
|
95
admin/translations.php
Normal file
95
admin/translations.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||
Copyright (C) 2005 James Grant <james@lightbox.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation, version 2.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
auth_required('admin');
|
||||
|
||||
send_header("Translations");
|
||||
|
||||
if($_GET['show']) $show=$_GET['show'];
|
||||
else if($_POST['show']) $show=$_POST['show'];
|
||||
if(!$show) $show="missing";
|
||||
|
||||
if($_POST['strmd5'] && $_POST['lang'] && $_POST['val'])
|
||||
{
|
||||
mysql_query("UPDATE translations SET val='".mysql_escape_string(stripslashes($_POST['val']))."' WHERE strmd5='".$_POST['strmd5']."' AND lang='".$_POST['lang']."'");
|
||||
echo happy(i18n("Translation saved"));
|
||||
}
|
||||
|
||||
if($_GET['action']=="delete" && $_GET['delete'] && $_GET['lang'])
|
||||
{
|
||||
mysql_query("DELETE FROM translations WHERE strmd5='".$_GET['delete']."' AND lang='".$_GET['lang']."'");
|
||||
echo happy(i18n("Translation deleted"));
|
||||
}
|
||||
|
||||
if($show=="missing")
|
||||
{
|
||||
echo i18n("Show missing translations");
|
||||
echo " | ";
|
||||
echo "<a href=\"translations.php?show=all\">".i18n("Show all translations")."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<a href=\"translations.php?show=missing\">".i18n("Show missing translations")."</a>";
|
||||
echo " | ";
|
||||
echo i18n("Show all translations");
|
||||
}
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
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 "<br />";
|
||||
echo "<br />";
|
||||
|
||||
if($show=="missing") $showquery="WHERE val is null OR val=''";
|
||||
else $showquery="";
|
||||
|
||||
$q=mysql_query("SELECT * FROM translations $showquery ORDER BY str");
|
||||
$num=mysql_num_rows($q);
|
||||
echo i18n("Showing %1 translation strings",array($num));
|
||||
|
||||
echo "<table class=\"tableedit\">";
|
||||
echo "<tr><th>".i18n("English / French")."</th><th>".i18n("Save")."</th></tr>";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<form method=\"post\" action=\"translations.php\">";
|
||||
echo "<input type=\"hidden\" name=\"show\" value=\"$show\" />";
|
||||
echo "<input type=\"hidden\" name=\"lang\" value=\"$r->lang\" />";
|
||||
echo "<input type=\"hidden\" name=\"strmd5\" value=\"$r->strmd5\" />";
|
||||
echo "<tr>";
|
||||
echo "<td valign=\"top\">";
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to delete this translation?');\" href=\"translations.php?show=$show&action=delete&delete=$r->strmd5&lang=$r->lang\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo " ";
|
||||
echo "$r->str</td>";
|
||||
echo "<td rowspan=\"2\" valign=\"middle\" ><input type=\"submit\" value=\"".i18n("Save")."\" /></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr>";
|
||||
echo "<td valign=\"top\"><input style=\"width: 95%\" type=\"text\" name=\"val\" value=\"$r->val\" /></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
|
||||
echo "</form>\n";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
send_footer();
|
||||
?>
|
Loading…
Reference in New Issue
Block a user