mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
finished tweaking language selection
This commit is contained in:
parent
74594e516d
commit
22e8556691
17 changed files with 303 additions and 20 deletions
18
web/html/account.php
Normal file
18
web/html/account.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?
|
||||
include("aur.inc"); # access AUR common functions
|
||||
include("account_po.inc"); # use some form of this for i18n support
|
||||
set_lang(); # this sets up the visitor's language
|
||||
html_header(); # print out the HTML header
|
||||
|
||||
|
||||
# Any text you print out to the visitor, use the __() function
|
||||
# for i18n support. See 'testpo.php' for more details.
|
||||
#
|
||||
print __("Under construction...")."<br/>\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.
|
||||
?>
|
|
@ -1,11 +1,13 @@
|
|||
<?
|
||||
include("index_po.inc");
|
||||
include("aur.inc");
|
||||
set_lang();
|
||||
html_header();
|
||||
|
||||
|
||||
#$dbh = db_connect();
|
||||
print "Connected...<br>\n";
|
||||
print "My LANG is: " . $LANG . "<br>\n";
|
||||
|
||||
|
||||
html_footer("\$Id$");
|
||||
|
|
18
web/html/logout.php
Normal file
18
web/html/logout.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?
|
||||
include("aur.inc"); # access AUR common functions
|
||||
include("logout_po.inc"); # use some form of this for i18n support
|
||||
set_lang(); # this sets up the visitor's language
|
||||
html_header(); # print out the HTML header
|
||||
|
||||
|
||||
# Any text you print out to the visitor, use the __() function
|
||||
# for i18n support. See 'testpo.php' for more details.
|
||||
#
|
||||
print __("Under construction...")."<br/>\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.
|
||||
?>
|
18
web/html/pkgmgmnt.php
Normal file
18
web/html/pkgmgmnt.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?
|
||||
include("aur.inc"); # access AUR common functions
|
||||
include("mgmnt_po.inc"); # use some form of this for i18n support
|
||||
set_lang(); # this sets up the visitor's language
|
||||
html_header(); # print out the HTML header
|
||||
|
||||
|
||||
# Any text you print out to the visitor, use the __() function
|
||||
# for i18n support. See 'testpo.php' for more details.
|
||||
#
|
||||
print __("Under construction...")."<br/>\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.
|
||||
?>
|
18
web/html/pkgsearch.php
Normal file
18
web/html/pkgsearch.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?
|
||||
include("aur.inc"); # access AUR common functions
|
||||
include("search_po.inc"); # use some form of this for i18n support
|
||||
set_lang(); # this sets up the visitor's language
|
||||
html_header(); # print out the HTML header
|
||||
|
||||
|
||||
# Any text you print out to the visitor, use the __() function
|
||||
# for i18n support. See 'testpo.php' for more details.
|
||||
#
|
||||
print __("Under construction...")."<br/>\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.
|
||||
?>
|
17
web/html/pkgsubmit.php
Normal file
17
web/html/pkgsubmit.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?
|
||||
include("aur.inc"); # access AUR common functions
|
||||
include("submit_po.inc"); # use some form of this for i18n support
|
||||
html_header(); # print out the HTML header
|
||||
|
||||
|
||||
# Any text you print out to the visitor, use the __() function
|
||||
# for i18n support. See 'testpo.php' for more details.
|
||||
#
|
||||
print __("Under construction...")."<br/>\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.
|
||||
?>
|
18
web/html/pkgvote.php
Normal file
18
web/html/pkgvote.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?
|
||||
include("aur.inc"); # access AUR common functions
|
||||
include("vote_po.inc"); # use some form of this for i18n support
|
||||
set_lang(); # this sets up the visitor's language
|
||||
html_header(); # print out the HTML header
|
||||
|
||||
|
||||
# Any text you print out to the visitor, use the __() function
|
||||
# for i18n support. See 'testpo.php' for more details.
|
||||
#
|
||||
print __("Under construction...")."<br/>\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.
|
||||
?>
|
|
@ -1,6 +1,7 @@
|
|||
<?
|
||||
include("aur.inc"); # access AUR common functions
|
||||
include("index_po.inc"); # use some form of this for i18n support
|
||||
include("template_po.inc"); # use some form of this for i18n support
|
||||
set_lang(); # this sets up the visitor's language
|
||||
html_header(); # print out the HTML header
|
||||
|
||||
|
||||
|
|
19
web/lang/account_po.inc
Normal file
19
web/lang/account_po.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?
|
||||
# INSTRUCTIONS TO TRANSLATORS
|
||||
#
|
||||
# This file contains the i18n translations for a subset of the
|
||||
# Arch Linux User-community Repository (AUR). This is a PHP
|
||||
# script, and as such, you MUST pay great attention to the syntax.
|
||||
# If your text contains any double-quotes ("), you MUST escape
|
||||
# them with the backslash character (\).
|
||||
#
|
||||
|
||||
include_once("translator.inc");
|
||||
global $_t;
|
||||
|
||||
$_t["en"]["Under construction..."] = "Under construction...";
|
||||
# $_t["es"]["Under construction..."] = "--> Traducción española aquí. <--";
|
||||
# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--";
|
||||
# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--";
|
||||
|
||||
?>
|
19
web/lang/logout_po.inc
Normal file
19
web/lang/logout_po.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?
|
||||
# INSTRUCTIONS TO TRANSLATORS
|
||||
#
|
||||
# This file contains the i18n translations for a subset of the
|
||||
# Arch Linux User-community Repository (AUR). This is a PHP
|
||||
# script, and as such, you MUST pay great attention to the syntax.
|
||||
# If your text contains any double-quotes ("), you MUST escape
|
||||
# them with the backslash character (\).
|
||||
#
|
||||
|
||||
include_once("translator.inc");
|
||||
global $_t;
|
||||
|
||||
$_t["en"]["Under construction..."] = "Under construction...";
|
||||
# $_t["es"]["Under construction..."] = "--> Traducción española aquí. <--";
|
||||
# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--";
|
||||
# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--";
|
||||
|
||||
?>
|
19
web/lang/mgmnt_po.inc
Normal file
19
web/lang/mgmnt_po.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?
|
||||
# INSTRUCTIONS TO TRANSLATORS
|
||||
#
|
||||
# This file contains the i18n translations for a subset of the
|
||||
# Arch Linux User-community Repository (AUR). This is a PHP
|
||||
# script, and as such, you MUST pay great attention to the syntax.
|
||||
# If your text contains any double-quotes ("), you MUST escape
|
||||
# them with the backslash character (\).
|
||||
#
|
||||
|
||||
include_once("translator.inc");
|
||||
global $_t;
|
||||
|
||||
$_t["en"]["Under construction..."] = "Under construction...";
|
||||
# $_t["es"]["Under construction..."] = "--> Traducción española aquí. <--";
|
||||
# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--";
|
||||
# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--";
|
||||
|
||||
?>
|
19
web/lang/search_po.inc
Normal file
19
web/lang/search_po.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?
|
||||
# INSTRUCTIONS TO TRANSLATORS
|
||||
#
|
||||
# This file contains the i18n translations for a subset of the
|
||||
# Arch Linux User-community Repository (AUR). This is a PHP
|
||||
# script, and as such, you MUST pay great attention to the syntax.
|
||||
# If your text contains any double-quotes ("), you MUST escape
|
||||
# them with the backslash character (\).
|
||||
#
|
||||
|
||||
include_once("translator.inc");
|
||||
global $_t;
|
||||
|
||||
$_t["en"]["Under construction..."] = "Under construction...";
|
||||
# $_t["es"]["Under construction..."] = "--> Traducción española aquí. <--";
|
||||
# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--";
|
||||
# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--";
|
||||
|
||||
?>
|
19
web/lang/submit_po.inc
Normal file
19
web/lang/submit_po.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?
|
||||
# INSTRUCTIONS TO TRANSLATORS
|
||||
#
|
||||
# This file contains the i18n translations for a subset of the
|
||||
# Arch Linux User-community Repository (AUR). This is a PHP
|
||||
# script, and as such, you MUST pay great attention to the syntax.
|
||||
# If your text contains any double-quotes ("), you MUST escape
|
||||
# them with the backslash character (\).
|
||||
#
|
||||
|
||||
include_once("translator.inc");
|
||||
global $_t;
|
||||
|
||||
$_t["en"]["Under construction..."] = "Under construction...";
|
||||
# $_t["es"]["Under construction..."] = "--> Traducción española aquí. <--";
|
||||
# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--";
|
||||
# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--";
|
||||
|
||||
?>
|
19
web/lang/template_po.inc
Normal file
19
web/lang/template_po.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?
|
||||
# INSTRUCTIONS TO TRANSLATORS
|
||||
#
|
||||
# This file contains the i18n translations for a subset of the
|
||||
# Arch Linux User-community Repository (AUR). This is a PHP
|
||||
# script, and as such, you MUST pay great attention to the syntax.
|
||||
# If your text contains any double-quotes ("), you MUST escape
|
||||
# them with the backslash character (\).
|
||||
#
|
||||
|
||||
include_once("translator.inc");
|
||||
global $_t;
|
||||
|
||||
$_t["en"]["Hi, this is worth reading!"] = "Hi, this is worth reading!";
|
||||
# $_t["es"]["Hi, this is worth reading!"] = "--> 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. <--";
|
||||
|
||||
?>
|
19
web/lang/vote_po.inc
Normal file
19
web/lang/vote_po.inc
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?
|
||||
# INSTRUCTIONS TO TRANSLATORS
|
||||
#
|
||||
# This file contains the i18n translations for a subset of the
|
||||
# Arch Linux User-community Repository (AUR). This is a PHP
|
||||
# script, and as such, you MUST pay great attention to the syntax.
|
||||
# If your text contains any double-quotes ("), you MUST escape
|
||||
# them with the backslash character (\).
|
||||
#
|
||||
|
||||
include_once("translator.inc");
|
||||
global $_t;
|
||||
|
||||
$_t["en"]["Under construction..."] = "Under construction...";
|
||||
# $_t["es"]["Under construction..."] = "--> Traducción española aquí. <--";
|
||||
# $_t["fr"]["Under construction..."] = "--> Traduction française ici. <--";
|
||||
# $_t["de"]["Under construction..."] = "--> Deutsche Übersetzung hier. <--";
|
||||
|
||||
?>
|
|
@ -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 " <td class='headerFill'>\n";
|
||||
print " <table width='100%'>\n";
|
||||
print " <tr>\n";
|
||||
print " <td class='headerDisplay'><a href='";
|
||||
print $_SERVER['PHP_SELF']."'>";
|
||||
print "<img src='/images/AUR-logo-80.png' border='0'></a></td>\n";
|
||||
print " <td class='headerDisplay'><a href='/index.php'>";
|
||||
|
||||
# XXX Can I scale a PNG like this?
|
||||
#
|
||||
print "<img src='/images/AUR-logo-80.png' width='85' height='45' border='0'></a></td>\n";
|
||||
print " <td class='headerDisplay' valign='top' align='right'>";
|
||||
print "<span class='fix'>ArchLinux User-community Repository</span></td>\n";
|
||||
print "<span class='preHeader'>ArchLinux User-community Repository</span><br/>";
|
||||
|
||||
# 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 "<a href='/index.php?setlang=en'><span class='sideBarSmallHeader'>English</span></a> ";
|
||||
print "<a href='/index.php?setlang=es'><span class='sideBarSmallHeader'>Español</span></a> ";
|
||||
print "<a href='/index.php?setlang=de'><span class='sideBarSmallHeader'>Deutsch</span></a> ";
|
||||
print "<a href='/index.php?setlang=fr'><span class='sideBarSmallHeader'>Français</span></a>";
|
||||
print " </td>\n";
|
||||
print " </tr>\n";
|
||||
print " </table>\n";
|
||||
print " </tr>\n";
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Add table
Reference in a new issue