From 58907e0bffb5a7d2d0bfc05cec28f366432bb3e8 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 22 Jun 2011 20:57:07 +0200 Subject: use php's gettext module Signed-off-by: Florian Pritz --- web/html/account.php | 24 +- web/html/addvote.php | 28 +- web/html/index.php | 16 +- web/html/packages.php | 8 +- web/html/passreset.php | 32 +-- web/html/pkgsubmit.php | 44 +-- web/html/tu.php | 22 +- web/lib/acctfuncs.inc.php | 124 ++++----- web/lib/aur.inc.php | 11 +- web/lib/gettext.php | 432 ----------------------------- web/lib/pkgfuncs.inc.php | 86 +++--- web/lib/translator.inc.php | 50 ---- web/template/actions_form.php | 20 +- web/template/header.php | 16 +- web/template/login_form.php | 14 +- web/template/pkg_comment_form.php | 8 +- web/template/pkg_comments.php | 6 +- web/template/pkg_details.php | 28 +- web/template/pkg_search_form.php | 30 +- web/template/pkg_search_results.php | 52 ++-- web/template/search_accounts_form.php | 36 +-- web/template/stats/general_stats_table.php | 18 +- web/template/stats/updates_table.php | 2 +- web/template/stats/user_table.php | 6 +- web/template/template.phps | 4 +- web/template/tu_details.php | 32 +-- web/template/tu_list.php | 20 +- 27 files changed, 344 insertions(+), 825 deletions(-) delete mode 100644 web/lib/gettext.php delete mode 100644 web/lib/translator.inc.php diff --git a/web/html/account.php b/web/html/account.php index ca05d1ac..fe1a45fc 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -8,12 +8,12 @@ include_once('acctfuncs.inc.php'); # access Account specific functions set_lang(); # this sets up the visitor's language check_sid(); # see if they're still logged in -html_header(__('Accounts')); +html_header(_('Accounts')); # Main page processing here # echo "
\n"; -echo "
".__("Accounts")."
\n"; +echo "
"._("Accounts")."
\n"; echo "
\n"; $action = in_request("Action"); @@ -38,7 +38,7 @@ if (isset($_COOKIE["AURSID"])) { } else { # a non-privileged user is trying to access the search page # - print __("You are not allowed to access this area.")."
\n"; + print _("You are not allowed to access this area.")."
\n"; } } elseif ($action == "DisplayAccount") { @@ -50,7 +50,7 @@ if (isset($_COOKIE["AURSID"])) { $q.= "AND Users.ID = ".intval(in_request("ID")); $result = db_query($q, $dbh); if (!mysql_num_rows($result)) { - print __("Could not retrieve information for the specified user."); + print _("Could not retrieve information for the specified user."); } else { $row = mysql_fetch_assoc($result); @@ -58,7 +58,7 @@ if (isset($_COOKIE["AURSID"])) { # double check to make sure logged in user can edit this account # if ($atype == "User" || ($atype == "Trusted User" && $row["AccountType"] == "Developer")) { - print __("You do not have permission to edit this account."); + print _("You do not have permission to edit this account."); } else { display_account_form($atype, "UpdateAccount", $row["Username"], @@ -77,7 +77,7 @@ if (isset($_COOKIE["AURSID"])) { $q.= "AND Users.ID = ".intval(in_request("ID")); $result = db_query($q, $dbh); if (!mysql_num_rows($result)) { - print __("Could not retrieve information for the specified user."); + print _("Could not retrieve information for the specified user."); } else { $row = mysql_fetch_assoc($result); display_account_info($row["Username"], @@ -99,7 +99,7 @@ if (isset($_COOKIE["AURSID"])) { if ($atype == "Trusted User" || $atype == "Developer") { # display the search page if they're a TU/dev # - print __("Use this form to search existing accounts.")."
\n"; + print _("Use this form to search existing accounts.")."
\n"; search_accounts_form(); } else { @@ -114,16 +114,16 @@ if (isset($_COOKIE["AURSID"])) { $q.= mysql_real_escape_string($_COOKIE["AURSID"])."'"; $result = db_query($q, $dbh); if (!mysql_num_rows($result)) { - print __("Could not retrieve information for the specified user."); + print _("Could not retrieve information for the specified user."); } else { $row = mysql_fetch_assoc($result); # don't need to check if they have permissions, this is a # normal user editing themselves. # - print __("Use this form to update your account."); + print _("Use this form to update your account."); print "
"; - print __("Leave the password fields blank to keep your same password."); + print _("Leave the password fields blank to keep your same password."); display_account_form($atype, "UpdateAccount", $row["Username"], $row["AccountType"], $row["Suspended"], $row["Email"], "", "", $row["RealName"], $row["LangPreference"], @@ -136,7 +136,7 @@ if (isset($_COOKIE["AURSID"])) { # visitor is not logged in # if ($action == "AccountInfo") { - print __("You must log in to view user information."); + print _("You must log in to view user information."); } elseif ($action == "NewAccount") { # process the form input for creating a new account # @@ -148,7 +148,7 @@ if (isset($_COOKIE["AURSID"])) { } else { # display the account request form # - print __("Use this form to create an account."); + print _("Use this form to create an account."); display_account_form("", "NewAccount"); } } diff --git a/web/html/addvote.php b/web/html/addvote.php index fe3037d5..bde0f19d 100644 --- a/web/html/addvote.php +++ b/web/html/addvote.php @@ -30,7 +30,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } if ($check == 0) { - $error.= __("Username does not exist."); + $error.= _("Username does not exist."); } else { $qcheck = "SELECT * FROM TU_VoteInfo WHERE User = '" . mysql_real_escape_string($_POST['user']) . "'"; $qcheck.= " AND End > UNIX_TIMESTAMP()"; @@ -43,16 +43,16 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } if ($check != 0) { - $error.= __("%s already has proposal running for them.", htmlentities($_POST['user'])); + $error.= sprintf(_("%s already has proposal running for them."), htmlentities($_POST['user'])); } } } if (!empty($_POST['length'])) { if (!is_numeric($_POST['length'])) { - $error.= __("Length must be a number.") ; + $error.= _("Length must be a number.") ; } else if ($_POST['length'] < 1) { - $error.= __("Length must be at least 1."); + $error.= _("Length must be at least 1."); } else { $len = (60*60*24)*$_POST['length']; } @@ -61,7 +61,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } if (empty($_POST['agenda'])) { - $error.= __("Proposal cannot be empty."); + $error.= _("Proposal cannot be empty."); } } @@ -73,7 +73,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $q.= ", " . uid_from_sid($_COOKIE["AURSID"]) . ")"; db_query($q, $dbh); - print "

" . __("New proposal submitted.") . "

\n"; + print "

" . _("New proposal submitted.") . "

\n"; } else { ?> @@ -82,24 +82,24 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
-
+

- + ' /> - +

- + ' /> - +

-
+

-' /> +' />

@@ -107,7 +107,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
-AUR +AUR

', '', @@ -36,7 +36,7 @@ echo __(
', '', '', @@ -46,9 +46,9 @@ echo __(

- +
- +

@@ -72,8 +72,8 @@ general_stats_table($dbh);
'; -echo __('Unsupported packages are user produced content. Any use of the provided files is at your own risk.'); +echo _('DISCLAIMER') . ':
'; +echo _('Unsupported packages are user produced content. Any use of the provided files is at your own risk.'); ?>
diff --git a/web/html/packages.php b/web/html/packages.php index 4a1fa881..26fe84be 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -11,9 +11,9 @@ check_sid(); # see if they're still logged in if (isset($_GET['ID']) && ($pkgname = pkgname_from_id($_GET['ID']))) { $title = $pkgname; } else if (!empty($_GET['K'])) { - $title = __("Search Criteria") . ": " . $_GET['K']; + $title = _("Search Criteria") . ": " . $_GET['K']; } else { - $title = __("Packages"); + $title = _("Packages"); } # Retrieve account type @@ -54,7 +54,7 @@ if (current_action("do_Flag")) { unset($_GET['ID']); } else { - $output = __("The selected packages have not been deleted, check the confirmation checkbox."); + $output = _("The selected packages have not been deleted, check the confirmation checkbox."); } } elseif (current_action("do_Notify")) { $output = pkg_notify($atype, $ids); @@ -77,7 +77,7 @@ html_header($title); if (isset($_GET['ID'])) { include('pkg_search_form.php'); if (!$_GET['ID'] = intval($_GET['ID'])) { - print __("Error trying to retrieve package details.")."
\n"; + print _("Error trying to retrieve package details.")."
\n"; } else { if (isset($_COOKIE["AURSID"])) { package_details($_GET['ID'], $_COOKIE["AURSID"]); diff --git a/web/html/passreset.php b/web/html/passreset.php index ed5d4d31..90878319 100644 --- a/web/html/passreset.php +++ b/web/html/passreset.php @@ -22,11 +22,11 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir $uid = uid_from_email($email); if (empty($email) || empty($password)) { - $error = __('Missing a required field.'); + $error = _('Missing a required field.'); } elseif ($password != $confirm) { - $error = __('Password fields do not match.'); + $error = _('Password fields do not match.'); } elseif ($uid == NULL || $uid == 'None') { - $error = __('Invalid e-mail.'); + $error = _('Invalid e-mail.'); } if (empty($error)) { @@ -44,7 +44,7 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir AND Email = '".mysql_real_escape_string($email)."'"; $result = db_query($q, $dbh); if (!mysql_affected_rows($dbh)) { - $error = __('Invalid e-mail and reset key combination.'); + $error = _('Invalid e-mail and reset key combination.'); } else { header('Location: passreset.php?step=complete'); exit(); @@ -62,7 +62,7 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir WHERE ID = " . $uid; db_query($q, $dbh); # Send email with confirmation link - $body = __('A password reset request was submitted for the account '. + $body = _('A password reset request was submitted for the account '. 'associated with your e-mail address. If you wish to reset '. 'your password follow the link below, otherwise ignore '. 'this message and nothing will happen.'). @@ -80,13 +80,13 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir $step = isset($_GET['step']) ? $_GET['step'] : NULL; -html_header(__("Password Reset")); +html_header(_("Password Reset")); ?>
- +
- + - + - +

- + -

', ''); ?>

-

+

- +
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index b5fe3b7e..5a83c215 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -29,7 +29,7 @@ if ($uid): # Before processing, make sure we even have a file if ($_FILES['pfile']['size'] == 0){ - $error = __("Error - No file uploaded"); + $error = _("Error - No file uploaded"); } # Check whether the file is gzip'ed @@ -39,7 +39,7 @@ if ($uid): list(, $magic) = unpack('v', fread($fh, 2)); if ($magic != 0x8b1f) { - $error = __("Error - unsupported file format (please submit gzip'ed tarballs generated by makepkg(8) only)."); + $error = _("Error - unsupported file format (please submit gzip'ed tarballs generated by makepkg(8) only)."); } } @@ -49,7 +49,7 @@ if ($uid): list(, $filesize_uncompressed) = unpack('V', fread($fh, 4)); if ($filesize_uncompressed > $MAX_FILESIZE_UNCOMPRESSED) { - $error = __("Error - uncompressed file size too large."); + $error = _("Error - uncompressed file size too large."); } } @@ -70,22 +70,22 @@ if ($uid): } elseif (preg_match('/^[^\/]+\/$/', $tar_file['filename'])) { if (++$dircount > 1) { - $error = __("Error - source tarball may not contain more than one directory."); + $error = _("Error - source tarball may not contain more than one directory."); break; } } elseif (preg_match('/^[^\/]+$/', $tar_file['filename'])) { - $error = __("Error - source tarball may not contain files outside a directory."); + $error = _("Error - source tarball may not contain files outside a directory."); break; } elseif (preg_match('/^[^\/]+\/[^\/]+\//', $tar_file['filename'])) { - $error = __("Error - source tarball may not contain nested subdirectories."); + $error = _("Error - source tarball may not contain nested subdirectories."); break; } } if (!$error && empty($pkgbuild_raw)) { - $error = __("Error trying to unpack upload - PKGBUILD does not exist."); + $error = _("Error trying to unpack upload - PKGBUILD does not exist."); } } @@ -179,7 +179,7 @@ if ($uid): $req_vars = array("url", "pkgdesc", "license", "pkgrel", "pkgver", "arch", "pkgname"); foreach ($req_vars as $var) { if (!array_key_exists($var, $pkgbuild)) { - $error = __('Missing %s variable in PKGBUILD.', $var); + $error = sprintf(_('Missing %s variable in PKGBUILD.', $var); break; } } @@ -195,7 +195,7 @@ if ($uid): if (!$error) { $parsed_url = parse_url($pkgbuild['url']); if (!$parsed_url['scheme']) { - $error = __("Package URL is missing a protocol (ie. http:// ,ftp://)"); + $error = _("Package URL is missing a protocol (ie. http:// ,ftp://)"); } } @@ -251,7 +251,7 @@ if ($uid): $presult = preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/", $pkg_name); if (!$presult) { - $error = __("Invalid name: only lowercase letters are allowed."); + $error = _("Invalid name: only lowercase letters are allowed."); } } @@ -269,17 +269,17 @@ if ($uid): } if (!@mkdir($incoming_pkgdir)) { - $error = __( "Could not create directory %s.", $incoming_pkgdir); + $error = sprintf(_( "Could not create directory %s."), $incoming_pkgdir); } } else { - $error = __( "You are not allowed to overwrite the %h%s%h package.", "", $pkg_name, ""); + $error = sprintf(_( "You are not allowed to overwrite the %h%s%h package."), "", $pkg_name, ""); } if (!$error) { # Check if package name is blacklisted. if (!$pkg_exists && pkgname_is_blacklisted($pkg_name)) { if (!canSubmitBlacklisted(account_from_sid($_COOKIE["AURSID"]))) { - $error = __( "%s is on the package blacklist, please check if it's available in the official repos.", $pkg_name); + $error = sprintf(_( "%s is on the package blacklist, please check if it's available in the official repos."), $pkg_name); } } } @@ -287,7 +287,7 @@ if ($uid): if (!$error) { if (!@chdir($incoming_pkgdir)) { - $error = __("Could not change directory to %s.", $incoming_pkgdir); + $error = sprintf(_("Could not change directory to %s."), $incoming_pkgdir); } file_put_contents('PKGBUILD', $pkgbuild_raw); @@ -407,10 +407,10 @@ html_header("Submit");
- +
-

+

- + - +
::
::
- +
@@ -457,7 +457,7 @@ html_header("Submit");
@@ -467,7 +467,7 @@ html_header("Submit"); endif; else: # Visitor is not logged in - print __("You must create an account before you can upload packages."); + print _("You must create an account before you can upload packages."); exit(); ?> diff --git a/web/html/tu.php b/web/html/tu.php index 6e202c80..c16ca5e6 100644 --- a/web/html/tu.php +++ b/web/html/tu.php @@ -29,7 +29,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $row = mysql_fetch_assoc($results); if (empty($row)) { - print __("Could not retrieve proposal details."); + print _("Could not retrieve proposal details."); } else { $isrunning = $row['End'] > time() ? 1 : 0; @@ -62,13 +62,13 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $errorvote = ""; if ($isrunning == 0) { $canvote = 0; - $errorvote = __("Voting is closed for this proposal."); + $errorvote = _("Voting is closed for this proposal."); } else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) { $canvote = 0; - $errorvote = __("You cannot vote in an proposal about you."); + $errorvote = _("You cannot vote in an proposal about you."); } else if ($hasvoted != 0) { $canvote = 0; - $errorvote = __("You've already voted for this proposal."); + $errorvote = _("You've already voted for this proposal."); } if ($canvote == 1) { @@ -89,7 +89,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { # Can't vote anymore # $canvote = 0; - $errorvote = __("You've already voted for this proposal."); + $errorvote = _("You've already voted for this proposal."); # Update if they voted $result = db_query($qvoted, $dbh); if ($result) { @@ -105,7 +105,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { include("tu_details.php"); } } else { - print __("Vote ID not valid."); + print _("Vote ID not valid."); } } else { @@ -137,7 +137,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $q = "SELECT * FROM TU_VoteInfo WHERE End > " . time() . " ORDER BY Submitted " . $order; $result = db_query($q, $dbh); - $type = __("Current Votes"); + $type = _("Current Votes"); include("tu_list.php"); ?> @@ -145,21 +145,21 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $q = "SELECT * FROM TU_VoteInfo WHERE End < " . time() . " ORDER BY Submitted " . $order . $lim; $result = db_query($q, $dbh); - $type = __("Past Votes"); + $type = _("Past Votes"); include("tu_list.php"); $qnext = "SELECT ID FROM TU_VoteInfo"; $nextresult = db_query($qnext, $dbh); ?>
-

+

- + - +
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index b2f0548e..3bdd8d0c 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -39,34 +39,34 @@ function display_account_form($UTYPE,$A,$U="",$T="",$S="", print " \n"; print ""; - print "".__("Username").":"; + print ""._("Username").":"; print " (".__("required").")"; + print " name='U' value='".htmlspecialchars($U,ENT_QUOTES)."' /> ("._("required").")"; print "\n"; # Only TUs or Devs can promote/demote/suspend a user if ($UTYPE == "Trusted User" || $UTYPE == "Developer") { print ""; - print "".__("Account Type").":"; + print ""._("Account Type").":"; print ""; print "\n"; print ""; - print "".__("Account Suspended").":"; + print ""._("Account Suspended").":"; print ""; @@ -77,43 +77,43 @@ function display_account_form($UTYPE,$A,$U="",$T="",$S="", } print ""; - print "".__("Email Address").":"; + print ""._("Email Address").":"; print " (".__("required").")"; + print " name='E' value='".htmlspecialchars($E,ENT_QUOTES)."' /> ("._("required").")"; print "\n"; print ""; - print "".__("Password").":"; + print ""._("Password").":"; print ""; if ($A != "UpdateAccount") { - print " (".__("required").")"; + print " ("._("required").")"; } print "\n"; print ""; - print "".__("Re-type password").":"; + print ""._("Re-type password").":"; print ""; if ($A != "UpdateAccount") { - print " (".__("required").")"; + print " ("._("required").")"; } print "\n"; print ""; - print "".__("Real Name").":"; + print ""._("Real Name").":"; print ""; print "\n"; print ""; - print "".__("IRC Nick").":"; + print ""._("IRC Nick").":"; print ""; print "\n"; print ""; - print "".__("Language").":"; + print ""._("Language").":"; print "   "; + print " value='"._("Update")."' />   "; } else { print "   "; + print " value='"._("Create")."' />   "; } - print ""; + print ""; print ""; print "\n"; @@ -181,44 +181,44 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="", $dbh = db_connect(); $error = ""; if (empty($E) || empty($U)) { - $error = __("Missing a required field."); + $error = _("Missing a required field."); } if ($TYPE == "new") { # they need password fields for this type of action # if (empty($P) || empty($C)) { - $error = __("Missing a required field."); + $error = _("Missing a required field."); } } else { if (!$UID) { - $error = __("Missing User ID"); + $error = _("Missing User ID"); } } if (!$error && !valid_username($U) && !user_is_privileged($editor_user)) - $error = __("The username is invalid.") . "
    \n" - ."
  • " . __("It must be between %s and %s characters long", + $error = _("The username is invalid.") . "
      \n" + ."
    • " . _("It must be between %s and %s characters long", USERNAME_MIN_LEN, USERNAME_MAX_LEN ) . "
    • " - . "
    • " . __("Start and end with a letter or number") . "
    • " - . "
    • " . __("Can contain only one period, underscore or hyphen.") + . "
    • " . _("Start and end with a letter or number") . "
    • " + . "
    • " . _("Can contain only one period, underscore or hyphen.") . "
    • \n
    "; if (!$error && $P && $C && ($P != $C)) { - $error = __("Password fields do not match."); + $error = _("Password fields do not match."); } if (!$error && $P != '' && !good_passwd($P)) - $error = __("Your password must be at least %s characters.",PASSWD_MIN_LEN); + $error = _("Your password must be at least %s characters.",PASSWD_MIN_LEN); if (!$error && !valid_email($E)) { - $error = __("The email address is invalid."); + $error = _("The email address is invalid."); } if ($UTYPE == "Trusted User" && $T == 3) { - $error = __("A Trusted User cannot assign Developer status."); + $error = _("A Trusted User cannot assign Developer status."); } if (!$error && !array_key_exists($L, $SUPPORTED_LANGS)) { - $error = __("Language is not currently supported."); + $error = _("Language is not currently supported."); } if (!$error) { # check to see if this username is available @@ -233,7 +233,7 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="", if ($result) { $row = mysql_fetch_array($result); if ($row[0]) { - $error = __("The username, %h%s%h, is already in use.", + $error = _("The username, %h%s%h, is already in use.", "", htmlspecialchars($U,ENT_QUOTES), ""); } } @@ -251,7 +251,7 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="", if ($result) { $row = mysql_fetch_array($result); if ($row[0]) { - $error = __("The address, %h%s%h, is already in use.", + $error = _("The address, %h%s%h, is already in use.", "", htmlspecialchars($E,ENT_QUOTES), ""); } } @@ -273,15 +273,15 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="", "VALUES (1, 0, '" . implode("', '", $escaped) . "')"; $result = db_query($q, $dbh); if (!$result) { - print __("Error trying to create account, %h%s%h: %s.", + print _("Error trying to create account, %h%s%h: %s.", "", htmlspecialchars($U,ENT_QUOTES), "", mysql_error($dbh)); } else { # account created/modified, tell them so. # - print __("The account, %h%s%h, has been successfully created.", + print _("The account, %h%s%h, has been successfully created.", "", htmlspecialchars($U,ENT_QUOTES), ""); print "

    \n"; - print __("Click on the Home link above to login."); + print _("Click on the Home link above to login."); print "

    \n"; } @@ -310,10 +310,10 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="", $q.= " WHERE ID = ".intval($UID); $result = db_query($q, $dbh); if (!$result) { - print __("Error trying to modify account, %h%s%h: %s.", + print _("Error trying to modify account, %h%s%h: %s.", "", htmlspecialchars($U,ENT_QUOTES), "", mysql_error($dbh)); } else { - print __("The account, %h%s%h, has been successfully modified.", + print _("The account, %h%s%h, has been successfully modified.", "", htmlspecialchars($U,ENT_QUOTES), ""); } } @@ -411,7 +411,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", $result = db_query($q, $dbh); if (!$result) { - print __("No results matched your search criteria."); + print _("No results matched your search criteria."); } else { $num_rows = mysql_num_rows($result); if ($num_rows) { @@ -424,19 +424,19 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", print " cellspacing='0' width='100%'>\n"; print ""; print ""; - print "".__("Username").""; + print ""._("Username").""; print ""; - print "".__("Type").""; + print ""._("Type").""; print ""; - print "".__("Status").""; + print ""._("Status").""; print ""; - print "".__("Real Name").""; + print ""._("Real Name").""; print ""; - print "".__("IRC Nick").""; + print ""._("IRC Nick").""; print ""; - print "".__("Last Voted").""; + print ""._("Last Voted").""; print ""; - print "".__("Edit Account").""; + print ""._("Edit Account").""; print "\n"; $i = 0; while ($row = mysql_fetch_assoc($result)) { @@ -453,9 +453,9 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", print ""; print ""; if ($row["Suspended"]) { - print __("Suspended"); + print _("Suspended"); } else { - print __("Active"); + print _("Active"); } print ""; print ""; @@ -467,7 +467,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", print ""; $row["LastVoted"] ? print date("Ymd", $row["LastVoted"]) - : print __("Never"); + : print _("Never"); print ""; print ""; if ($UTYPE == "Trusted User" && $row["AccountType"] == "Developer") { @@ -498,7 +498,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", print " value='".${$ind}."' />\n"; } print ""; + print " value='<-- "._("Less")."' />"; print ""; print "\n"; print ""; @@ -514,7 +514,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", print " value='".${$ind}."' />\n"; } print ""; + print " value='"._("More")." -->' />"; print ""; print "\n"; print ""; @@ -522,7 +522,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="", print "\n"; } else { print "

    \n"; - print __("No more results to display."); + print _("No more results to display."); print "

    \n"; } } @@ -546,40 +546,40 @@ function display_account_info($U="", $T="", $E="", $R="", $I="") { print " \n"; print " \n"; - print " ".__("Username").":\n"; + print " "._("Username").":\n"; print " ".$U."\n"; print " \n"; print " \n"; - print " ".__("Account Type").":\n"; + print " "._("Account Type").":\n"; print " "; if ($T == "User") { - print __("User"); + print _("User"); } elseif ($T == "Trusted User") { - print __("Trusted User"); + print _("Trusted User"); } elseif ($T == "Developer") { - print __("Developer"); + print _("Developer"); } print " \n"; print " \n"; print " \n"; - print " ".__("Email Address").":\n"; + print " "._("Email Address").":\n"; print " ".htmlspecialchars($E,ENT_QUOTES)."\n"; print " \n"; print " \n"; - print " ".__("Real Name").":\n"; + print " "._("Real Name").":\n"; print " ".htmlspecialchars($R,ENT_QUOTES)."\n"; print " \n"; print " \n"; - print " ".__("IRC Nick").":\n"; + print " "._("IRC Nick").":\n"; print " ".htmlspecialchars($I,ENT_QUOTES)."\n"; print " \n"; print " \n"; - print " ".__("View this user's packages")."\n"; + print " "._("View this user's packages")."\n"; print " \n"; print "\n"; @@ -668,7 +668,7 @@ function try_login() { } } else { - $login_error = __("Bad username or password."); + $login_error = _("Bad username or password."); } } return array('SID' => $new_sid, 'error' => $login_error); diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index 382578c0..8b5787bd 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -7,10 +7,10 @@ header('Pragma: no-cache'); date_default_timezone_set('UTC'); -include_once('translator.inc.php'); +include_once("config.inc.php"); + set_lang(); -include_once("config.inc.php"); include_once("version.inc.php"); include_once("acctfuncs.inc.php"); include_once("cachefuncs.inc.php"); @@ -295,9 +295,10 @@ function set_lang() { setcookie("AURLANG", $LANG, $cookie_time, "/"); } - $streamer = new FileReader('../locale/' . $LANG . - '/LC_MESSAGES/aur.mo'); - $l10n = new gettext_reader($streamer, true); + var_dump(setlocale(LC_MESSAGES, $LANG.".UTF-8")); + bindtextdomain("aur", '../locale'); + textdomain("aur"); + bind_textdomain_codeset("aur", 'UTF-8'); return; } diff --git a/web/lib/gettext.php b/web/lib/gettext.php deleted file mode 100644 index 5064047c..00000000 --- a/web/lib/gettext.php +++ /dev/null @@ -1,432 +0,0 @@ -. - Copyright (c) 2005 Nico Kaiser - - This file is part of PHP-gettext. - - PHP-gettext 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; either version 2 of the License, or - (at your option) any later version. - - PHP-gettext 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 PHP-gettext; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -/** - * Provides a simple gettext replacement that works independently from - * the system's gettext abilities. - * It can read MO files and use them for translating strings. - * The files are passed to gettext_reader as a Stream (see streams.php) - * - * This version has the ability to cache all strings and translations to - * speed up the string lookup. - * While the cache is enabled by default, it can be switched off with the - * second parameter in the constructor (e.g. whenusing very large MO files - * that you don't want to keep in memory) - */ -class gettext_reader { - //public: - var $error = 0; // public variable that holds error code (0 if no error) - - //private: - var $BYTEORDER = 0; // 0: low endian, 1: big endian - var $STREAM = NULL; - var $short_circuit = false; - var $enable_cache = false; - var $originals = NULL; // offset of original table - var $translations = NULL; // offset of translation table - var $pluralheader = NULL; // cache header field for plural forms - var $total = 0; // total string count - var $table_originals = NULL; // table for original strings (offsets) - var $table_translations = NULL; // table for translated strings (offsets) - var $cache_translations = NULL; // original -> translation mapping - - - /* Methods */ - - - /** - * Reads a 32bit Integer from the Stream - * - * @access private - * @return Integer from the Stream - */ - function readint() { - if ($this->BYTEORDER == 0) { - // low endian - $input=unpack('V', $this->STREAM->read(4)); - return array_shift($input); - } else { - // big endian - $input=unpack('N', $this->STREAM->read(4)); - return array_shift($input); - } - } - - function read($bytes) { - return $this->STREAM->read($bytes); - } - - /** - * Reads an array of Integers from the Stream - * - * @param int count How many elements should be read - * @return Array of Integers - */ - function readintarray($count) { - if ($this->BYTEORDER == 0) { - // low endian - return unpack('V'.$count, $this->STREAM->read(4 * $count)); - } else { - // big endian - return unpack('N'.$count, $this->STREAM->read(4 * $count)); - } - } - - /** - * Constructor - * - * @param object Reader the StreamReader object - * @param boolean enable_cache Enable or disable caching of strings (default on) - */ - function gettext_reader($Reader, $enable_cache = true) { - // If there isn't a StreamReader, turn on short circuit mode. - if (! $Reader || isset($Reader->error) ) { - $this->short_circuit = true; - return; - } - - // Caching can be turned off - $this->enable_cache = $enable_cache; - - $MAGIC1 = "\x95\x04\x12\xde"; - $MAGIC2 = "\xde\x12\x04\x95"; - - $this->STREAM = $Reader; - $magic = $this->read(4); - if ($magic == $MAGIC1) { - $this->BYTEORDER = 1; - } elseif ($magic == $MAGIC2) { - $this->BYTEORDER = 0; - } else { - $this->error = 1; // not MO file - return false; - } - - // FIXME: Do we care about revision? We should. - $revision = $this->readint(); - - $this->total = $this->readint(); - $this->originals = $this->readint(); - $this->translations = $this->readint(); - } - - /** - * Loads the translation tables from the MO file into the cache - * If caching is enabled, also loads all strings into a cache - * to speed up translation lookups - * - * @access private - */ - function load_tables() { - if (is_array($this->cache_translations) && - is_array($this->table_originals) && - is_array($this->table_translations)) - return; - - /* get original and translations tables */ - if (!is_array($this->table_originals)) { - $this->STREAM->seekto($this->originals); - $this->table_originals = $this->readintarray($this->total * 2); - } - if (!is_array($this->table_translations)) { - $this->STREAM->seekto($this->translations); - $this->table_translations = $this->readintarray($this->total * 2); - } - - if ($this->enable_cache) { - $this->cache_translations = array (); - /* read all strings in the cache */ - for ($i = 0; $i < $this->total; $i++) { - $this->STREAM->seekto($this->table_originals[$i * 2 + 2]); - $original = $this->STREAM->read($this->table_originals[$i * 2 + 1]); - $this->STREAM->seekto($this->table_translations[$i * 2 + 2]); - $translation = $this->STREAM->read($this->table_translations[$i * 2 + 1]); - $this->cache_translations[$original] = $translation; - } - } - } - - /** - * Returns a string from the "originals" table - * - * @access private - * @param int num Offset number of original string - * @return string Requested string if found, otherwise '' - */ - function get_original_string($num) { - $length = $this->table_originals[$num * 2 + 1]; - $offset = $this->table_originals[$num * 2 + 2]; - if (! $length) - return ''; - $this->STREAM->seekto($offset); - $data = $this->STREAM->read($length); - return (string)$data; - } - - /** - * Returns a string from the "translations" table - * - * @access private - * @param int num Offset number of original string - * @return string Requested string if found, otherwise '' - */ - function get_translation_string($num) { - $length = $this->table_translations[$num * 2 + 1]; - $offset = $this->table_translations[$num * 2 + 2]; - if (! $length) - return ''; - $this->STREAM->seekto($offset); - $data = $this->STREAM->read($length); - return (string)$data; - } - - /** - * Binary search for string - * - * @access private - * @param string string - * @param int start (internally used in recursive function) - * @param int end (internally used in recursive function) - * @return int string number (offset in originals table) - */ - function find_string($string, $start = -1, $end = -1) { - if (($start == -1) or ($end == -1)) { - // find_string is called with only one parameter, set start end end - $start = 0; - $end = $this->total; - } - if (abs($start - $end) <= 1) { - // We're done, now we either found the string, or it doesn't exist - $txt = $this->get_original_string($start); - if ($string == $txt) - return $start; - else - return -1; - } else if ($start > $end) { - // start > end -> turn around and start over - return $this->find_string($string, $end, $start); - } else { - // Divide table in two parts - $half = (int)(($start + $end) / 2); - $cmp = strcmp($string, $this->get_original_string($half)); - if ($cmp == 0) - // string is exactly in the middle => return it - return $half; - else if ($cmp < 0) - // The string is in the upper half - return $this->find_string($string, $start, $half); - else - // The string is in the lower half - return $this->find_string($string, $half, $end); - } - } - - /** - * Translates a string - * - * @access public - * @param string string to be translated - * @return string translated string (or original, if not found) - */ - function translate($string) { - if ($this->short_circuit) - return $string; - $this->load_tables(); - - if ($this->enable_cache) { - // Caching enabled, get translated string from cache - if (array_key_exists($string, $this->cache_translations)) - return $this->cache_translations[$string]; - else - return $string; - } else { - // Caching not enabled, try to find string - $num = $this->find_string($string); - if ($num == -1) - return $string; - else - return $this->get_translation_string($num); - } - } - - /** - * Sanitize plural form expression for use in PHP eval call. - * - * @access private - * @return string sanitized plural form expression - */ - function sanitize_plural_expression($expr) { - // Get rid of disallowed characters. - $expr = preg_replace('@[^a-zA-Z0-9_:;\(\)\?\|\&=!<>+*/\%-]@', '', $expr); - - // Add parenthesis for tertiary '?' operator. - $expr .= ';'; - $res = ''; - $p = 0; - for ($i = 0; $i < strlen($expr); $i++) { - $ch = $expr[$i]; - switch ($ch) { - case '?': - $res .= ' ? ('; - $p++; - break; - case ':': - $res .= ') : ('; - break; - case ';': - $res .= str_repeat( ')', $p) . ';'; - $p = 0; - break; - default: - $res .= $ch; - } - } - return $res; - } - - /** - * Parse full PO header and extract only plural forms line. - * - * @access private - * @return string verbatim plural form header field - */ - function extract_plural_forms_header_from_po_header($header) { - if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs)) - $expr = $regs[2]; - else - $expr = "nplurals=2; plural=n == 1 ? 0 : 1;"; - return $expr; - } - - /** - * Get possible plural forms from MO header - * - * @access private - * @return string plural form header - */ - function get_plural_forms() { - // lets assume message number 0 is header - // this is true, right? - $this->load_tables(); - - // cache header field for plural forms - if (! is_string($this->pluralheader)) { - if ($this->enable_cache) { - $header = $this->cache_translations[""]; - } else { - $header = $this->get_translation_string(0); - } - $expr = $this->extract_plural_forms_header_from_po_header($header); - $this->pluralheader = $this->sanitize_plural_expression($expr); - } - return $this->pluralheader; - } - - /** - * Detects which plural form to take - * - * @access private - * @param n count - * @return int array index of the right plural form - */ - function select_string($n) { - $string = $this->get_plural_forms(); - $string = str_replace('nplurals',"\$total",$string); - $string = str_replace("n",$n,$string); - $string = str_replace('plural',"\$plural",$string); - - $total = 0; - $plural = 0; - - eval("$string"); - if ($plural >= $total) $plural = $total - 1; - return $plural; - } - - /** - * Plural version of gettext - * - * @access public - * @param string single - * @param string plural - * @param string number - * @return translated plural form - */ - function ngettext($single, $plural, $number) { - if ($this->short_circuit) { - if ($number != 1) - return $plural; - else - return $single; - } - - // find out the appropriate form - $select = $this->select_string($number); - - // this should contains all strings separated by NULLs - $key = $single . chr(0) . $plural; - - - if ($this->enable_cache) { - if (! array_key_exists($key, $this->cache_translations)) { - return ($number != 1) ? $plural : $single; - } else { - $result = $this->cache_translations[$key]; - $list = explode(chr(0), $result); - return $list[$select]; - } - } else { - $num = $this->find_string($key); - if ($num == -1) { - return ($number != 1) ? $plural : $single; - } else { - $result = $this->get_translation_string($num); - $list = explode(chr(0), $result); - return $list[$select]; - } - } - } - - function pgettext($context, $msgid) { - $key = $context . chr(4) . $msgid; - $ret = $this->translate($key); - if (strpos($ret, "\004") !== FALSE) { - return $msgid; - } else { - return $ret; - } - } - - function npgettext($context, $singular, $plural, $number) { - $key = $context . chr(4) . $singular; - $ret = $this->ngettext($key, $plural, $number); - if (strpos($ret, "\004") !== FALSE) { - return $singular; - } else { - return $ret; - } - - } -} - -?> diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 46768f2b..3bf0c7bc 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -288,12 +288,12 @@ function package_details($id=0, $SID="") { $results = db_query($q, $dbh); if (!$results) { - print __("Error retrieving package details.") . "
    \n"; + print _("Error retrieving package details.") . "
    \n"; } else { $row = mysql_fetch_assoc($results); if (empty($row)) { - print __("Package details could not be found.") . "
    \n"; + print _("Package details could not be found.") . "
    \n"; } else { @@ -540,8 +540,8 @@ function pkg_search_page($SID="") { $templ_pages = array(); if ($current > 1) { - $templ_pages[__('First')] = 0; - $templ_pages[__('Previous')] = ($current - 2) * $per_page; + $templ_pages[_('First')] = 0; + $templ_pages[_('Previous')] = ($current - 2) * $per_page; } if ($current - 5 > 1) @@ -555,8 +555,8 @@ function pkg_search_page($SID="") { $templ_pages["... "] = false; if ($current < $pages) { - $templ_pages[__('Next')] = $current * $per_page; - $templ_pages[__('Last')] = ($pages - 1) * $per_page; + $templ_pages[_('Next')] = $current * $per_page; + $templ_pages[_('Last')] = ($pages - 1) * $per_page; } include('pkg_search_form.php'); @@ -597,18 +597,18 @@ function sanitize_ids($ids) { function pkg_flag ($atype, $ids, $action = True) { if (!$atype) { if ($action) { - return __("You must be logged in before you can flag packages."); + return _("You must be logged in before you can flag packages."); } else { - return __("You must be logged in before you can unflag packages."); + return _("You must be logged in before you can unflag packages."); } } $ids = sanitize_ids($ids); if (empty($ids)) { if ($action) { - return __("You did not select any packages to flag."); + return _("You did not select any packages to flag."); } else { - return __("You did not select any packages to unflag."); + return _("You did not select any packages to unflag."); } } @@ -648,9 +648,9 @@ function pkg_flag ($atype, $ids, $action = True) { } if ($action) { - return __("The selected packages have been flagged out-of-date."); + return _("The selected packages have been flagged out-of-date."); } else { - return __("The selected packages have been unflagged."); + return _("The selected packages have been unflagged."); } } @@ -664,24 +664,24 @@ function pkg_flag ($atype, $ids, $action = True) { */ function pkg_delete ($atype, $ids) { if (!$atype) { - return __("You must be logged in before you can delete packages."); + return _("You must be logged in before you can delete packages."); } # If they're a TU or dev, can delete if ($atype != "Trusted User" && $atype != "Developer") { - return __("You do have permission to delete packages."); + return _("You do have permission to delete packages."); } $ids = sanitize_ids($ids); if (empty($ids)) { - return __("You did not select any packages to delete."); + return _("You did not select any packages to delete."); } $dbh = db_connect(); $q = "DELETE FROM Packages WHERE ID IN (" . implode(",", $ids) . ")"; $result = db_query($q, $dbh); - return __("The selected packages have been deleted."); + return _("The selected packages have been deleted."); } /** @@ -696,18 +696,18 @@ function pkg_delete ($atype, $ids) { function pkg_adopt ($atype, $ids, $action = True) { if (!$atype) { if ($action) { - return __("You must be logged in before you can adopt packages."); + return _("You must be logged in before you can adopt packages."); } else { - return __("You must be logged in before you can disown packages."); + return _("You must be logged in before you can disown packages."); } } $ids = sanitize_ids($ids); if (empty($ids)) { if ($action) { - return __("You did not select any packages to adopt."); + return _("You did not select any packages to adopt."); } else { - return __("You did not select any packages to disown."); + return _("You did not select any packages to disown."); } } @@ -736,9 +736,9 @@ function pkg_adopt ($atype, $ids, $action = True) { if ($action) { pkg_notify(account_from_sid($_COOKIE["AURSID"]), $ids); - return __("The selected packages have been adopted."); + return _("The selected packages have been adopted."); } else { - return __("The selected packages have been disowned."); + return _("The selected packages have been disowned."); } } @@ -754,18 +754,18 @@ function pkg_adopt ($atype, $ids, $action = True) { function pkg_vote ($atype, $ids, $action = True) { if (!$atype) { if ($action) { - return __("You must be logged in before you can vote for packages."); + return _("You must be logged in before you can vote for packages."); } else { - return __("You must be logged in before you can un-vote for packages."); + return _("You must be logged in before you can un-vote for packages."); } } $ids = sanitize_ids($ids); if (empty($ids)) { if ($action) { - return __("You did not select any packages to vote for."); + return _("You did not select any packages to vote for."); } else { - return __("Your votes have been removed from the selected packages."); + return _("Your votes have been removed from the selected packages."); } } @@ -823,9 +823,9 @@ function pkg_vote ($atype, $ids, $action = True) { } if ($action) { - return __("Your votes have been cast for the selected packages."); + return _("Your votes have been cast for the selected packages."); } else { - return __("Your votes have been removed from the selected packages."); + return _("Your votes have been removed from the selected packages."); } } @@ -838,13 +838,13 @@ function pkg_vote ($atype, $ids, $action = True) { */ function pkg_notify ($atype, $ids, $action = True) { if (!$atype) { -# return __("You must be logged in before you can get notifications on comments."); +# return _("You must be logged in before you can get notifications on comments."); return; } $ids = sanitize_ids($ids); if (empty($ids)) { - return __("Couldn't add to notification list."); + return _("Couldn't add to notification list."); } $dbh = db_connect(); @@ -895,10 +895,10 @@ function pkg_notify ($atype, $ids, $action = True) { } if ($action) { - $output = __("You have been added to the comment notification list for %s.", $output); + $output = sprintf(_("You have been added to the comment notification list for %s."), $output); } else { - $output = __("You have been removed from the comment notification list for %s.", $output); + $output = sprintf(_("You have been removed from the comment notification list for %s."), $output); } return $output; @@ -914,14 +914,14 @@ function pkg_notify ($atype, $ids, $action = True) { */ function pkg_delete_comment($atype) { if (!$atype) { - return __("You must be logged in before you can edit package information."); + return _("You must be logged in before you can edit package information."); } # Get ID of comment to be removed if (isset($_POST["comment_id"])) { $comment_id = $_POST["comment_id"]; } else { - return __("Missing comment ID."); + return _("Missing comment ID."); } $uid = uid_from_sid($_COOKIE["AURSID"]); @@ -932,9 +932,9 @@ function pkg_delete_comment($atype) { $q.= "SET DelUsersID = ".$uid." "; $q.= "WHERE ID = ".intval($comment_id); db_query($q, $dbh); - return __("Comment has been deleted."); + return _("Comment has been deleted."); } else { - return __("You are not allowed to delete this comment."); + return _("You are not allowed to delete this comment."); } } @@ -946,25 +946,25 @@ function pkg_delete_comment($atype) { */ function pkg_change_category($atype) { if (!$atype) { - return __("You must be logged in before you can edit package information."); + return _("You must be logged in before you can edit package information."); } # Get ID of the new category if (isset($_POST["category_id"])) { $category_id = $_POST["category_id"]; } else { - return __("Missing category ID."); + return _("Missing category ID."); } $catArray = pkgCategories(); if (!array_key_exists($category_id, $catArray)) { - return __("Invalid category ID."); + return _("Invalid category ID."); } if (isset($_GET["ID"])) { $pid = $_GET["ID"]; } else { - return __("Missing package ID."); + return _("Missing package ID."); } # Verify package ownership @@ -977,7 +977,7 @@ function pkg_change_category($atype) { $pkg = mysql_fetch_assoc($result); } else { - return __("You are not allowed to change this package category."); + return _("You are not allowed to change this package category."); } $uid = uid_from_sid($_COOKIE["AURSID"]); @@ -987,8 +987,8 @@ function pkg_change_category($atype) { $q.= "SET CategoryID = ".intval($category_id)." "; $q.= "WHERE ID = ".intval($pid); db_query($q, $dbh); - return __("Package category changed."); + return _("Package category changed."); } else { - return __("You are not allowed to change this package category."); + return _("You are not allowed to change this package category."); } } diff --git a/web/lib/translator.inc.php b/web/lib/translator.inc.php deleted file mode 100644 index 44c87bda..00000000 --- a/web/lib/translator.inc.php +++ /dev/null @@ -1,50 +0,0 @@ -", ""); - -include_once('config.inc.php'); -include_once('gettext.php'); -include_once('streams.php'); - -global $streamer, $l10n; - -function __() { - global $LANG; - global $l10n; - - # Create the translation. - $args = func_get_args(); - - # First argument is always string to be translated - $tag = $args[0]; - - # Translate using gettext_reader initialized before. - $translated = $l10n->translate($tag); - $translated = htmlspecialchars($translated, ENT_QUOTES); - - $num_args = sizeof($args); - - # Subsequent arguments are strings to be formatted - # - # TODO: make this more robust. - # '%%' should translate to a literal '%' - - if ( $num_args > 1 ) { - for ($i = 1; $i < $num_args; $i++) { - $translated = preg_replace("/\%[sh]/", $args[$i], $translated, 1); - } - } - - return $translated; -} - diff --git a/web/template/actions_form.php b/web/template/actions_form.php index 058002f8..97177313 100644 --- a/web/template/actions_form.php +++ b/web/template/actions_form.php @@ -12,10 +12,10 @@ if ($result) { if (!mysql_num_rows($result)) { echo " "; + echo " value='"._("Vote")."' /> "; } else { echo " "; + echo " value='"._("UnVote")."' /> "; } } @@ -27,35 +27,35 @@ if ($result) { if (!mysql_num_rows($result)) { echo " "; + echo " value='"._("Notify")."' title='"._("New Comment Notification")."' /> "; } else { echo " "; + echo " value='"._("UnNotify")."' title='"._("No New Comment Notification")."' /> "; } } if ($row["OutOfDateTS"] === NULL) { echo "\n"; + echo " value='"._("Flag Out-of-date")."' />\n"; } else { echo "\n"; + echo " value='"._("UnFlag Out-of-date")."' />\n"; } if ($row["MaintainerUID"] === NULL) { echo "\n"; + echo " value='"._("Adopt Packages")."' />\n"; } else if ($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer") { echo "\n"; + echo " value='"._("Disown Packages")."' />\n"; } if ($atype == "Trusted User" || $atype == "Developer") { echo "\n"; + echo " value='"._("Delete Packages")."' />\n"; echo " "; - echo __("Confirm")."\n"; + echo _("Confirm")."\n"; } ?> diff --git a/web/template/header.php b/web/template/header.php index 8313bb36..8c102339 100644 --- a/web/template/header.php +++ b/web/template/header.php @@ -31,15 +31,15 @@
    diff --git a/web/template/login_form.php b/web/template/login_form.php index ca81e0e7..b6d26ebc 100644 --- a/web/template/login_form.php +++ b/web/template/login_form.php @@ -1,9 +1,9 @@
    ' . username_from_sid($_COOKIE["AURSID"]) . ''); + printf(_("Logged-in as: %s"), '' . username_from_sid($_COOKIE["AURSID"]) . ''); ?> - [] + []
    - + - + - - " /> - [] + + " /> + []
    diff --git a/web/template/pkg_comment_form.php b/web/template/pkg_comment_form.php index e52c92d2..26207c87 100644 --- a/web/template/pkg_comment_form.php +++ b/web/template/pkg_comment_form.php @@ -54,14 +54,14 @@ if (isset($_REQUEST['comment'])) {
    ' . __('Comment has been added.') . ''; + echo '' . _('Comment has been added.') . ''; } ?> -
    +

    - " /> - " /> + " /> + " />
    diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index aed9ca8b..f62308d6 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -8,7 +8,7 @@ while (list($indx, $carr) = each($comments)) { ?> $carr['UserName'] = "{$carr['UserName']}"; } - $commentHeader = '

    ' . __('Comment by: %s on %s', $carr['UserName'], gmdate('r', $carr['CommentTS'])) . '

    '; + $commentHeader = '

    ' . sprintf(_('Comment by: %s on %s'), $carr['UserName'], gmdate('r', $carr['CommentTS'])) . '

    '; if (canDeleteCommentArray($carr, $atype, $uid)) { $durl = '
    '; @@ -16,7 +16,7 @@ while (list($indx, $carr) = each($comments)) { ?> $durl.= ''; $durl.= ''; $durl.= ' $count = package_comments_count($_GET['ID']); if ($count > 10 && !isset($_GET['comments'])) { echo ''; } ?> diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 06580639..2f14c41e 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -46,13 +46,13 @@ if ($row["MaintainerUID"]) { $maintainer = "None"; } -$votes = __('Votes') . ': ' . $row['NumVotes']; +$votes = _('Votes') . ': ' . $row['NumVotes']; if ($atype == "Developer" or $atype == "Trusted User") { $votes = "$votes"; } # In case of wanting to put a custom message -$msg = __('unknown'); +$msg = _('unknown'); $license = empty($row['License']) ? $msg : $row['License']; # Print the timestamps for last updates @@ -62,7 +62,7 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[ ?>
    -
    +

    @@ -74,28 +74,28 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[

    -
    -
    +
    +

    -

    +

    -
    - +
    +

    ".__("Tarball")." :: "; - print "".__("PKGBUILD").""; + print ""._("Tarball")." :: "; + print ""._("PKGBUILD").""; if ($row["OutOfDateTS"] !== NULL) { - echo "
    ".__("This package has been flagged out of date.")." (${out_of_date_time})"; + echo "
    "._("This package has been flagged out of date.")." (${out_of_date_time})"; } ?>

    @@ -109,7 +109,7 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[ } if (count($deps) > 0) { - echo "". __("Dependencies").""; + echo "". _("Dependencies").""; while (list($k, $darr) = each($deps)) { # darr: (DepName, DepCondition, PackageID), where ID is NULL if it didn't exist @@ -126,7 +126,7 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[ } if (count($requiredby) > 0) { - echo "". __("Required by").""; + echo "". _("Required by").""; while (list($k, $darr) = each($requiredby)) { # darr: (PackageName, PackageID) @@ -145,7 +145,7 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[ if (count($sources) > 0) { ?> -
    +
    - + " maxlength='35' /> - + - + - +
    @@ -18,9 +18,9 @@
    • - +
    • - +
    • - +
    • - +
    • - + __('All'), 'on' => __('Flagged'), 'off' => __('Not Flagged')); + $outdated_flags = array('' => _('All'), 'on' => _('Flagged'), 'off' => _('Not Flagged')); foreach ($outdated_flags as $k => $v): if (isset($_REQUEST['outdated']) && $_REQUEST['outdated'] == $k): ?> diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index d32b6c4a..f204295f 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -1,12 +1,12 @@ -
      +
      -
      +
      ' method='post'>
      - +
      @@ -19,26 +19,26 @@ - '> + '> - '> + '> - '> + '> - '> + '> - '> + '> - + - '> + '> @@ -62,13 +62,13 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { - + - + @@ -79,7 +79,7 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { &SeB=m'> - + @@ -92,33 +92,33 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {