Localized the 404 page, w00t.
authorDan
Tue, 22 Jan 2008 00:38:19 -0500
changeset 369 d0825e599853
parent 368 ed4f3ee072be
child 370 b251818286b1
Localized the 404 page, w00t.
includes/pageprocess.php
language/english/core.json
--- a/includes/pageprocess.php	Tue Jan 22 00:22:14 2008 -0500
+++ b/includes/pageprocess.php	Tue Jan 22 00:38:19 2008 -0500
@@ -1294,7 +1294,7 @@
         $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$this->namespace] . htmlspecialchars( str_replace('_', ' ', dirtify_page_id( $this->page_id ) ) );
         $b = '<a href="' . $url . '">' . $title . '</a>';
         
-        $ob .= '<small>(Redirected to ' . $b . ' from ' . $a . ')<br /></small>';
+        $ob .= '<small>' . $lang->get('page_msg_redirected_from_to', array('from' => $a, 'to' => $b)) . '<br /></small>';
       }
     }
     
@@ -1318,12 +1318,15 @@
   function err_wrong_password()
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     
     $title = 'Password required';
-    $message = ( empty($this->password) ) ? '<p>Access to this page requires a password. Please enter the password for this page below:</p>' : '<p>The password you entered for this page was incorrect. Please enter the password for this page below:</p>';
+    $message = ( empty($this->password) ) ?
+                 '<p>' . $lang->get('page_msg_passrequired') . '</p>' :
+                 '<p>' . $lang->get('page_msg_pass_wrong') . '</p>';
     $message .= '<form action="' . makeUrlNS($this->namespace, $this->page_id) . '" method="post">
                    <p>
-                     <label>Password: <input name="pagepass" type="password" /></label>&nbsp;&nbsp;<input type="submit" value="Submit" />
+                     <label>' . $lang->get('page_lbl_password') . ' <input name="pagepass" type="password" /></label>&nbsp;&nbsp;<input type="submit" value="Submit" />
                    </p>
                  </form>';
     if ( $this->send_headers )
@@ -1373,6 +1376,7 @@
   function err_page_not_existent($userpage = false)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     
     header('HTTP/1.1 404 Not Found');
     
@@ -1389,22 +1393,28 @@
     {
       if ( $userpage )
       {
-        echo '<h3>There is no page with this title yet.</h3>
-               <p>This user has not created his or her user page yet.';
+        echo '<h3>' . $lang->get('page_msg_404_title') . '</h3>
+               <p>' . $lang->get('page_msg_404_body_userpage');
       }
       else
       {
-        echo '<h3>There is no page with this title yet.</h3>
-               <p>You have requested a page that doesn\'t exist yet.';
+        echo '<h3>' . $lang->get('page_msg_404_title') . '</h3>
+               <p>' . $lang->get('page_msg_404_body');
       }
       if ( $session->get_permissions('create_page') )
       {
-        echo ' You can <a href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;">create this page</a>, or return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.';
+        echo ' ' . $lang->get('page_msg_404_create', array(
+            'create_flags' => 'href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;"',
+            'mainpage_link' => makeUrl(getConfig('main_page'), false, true)
+          ));
       }
       else
       {
-        echo ' Return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.</p>';
+        echo ' ' . $lang->get('page_msg_404_gohome', array(
+            'mainpage_link' => makeUrl(getConfig('main_page'), false, true)
+          ));
       }
+      echo '</p>';
       if ( $session->get_permissions('history_rollback') )
       {
         $e = $db->sql_query('SELECT * FROM ' . table_prefix . 'logs WHERE action=\'delete\' AND page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\' ORDER BY time_id DESC;');
@@ -1415,16 +1425,24 @@
         if ( $db->numrows() > 0 )
         {
           $r = $db->fetchrow();
-          echo '<p><b>This page was deleted on ' . $r['date_string'] . '.</b> The stated reason was:</p><blockquote>' . $r['edit_summary'] . '</blockquote><p>You can probably <a href="'.makeUrl($paths->page, 'do=rollback&amp;id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>';
+          echo '<p>' . $lang->get('page_msg_404_was_deleted', array(
+                    'delete_time' => enano_date('d M Y h:i a', $r['time_id']),
+                    'delete_reason' => htmlspecialchars($r['edit_summary']),
+                    'rollback_flags' => 'href="'.makeUrl($paths->page, 'do=rollback&amp;id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;"'
+                  ))
+                . '</p>';
           if ( $session->user_level >= USER_LEVEL_ADMIN )
           {
-            echo '<p>Additional admin options: <a href="' . makeUrl($paths->page, 'do=detag', true) . '" title="Remove any tags on this page">detag page</a></p>';
+            echo '<p>' . $lang->get('page_msg_404_admin_opts', array(
+                      'detag_link' => makeUrl($paths->page, 'do=detag', true)
+                    ))
+                  . '</p>';
           }
         }
         $db->free_result();
       }
       echo '<p>
-              HTTP Error: 404 Not Found
+              ' . $lang->get('page_msg_404_http_response') . '
             </p>';
     }
     $this->footer();
@@ -1491,9 +1509,10 @@
   function send_error($message, $sql = false)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
+    global $lang;
     
     $content = "<p>$message</p>";
-    $template->tpl_strings['PAGE_NAME'] = 'General error in page fetcher';
+    $template->tpl_strings['PAGE_NAME'] = $lang->get('page_msg_general_error');
     
     if ( $this->debug['works'] )
     {
--- a/language/english/core.json	Tue Jan 22 00:22:14 2008 -0500
+++ b/language/english/core.json	Tue Jan 22 00:38:19 2008 -0500
@@ -111,9 +111,25 @@
                     Enano <a href="http://enanocms.org/Help:Wiki_formatting" onclick="window.open(this.href); return false;">Wiki formatting guide</a>.<br /><br />
                     This page redirects to %redirect_target%.',
       msg_redirected_from: '(Redirected from %from%)',
+      msg_redirected_from_to: '(Redirected from %from% to %to%)',
+      
+      msg_passrequired: 'Access to this page requires a password. Please enter the password for this page below:',
+      msg_pass_wrong: 'The password you entered for this page was incorrect. Please enter the password for this page below:',
+      lbl_password: 'Password:',
+      
+      msg_404_title: 'There is no page with this title yet.',
+      msg_404_body_userpage: 'This user has not created his or her user page yet.',
+      msg_404_body: 'You have requested a page that doesn\'t exist yet.',
+      msg_404_create: 'You can <a %create_flags%>create this page</a>, or return to the <a href="%mainpage_link%">homepage</a>.',
+      msg_404_gohome: 'Return to the <a href="%mainpage_link%">homepage</a>.',
+      msg_404_was_deleted: '<b>This page was deleted on %delete_time%.</b> The stated reason was:</p><blockquote>%delete_reason%</blockquote><p>You can probably <a %rollback_flags%>roll back</a> the deletion.',
+      msg_404_admin_opts: 'Additional admin options: <a href="%detag_link%" title="Remove any tags on this page">detag page</a>',
+      msg_404_http_response: 'HTTP Error: 404 Not Found',
       
       msg_archived_title: 'Notice:',
       msg_archived_body: 'The page you are viewing was archived on %archive_date% at %archive_time%.<br /><a href="%current_link%" onclick="ajaxReset(); return false;">View current version</a>  |  <a href="%restore_link%" onclick="%restore_onclick%">Restore this version</a>',
+      
+      msg_general_error: 'General error in page fetcher',
                     
       autosuggest_heading: 'Page name matches',
       autosuggest_col_name: 'Page title',