From 1e05da6c8114238edb499fd21104bd573f9cf3e3 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Thu, 28 Nov 2013 22:40:48 +0100 Subject: gettext for user sites --- includes/pages/user_shifts.php | 61 ++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 29 deletions(-) (limited to 'includes/pages/user_shifts.php') diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 0cd6697d..19adf08e 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -19,9 +19,9 @@ function user_shifts() { sql_query("DELETE FROM `ShiftEntry` WHERE `id`=" . sql_escape($entry_id) . " LIMIT 1"); engelsystem_log("Deleted " . User_Nick_render($shift_entry_source) . "'s shift: " . $shift_entry_source['name'] . " at " . $shift_entry_source['Name'] . " from " . date("y-m-d H:i", $shift_entry_source['start']) . " to " . date("y-m-d H:i", $shift_entry_source['end']) . " as " . $shift_entry_source['angel_type']); - success("Der Schicht-Eintrag wurde gelöscht."); + success(_("Shift entry deleted.")); } else - error("Entry not found."); + error(_("Entry not found.")); redirect(page_link_to('user_shifts')); } // Schicht bearbeiten elseif (isset($_REQUEST['edit_shift']) && in_array('admin_shifts', $privileges)) { @@ -86,26 +86,26 @@ function user_shifts() { else { $ok = false; $rid = $rooms[0]['RID']; - $msg .= error("Wähle bitte einen Raum aus.", true); + $msg .= error(_("Please select a room."), true); } if (isset($_REQUEST['start']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['start']))) $start = $tmp->getTimestamp(); else { $ok = false; - $msg .= error("Bitte gib einen Startzeitpunkt für die Schichten an.", true); + $msg .= error(_("Please enter a valid starting time for the shifts."), true); } if (isset($_REQUEST['end']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['end']))) $end = $tmp->getTimestamp(); else { $ok = false; - $msg .= error("Bitte gib einen Endzeitpunkt für die Schichten an.", true); + $msg .= error(_("Please enter a valid ending time for the shifts."), true); } if ($start >= $end) { $ok = false; - $msg .= error("Das Ende muss nach dem Startzeitpunkt liegen!", true); + $msg .= error(_("The ending time has to be after the starting time."), true); } foreach ($needed_angel_types_source as $type) { @@ -113,7 +113,7 @@ function user_shifts() { $needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]); } else { $ok = false; - $msg .= error("Bitte überprüfe die Eingaben für die benötigten Engel des Typs " . $type['name'] . ".", true); + $msg .= error(sprintf(_("Please check your input for needed angels of type %s."), $type['name']), true); } } @@ -127,7 +127,7 @@ function user_shifts() { } engelsystem_log("Updated shift '" . $name . "' from " . date("y-m-d H:i", $start) . " to " . date("y-m-d H:i", $end) . " with angel types " . join(", ", $needed_angel_types_info)); - success("Schicht gespeichert."); + success(_("Shift updated.")); redirect(page_link_to('user_shifts')); } } @@ -143,13 +143,18 @@ function user_shifts() { )); } - return template_render('../templates/user_shifts_edit.html', array( - 'msg' => $msg, - 'name' => $name, - 'room_select' => $room_select, - 'start' => date("Y-m-d H:i", $start), - 'end' => date("Y-m-d H:i", $end), - 'angel_types' => $angel_types + return page(array( + msg(), + '', + form(array( + form_text('name', _("Name/Description:"), $name), + form_select('rid', _("Room:"), $room_array, $rid), + form_text('start', _("Start:"), date("Y-m-d H:i", $start)), + form_text('end', _("End:"), date("Y-m-d H:i", $end)), + '

' . _("Needed angels") . '

', + $angel_types, + form_submit('submit', _("Save")) + )) )); } // Schicht komplett löschen (nur für admins/user mit user_shifts_admin privileg) elseif (isset($_REQUEST['delete_shift']) && in_array('user_shifts_admin', $privileges)) { @@ -170,15 +175,13 @@ function user_shifts() { sql_query("DELETE FROM `Shifts` WHERE `SID`=" . sql_escape($shift_id) . " LIMIT 1"); engelsystem_log("Deleted shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end'])); - success("Die Schicht wurde gelöscht."); + success(_("Shift deleted.")); redirect(page_link_to('user_shifts')); } - return template_render('../templates/user_shifts_admin_delete.html', array( - 'name' => $shift['name'], - 'start' => date("Y-m-d H:i", $shift['start']), - 'end' => date("H:i", $shift['end']), - 'id' => $shift_id + return page(array( + error(sprintf(_("Do you want to delete the shift %s from %s to %s?"), $shift['name'], date("Y-m-d H:i", $shift['start']), date("H:i", $shift['end'])), true), + '' . _("delete") . '' )); } elseif (isset($_REQUEST['shift_id'])) { if (isset($_REQUEST['shift_id']) && preg_match("/^[0-9]*$/", $_REQUEST['shift_id'])) @@ -198,13 +201,13 @@ function user_shifts() { // Schicht läuft schon, Eintragen für Engel nicht mehr möglich if (! in_array('user_shifts_admin', $privileges) && time() > $shift['start']) { - error("Diese Schicht läuft gerade oder ist bereits vorbei. Bitte kontaktiere den Schichtkoordinator um Dich eintragen zu lassen."); + error(_("This shift is running now or ended already. Please contact a dispatcher to join the shift.")); redirect(page_link_to('user_shifts')); } // Another shift the user is signed up for collides with this one if (! in_array('user_shifts_admin', $privileges) && sql_num_query("SELECT `Shifts`.`SID` FROM `Shifts` INNER JOIN `ShiftEntry` ON (`Shifts`.`SID` = `ShiftEntry`.`SID` AND `ShiftEntry`.`UID` = " . sql_escape($user['UID']) . ") WHERE `start` < '" . sql_escape($shift['end']) . "' AND `end` > '" . sql_escape($shift['start']) . "'") > 0) { - error("Du bist bereits in einer parallelen Schicht eingetragen. Bitte kontaktiere den Schichtkoordinator, um dich eintragen zu lassen."); + error(_("You already subscribed to shift in the same timeslot. Please contact a dispatcher to join the shift.")); redirect(page_link_to('user_shifts')); } @@ -243,7 +246,7 @@ function user_shifts() { $user_source = User($user_id); engelsystem_log("User " . User_Nick_render($user_source) . " signed up for shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end'])); - success("Du bist eingetragen. Danke!" . ' Meine Schichten »'); + success(_("You are subscribed. Thank you!") . ' ' . _("My shifts") . ' »'); redirect(page_link_to('user_shifts')); } @@ -521,7 +524,7 @@ function view_user_shifts() { if (time() > $shift['start']) $entry_list[] = $inner_text . ' (vorbei)'; elseif ($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && ! isset($angeltype['confirm_user_id'])) - $entry_list[] = $inner_text . ' unconfirmed'; + $entry_list[] = $inner_text . ' unconfirmed'; elseif ($collides) $entry_list[] = $inner_text; else @@ -537,7 +540,7 @@ function view_user_shifts() { $shifts_row .= '
'; } if (in_array('user_shifts_admin', $privileges)) { - $shifts_row .= 'Weitere Helfer eintragen »'; + $shifts_row .= '' . _("Add more angels") .' »'; } } if ($shift['own'] && ! in_array('user_shifts_admin', $privileges)) @@ -687,11 +690,11 @@ function view_user_shifts() { 'end_time' => $_SESSION['user_shifts']['end_time'], 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", _("Tasks") . '1'), 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")), - 'task_notice' => '1' . _("The tasks shown here are influenced by the preferences you defined in your settings! Description of the jobs."), + 'task_notice' => '1' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " " . _("Description of the jobs.") . "", 'new_style_checkbox' => '', 'shifts_table' => $shifts_table, - 'ical_text' => sprintf(_("Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key)."), page_link_to_absolute('ical') . '&key=' . $user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'], page_link_to('user_myshifts') . '&reset'), - 'filter' => _("Filter") + 'ical_text' => '

' . _("iCal export") . '

' . sprintf(_("Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key)."), page_link_to_absolute('ical') . '&key=' . $user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'], page_link_to('user_myshifts') . '&reset') . '

', + 'filter' => _("Filter") )); } -- cgit v1.2.3-54-g00ecf