From 22e8556691d134c4bf778837d4a0c24e4504b8cf Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 19 Jun 2004 14:36:22 +0000 Subject: finished tweaking language selection --- web/html/account.php | 18 ++++++++++++++ web/html/index.php | 2 ++ web/html/logout.php | 18 ++++++++++++++ web/html/pkgmgmnt.php | 18 ++++++++++++++ web/html/pkgsearch.php | 18 ++++++++++++++ web/html/pkgsubmit.php | 17 +++++++++++++ web/html/pkgvote.php | 18 ++++++++++++++ web/html/template.php | 3 ++- web/lang/account_po.inc | 19 +++++++++++++++ web/lang/logout_po.inc | 19 +++++++++++++++ web/lang/mgmnt_po.inc | 19 +++++++++++++++ web/lang/search_po.inc | 19 +++++++++++++++ web/lang/submit_po.inc | 19 +++++++++++++++ web/lang/template_po.inc | 19 +++++++++++++++ web/lang/vote_po.inc | 19 +++++++++++++++ web/lib/aur.inc | 63 +++++++++++++++++++++++++++++++++++++++++++++--- web/lib/translator.inc | 15 ------------ 17 files changed, 303 insertions(+), 20 deletions(-) create mode 100644 web/html/account.php create mode 100644 web/html/logout.php create mode 100644 web/html/pkgmgmnt.php create mode 100644 web/html/pkgsearch.php create mode 100644 web/html/pkgsubmit.php create mode 100644 web/html/pkgvote.php create mode 100644 web/lang/account_po.inc create mode 100644 web/lang/logout_po.inc create mode 100644 web/lang/mgmnt_po.inc create mode 100644 web/lang/search_po.inc create mode 100644 web/lang/submit_po.inc create mode 100644 web/lang/template_po.inc create mode 100644 web/lang/vote_po.inc (limited to 'web') diff --git a/web/html/account.php b/web/html/account.php new file mode 100644 index 00000000..6d402cae --- /dev/null +++ b/web/html/account.php @@ -0,0 +1,18 @@ +\n"; + + +html_footer("\$Id$"); # Use the $Id$ keyword + # NOTE: when checking in a new file, use + # 'svn propset svn:keywords "Id" filename.php' + # to tell svn to expand the "Id" keyword. +?> diff --git a/web/html/index.php b/web/html/index.php index 24afdf04..80389923 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -1,11 +1,13 @@ \n"; +print "My LANG is: " . $LANG . "
\n"; html_footer("\$Id$"); diff --git a/web/html/logout.php b/web/html/logout.php new file mode 100644 index 00000000..6757784e --- /dev/null +++ b/web/html/logout.php @@ -0,0 +1,18 @@ +\n"; + + +html_footer("\$Id$"); # Use the $Id$ keyword + # NOTE: when checking in a new file, use + # 'svn propset svn:keywords "Id" filename.php' + # to tell svn to expand the "Id" keyword. +?> diff --git a/web/html/pkgmgmnt.php b/web/html/pkgmgmnt.php new file mode 100644 index 00000000..0988e51e --- /dev/null +++ b/web/html/pkgmgmnt.php @@ -0,0 +1,18 @@ +\n"; + + +html_footer("\$Id$"); # Use the $Id$ keyword + # NOTE: when checking in a new file, use + # 'svn propset svn:keywords "Id" filename.php' + # to tell svn to expand the "Id" keyword. +?> diff --git a/web/html/pkgsearch.php b/web/html/pkgsearch.php new file mode 100644 index 00000000..d23a602e --- /dev/null +++ b/web/html/pkgsearch.php @@ -0,0 +1,18 @@ +\n"; + + +html_footer("\$Id$"); # Use the $Id$ keyword + # NOTE: when checking in a new file, use + # 'svn propset svn:keywords "Id" filename.php' + # to tell svn to expand the "Id" keyword. +?> diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php new file mode 100644 index 00000000..fc36da5d --- /dev/null +++ b/web/html/pkgsubmit.php @@ -0,0 +1,17 @@ +\n"; + + +html_footer("\$Id$"); # Use the $Id$ keyword + # NOTE: when checking in a new file, use + # 'svn propset svn:keywords "Id" filename.php' + # to tell svn to expand the "Id" keyword. +?> diff --git a/web/html/pkgvote.php b/web/html/pkgvote.php new file mode 100644 index 00000000..e111937f --- /dev/null +++ b/web/html/pkgvote.php @@ -0,0 +1,18 @@ +\n"; + + +html_footer("\$Id$"); # Use the $Id$ keyword + # NOTE: when checking in a new file, use + # 'svn propset svn:keywords "Id" filename.php' + # to tell svn to expand the "Id" keyword. +?> diff --git a/web/html/template.php b/web/html/template.php index 8ada0f1f..a61ba6fc 100644 --- a/web/html/template.php +++ b/web/html/template.php @@ -1,6 +1,7 @@ Traducción española aquí. <--"; +# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; +# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lang/logout_po.inc b/web/lang/logout_po.inc new file mode 100644 index 00000000..438f50df --- /dev/null +++ b/web/lang/logout_po.inc @@ -0,0 +1,19 @@ + Traducción española aquí. <--"; +# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; +# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lang/mgmnt_po.inc b/web/lang/mgmnt_po.inc new file mode 100644 index 00000000..438f50df --- /dev/null +++ b/web/lang/mgmnt_po.inc @@ -0,0 +1,19 @@ + Traducción española aquí. <--"; +# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; +# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lang/search_po.inc b/web/lang/search_po.inc new file mode 100644 index 00000000..438f50df --- /dev/null +++ b/web/lang/search_po.inc @@ -0,0 +1,19 @@ + Traducción española aquí. <--"; +# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; +# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lang/submit_po.inc b/web/lang/submit_po.inc new file mode 100644 index 00000000..438f50df --- /dev/null +++ b/web/lang/submit_po.inc @@ -0,0 +1,19 @@ + Traducción española aquí. <--"; +# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; +# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lang/template_po.inc b/web/lang/template_po.inc new file mode 100644 index 00000000..0b5d1bc9 --- /dev/null +++ b/web/lang/template_po.inc @@ -0,0 +1,19 @@ + Traducción española aquí. <--"; +# $_t["fr"]["Hi, this is worth reading!"] = "--> Traduction française ici. <--"; +# $_t["de"]["Hi, this is worth reading!"] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lang/vote_po.inc b/web/lang/vote_po.inc new file mode 100644 index 00000000..438f50df --- /dev/null +++ b/web/lang/vote_po.inc @@ -0,0 +1,19 @@ + Traducción española aquí. <--"; +# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--"; +# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--"; + +?> \ No newline at end of file diff --git a/web/lib/aur.inc b/web/lib/aur.inc index 8a4756e4..87309e46 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -3,6 +3,13 @@ include_once("aur_po.inc"); # Define global variables # +$PASS_PHRASE = "Dustyissocool"; +$SUPPORTED_LANGS = array( + "en" => 1, # English + "es" => 1, # Español + "de" => 1, # Deutsch + "fr" => 1, # Français +); # connect to the database @@ -26,6 +33,43 @@ function db_connect() { return $handle; } +# set up the visitor's language +# +function set_lang() { + global $_REQUEST; + global $_COOKIE; + global $LANG; + global $SUPPORTED_LANGS; + + $update_cookie = 0; + if (isset($_REQUEST['setlang'])) { + # visitor is requesting a language change + # + $LANG = $_REQUEST['setlang']; + $update_cookie = 1; + + } elseif (isset($_COOKIE['AURLANG'])) { + # If a cookie is set, use that + # + $LANG = $_COOKIE['AURLANG']; + + } # TODO query the database if the user is logged in + + if (!$LANG || !array_key_exists($LANG, $SUPPORTED_LANGS)) { + $LANG = "en"; # default to English + } + + if ($update_cookie) { + # TODO do we need to set the domain too? I seem to remember some + # security concerns about not using domains - but it's not like + # we really care if another site can see what language our visitor + # was using.... + # + setcookie("AURLANG", $LANG, 0, "/"); + } + return; +} + # common header # @@ -49,11 +93,22 @@ function html_header() { print " \n"; print " \n"; print " \n"; - print " \n"; + print " \n"; print " \n"; + print "ArchLinux User-community Repository
"; + + # XXX CSS help - a:link, a:visited, etc are defined, but I don't want to + # use the defaults. Is this the way to override them? + # + print "English "; + print "Español "; + print "Deutsch "; + print "Français"; + print " \n"; print " \n"; print "
"; - print ""; + + # XXX Can I scale a PNG like this? + # + print ""; - print "ArchLinux User-community Repository
\n"; print " \n"; diff --git a/web/lib/translator.inc b/web/lib/translator.inc index 87fe7815..ca9e4dda 100644 --- a/web/lib/translator.inc +++ b/web/lib/translator.inc @@ -25,23 +25,8 @@ include_once("common_po.inc"); function __($tag, $args=array()) { global $_t; - global $_REQUEST; global $LANG; - $supported_langs = array( - "en" => 1, # English - "es" => 1, # Español - "de" => 1, # Deutsch - "fr" => 1, # Français - ); - - # default to English if the lang hasn't been provided or isn't supported - # - $LANG = $_REQUEST['LANG']; - if (!$LANG || !array_key_exists($LANG, $supported_langs)) { - $LANG = "en"; - } - # create the translation, if it doesn't exist, highlight it # $translated = $_t[$LANG][$tag]; -- cgit v1.2.3-24-g4f1b