diff --git a/README.md b/README.md index 2681019..d04a67d 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ Installing - Install ImageMagick and ensure that the ``convert`` command is available. - Set ``TINYIB_THUMBNAIL`` to ``imagemagick``. - **Note:** GIF files will have animated thumbnails, which will often have large file sizes. + - To use TINYIB in another language: + - Set ``TINYIB_LOCALE`` to a language code found in `locale/`. 6. [CHMOD](https://en.wikipedia.org/wiki/Chmod) write permissions to these directories: - ./ (the directory containing TinyIB) - ./src/ diff --git a/imgboard.php b/imgboard.php index 5cb953f..8445e89 100644 --- a/imgboard.php +++ b/imgboard.php @@ -60,12 +60,24 @@ if (!file_exists('settings.php')) { } require 'settings.php'; +if (function_exists('_')) { + if (defined('TINYIB_LOCALE')) { + setlocale(LC_ALL, TINYIB_LOCALE); + } + bindtextdomain('tinyib', 'locale'); + textdomain('tinyib'); +} else { + function _($string) { + return $string; + } +} + if (TINYIB_TRIPSEED == '' || TINYIB_ADMINPASS == '') { - fancyDie('TINYIB_TRIPSEED and TINYIB_ADMINPASS must be configured.'); + fancyDie(_('TINYIB_TRIPSEED and TINYIB_ADMINPASS must be configured.')); } if (TINYIB_CAPTCHA === 'recaptcha' && (TINYIB_RECAPTCHA_SITE == '' || TINYIB_RECAPTCHA_SECRET == '')) { - fancyDie('TINYIB_RECAPTCHA_SITE and TINYIB_RECAPTCHA_SECRET must be configured.'); + fancyDie(_('TINYIB_RECAPTCHA_SITE and TINYIB_RECAPTCHA_SECRET must be configured.')); } // Check directories are writable by the script @@ -75,7 +87,7 @@ if (TINYIB_DBMODE == 'flatfile') { } foreach ($writedirs as $dir) { if (!is_writable($dir)) { - fancyDie("Directory '" . $dir . "' can not be written to. Please modify its permissions."); + fancyDie(sprintf(_("Directory '%s' can not be written to. Please modify its permissions."), $dir)); } } @@ -83,7 +95,7 @@ $includes = array("inc/defines.php", "inc/functions.php", "inc/html.php"); if (in_array(TINYIB_DBMODE, array('flatfile', 'mysql', 'mysqli', 'sqlite', 'sqlite3', 'pdo'))) { $includes[] = 'inc/database_' . TINYIB_DBMODE . '.php'; } else { - fancyDie("Unknown database mode specified."); + fancyDie(_('Unknown database mode specified.')); } foreach ($includes as $include) { @@ -98,7 +110,7 @@ $redirect = true; // Check if the request is to make a post if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) || isset($_POST['email']) || isset($_POST['subject']) || isset($_POST['message']) || isset($_POST['file']) || isset($_POST['embed']) || isset($_POST['password']))) { if (TINYIB_DBMIGRATE) { - fancyDie('Posting is currently disabled.
Please try again in a few moments.'); + fancyDie(_('Posting is currently disabled.
Please try again in a few moments.')); } list($loggedin, $isadmin) = manageCheckLogIn(); @@ -117,9 +129,9 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) if ($post['parent'] != TINYIB_NEWTHREAD && !$loggedin) { $parent = postByID($post['parent']); if (!isset($parent['locked'])) { - fancyDie("Invalid parent thread ID supplied, unable to create post."); + fancyDie(_('Invalid parent thread ID supplied, unable to create post.')); } else if ($parent['locked'] == 1) { - fancyDie('Replies are not allowed to locked threads.'); + fancyDie(_('Replies are not allowed to locked threads.')); } } @@ -156,12 +168,12 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) if (isset($_POST['embed']) && trim($_POST['embed']) != '' && ($rawpost || !in_array('embed', $hide_fields))) { if (isset($_FILES['file']) && $_FILES['file']['name'] != "") { - fancyDie("Embedding a URL and uploading a file at the same time is not supported."); + fancyDie(_('Embedding a URL and uploading a file at the same time is not supported.')); } list($service, $embed) = getEmbed(trim($_POST['embed'])); if (empty($embed) || !isset($embed['html']) || !isset($embed['title']) || !isset($embed['thumbnail_url'])) { - fancyDie("Invalid embed URL. Only " . (implode("/", array_keys($tinyib_embeds))) . " URLs are supported."); + fancyDie(sprintf(_('Invalid embed URL. Only %s URLs are supported.'), implode('/', array_keys($tinyib_embeds)))); } $post['file_hex'] = $service; @@ -181,14 +193,14 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) } else if ($file_mime == "image/png") { $post['thumb'] = $temp_file . '.png'; } else { - fancyDie("Error while processing audio/video."); + fancyDie(_('Error while processing audio/video.')); } $thumb_location = "thumb/" . $post['thumb']; list($thumb_maxwidth, $thumb_maxheight) = thumbnailDimensions($post); if (!createThumbnail($file_location, $thumb_location, $thumb_maxwidth, $thumb_maxheight)) { - fancyDie("Could not create thumbnail."); + fancyDie(_('Could not create thumbnail.')); } addVideoOverlay($thumb_location); @@ -204,11 +216,11 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) validateFileUpload(); if (!is_file($_FILES['file']['tmp_name']) || !is_readable($_FILES['file']['tmp_name'])) { - fancyDie("File transfer failure. Please retry the submission."); + fancyDie(_('File transfer failure. Please retry the submission.')); } if ((TINYIB_MAXKB > 0) && (filesize($_FILES['file']['tmp_name']) > (TINYIB_MAXKB * 1024))) { - fancyDie("That file is larger than " . TINYIB_MAXKBDESC . "."); + fancyDie(sprintf(_('That file is larger than %s.'), TINYIB_MAXKBDESC)); } $post['file_original'] = trim(htmlentities(substr($_FILES['file']['name'], 0, 50), ENT_QUOTES)); @@ -223,7 +235,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $file_mime = strtolower(array_pop($file_mime_split)); } else { if (!@getimagesize($_FILES['file']['tmp_name'])) { - fancyDie("Failed to read the MIME type and size of the uploaded file. Please retry the submission."); + fancyDie(_('Failed to read the MIME type and size of the uploaded file. Please retry the submission.')); } $file_info = getimagesize($_FILES['file']['tmp_name']); @@ -239,12 +251,12 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $file_location = "src/" . $post['file']; if (!move_uploaded_file($_FILES['file']['tmp_name'], $file_location)) { - fancyDie("Could not copy uploaded file."); + fancyDie(_('Could not copy uploaded file.')); } if ($_FILES['file']['size'] != filesize($file_location)) { @unlink($file_location); - fancyDie("File transfer failure. Please go back and try again."); + fancyDie(_('File transfer failure. Please go back and try again.')); } if ($file_mime == "audio/webm" || $file_mime == "video/webm" || $file_mime == "audio/mp4" || $file_mime == "video/mp4") { @@ -263,7 +275,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) if ($post['thumb_width'] <= 0 || $post['thumb_height'] <= 0) { @unlink($file_location); @unlink("thumb/" . $post['thumb']); - fancyDie("Sorry, your video appears to be corrupt."); + fancyDie(_('Sorry, your video appears to be corrupt.')); } addVideoOverlay("thumb/" . $post['thumb']); @@ -288,7 +300,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $post['thumb'] = $file_name . "s." . array_pop($thumbfile_split); if (!copy($tinyib_uploads[$file_mime][1], "thumb/" . $post['thumb'])) { @unlink($file_location); - fancyDie("Could not create thumbnail."); + fancyDie(_('Could not create thumbnail.')); } if ($file_mime == "application/x-shockwave-flash") { addVideoOverlay("thumb/" . $post['thumb']); @@ -299,7 +311,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) if (!createThumbnail($file_location, "thumb/" . $post['thumb'], $thumb_maxwidth, $thumb_maxheight)) { @unlink($file_location); - fancyDie("Could not create thumbnail."); + fancyDie(_('Could not create thumbnail.')); } } @@ -323,7 +335,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $allowed .= "embed URL"; } if ($post['parent'] == TINYIB_NEWTHREAD && $allowed != "" && !TINYIB_NOFILEOK) { - fancyDie("A $allowed is required to start a thread."); + fancyDie(sprintf(_('A %s is required to start a thread.'), $allowed)); } if (!$rawpost && str_replace('
', '', $post['message']) == "") { $die_msg = ""; @@ -336,12 +348,12 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) fancyDie("Please $die_msg."); } } else { - echo $post['file_original'] . ' uploaded.
'; + echo sprintf(_('%s uploaded.'), $post['file_original']) . '
'; } if (!$loggedin && (($post['file'] != '' && TINYIB_REQMOD == 'files') || TINYIB_REQMOD == 'all')) { $post['moderated'] = '0'; - echo 'Your ' . ($post['parent'] == TINYIB_NEWTHREAD ? 'thread' : 'post') . ' will be shown once it has been approved.
'; + echo sprintf(_('Your %s will be shown once it has been approved.'), $post['parent'] == TINYIB_NEWTHREAD ? 'thread' : 'post') . '
'; $slow_redirect = true; } @@ -354,7 +366,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) trimThreads(); - echo 'Updating thread...
'; + echo _('Updating thread...') . '
'; if ($post['parent'] != TINYIB_NEWTHREAD) { rebuildThread($post['parent']); @@ -367,17 +379,17 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) rebuildThread($post['id']); } - echo 'Updating index...
'; + echo _('Updating index...') . '
'; rebuildIndexes(); } // Check if the request is to delete a post and/or its associated image } elseif (isset($_GET['delete']) && !isset($_GET['manage'])) { if (!isset($_POST['delete'])) { - fancyDie('Tick the box next to a post and click "Delete" to delete it.'); + fancyDie(_('Tick the box next to a post and click "Delete" to delete it.')); } if (TINYIB_DBMIGRATE) { - fancyDie('Post deletion is currently disabled.
Please try again in a few moments.'); + fancyDie(_('Post deletion is currently disabled.
Please try again in a few moments.')); } $post = postByID($_POST['delete']); @@ -394,12 +406,12 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) } else { threadUpdated($post['parent']); } - fancyDie('Post deleted.'); + fancyDie(_('Post deleted.')); } else { - fancyDie('Invalid password.'); + fancyDie(_('Invalid password.')); } } else { - fancyDie('Sorry, an invalid post identifier was sent. Please go back, refresh the page, and try again.'); + fancyDie(_('Sorry, an invalid post identifier was sent. Please go back, refresh the page, and try again.')); } $redirect = false; @@ -423,7 +435,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) rebuildThread($thread['id']); } rebuildIndexes(); - $text .= manageInfo('Rebuilt board.'); + $text .= manageInfo(_('Rebuilt board.')); } elseif (isset($_GET['bans'])) { clearExpiredBans(); @@ -431,7 +443,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) if ($_POST['ip'] != '') { $banexists = banByIP($_POST['ip']); if ($banexists) { - fancyDie('Sorry, there is already a ban on record for that IP address.'); + fancyDie(_('Sorry, there is already a ban on record for that IP address.')); } $ban = array(); @@ -440,13 +452,13 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $ban['reason'] = $_POST['reason']; insertBan($ban); - $text .= manageInfo('Ban record added for ' . $ban['ip']); + $text .= manageInfo(sprintf(_('Ban record added for %s'), $ban['ip'])); } } elseif (isset($_GET['lift'])) { $ban = banByID($_GET['lift']); if ($ban) { deleteBanByID($_GET['lift']); - $text .= manageInfo('Ban record lifted for ' . $ban['ip']); + $text .= manageInfo(sprintf(_('Ban record lifted for %s'), $ban['ip'])); } } @@ -538,9 +550,9 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) if ($post['parent'] != TINYIB_NEWTHREAD) { rebuildThread($post['parent']); } - $text .= manageInfo('Post No.' . $post['id'] . ' deleted.'); + $text .= manageInfo(sprintf(_('Post No.%d deleted.'), $post['id'])); } else { - fancyDie("Sorry, there doesn't appear to be a post with that ID."); + fancyDie(_("Sorry, there doesn't appear to be a post with that ID.")); } } elseif (isset($_GET['approve'])) { if ($_GET['approve'] > 0) { @@ -554,9 +566,9 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) } threadUpdated($thread_id); - $text .= manageInfo('Post No.' . $post['id'] . ' approved.'); + $text .= manageInfo(sprintf(_('Post No.%d approved.'), $post['id'])); } else { - fancyDie("Sorry, there doesn't appear to be a post with that ID."); + fancyDie(_("Sorry, there doesn't appear to be a post with that ID.")); } } } elseif (isset($_GET['moderate'])) { @@ -565,7 +577,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) if ($post) { $text .= manageModeratePost($post); } else { - fancyDie("Sorry, there doesn't appear to be a post with that ID."); + fancyDie(_("Sorry, there doesn't appear to be a post with that ID.")); } } else { $onload = manageOnLoad('moderate'); @@ -580,10 +592,10 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $text .= manageInfo('Thread No.' . $post['id'] . ' ' . (intval($_GET['setsticky']) == 1 ? 'stickied' : 'un-stickied') . '.'); } else { - fancyDie("Sorry, there doesn't appear to be a thread with that ID."); + fancyDie(_("Sorry, there doesn't appear to be a post with that ID.")); } } else { - fancyDie("Form data was lost. Please go back and try again."); + fancyDie(_('Form data was lost. Please go back and try again.')); } } elseif (isset($_GET['lock']) && isset($_GET['setlock'])) { if ($_GET['lock'] > 0) { @@ -594,10 +606,10 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $text .= manageInfo('Thread No.' . $post['id'] . ' ' . (intval($_GET['setlock']) == 1 ? 'locked' : 'unlocked') . '.'); } else { - fancyDie("Sorry, there doesn't appear to be a thread with that ID."); + fancyDie(_("Sorry, there doesn't appear to be a post with that ID.")); } } else { - fancyDie("Form data was lost. Please go back and try again."); + fancyDie(_('Form data was lost. Please go back and try again.')); } } elseif (isset($_GET["rawpost"])) { $onload = manageOnLoad("rawpost"); diff --git a/inc/defines.php b/inc/defines.php index f00a4ee..ee8a04c 100644 --- a/inc/defines.php +++ b/inc/defines.php @@ -10,6 +10,9 @@ define('TINYIB_WORDBREAK_IDENTIFIER', '@!@TINYIB_WORDBREAK@!@'); // The following are provided for backward compatibility and should not be relied upon // Copy new settings from settings.default.php to settings.php +if (!defined('TINYIB_LOCALE')) { + define('TINYIB_LOCALE', ''); +} if (!defined('TINYIB_INDEX')) { define('TINYIB_INDEX', 'index.html'); } diff --git a/inc/functions.php b/inc/functions.php index fec480b..bf1f4e6 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -211,7 +211,7 @@ function nameAndTripcode($name) { function nameBlock($name, $tripcode, $email, $timestamp, $rawposttext) { $output = ''; - $output .= ($name == '' && $tripcode == '') ? 'Anonymous' : $name; + $output .= ($name == '' && $tripcode == '') ? _('Anonymous') : $name; if ($tripcode != '') { $output .= '!' . $tripcode; @@ -320,9 +320,9 @@ function checkCAPTCHA() { $captcha_solution = isset($_SESSION['tinyibcaptcha']) ? strtolower(trim($_SESSION['tinyibcaptcha'])) : ''; if ($captcha == '') { - fancyDie('Please enter the CAPTCHA text.'); + fancyDie(_('Please enter the CAPTCHA text.')); } else if ($captcha != $captcha_solution) { - fancyDie('Incorrect CAPTCHA text entered. Please try again.
Click the image to retrieve a new CAPTCHA.'); + fancyDie(_('Incorrect CAPTCHA text entered. Please try again.
Click the image to retrieve a new CAPTCHA.')); } } } @@ -353,7 +353,7 @@ function checkFlood() { function checkMessageSize() { if (strlen($_POST["message"]) > 8000) { - fancyDie("Please shorten your message, or post it in multiple parts. Your message is " . strlen($_POST["message"]) . " characters long, and the maximum allowed is 8000."); + fancyDie(sprintf(_('Please shorten your message, or post it in multiple parts. Your message is %1$d characters long, and the maximum allowed is %2$d.'), strlen($_POST["message"]), 8000)); } } @@ -384,7 +384,7 @@ function setParent() { if (isset($_POST["parent"])) { if ($_POST["parent"] != TINYIB_NEWTHREAD) { if (!threadExistsByID($_POST['parent'])) { - fancyDie("Invalid parent thread ID supplied, unable to create post."); + fancyDie(_('Invalid parent thread ID supplied, unable to create post.')); } return $_POST["parent"]; @@ -410,25 +410,25 @@ function validateFileUpload() { case UPLOAD_ERR_OK: break; case UPLOAD_ERR_FORM_SIZE: - fancyDie("That file is larger than " . TINYIB_MAXKBDESC . "."); + fancyDie(sprintf(_('That file is larger than %s.'), TINYIB_MAXKBDESC)); break; case UPLOAD_ERR_INI_SIZE: - fancyDie("The uploaded file exceeds the upload_max_filesize directive (" . ini_get('upload_max_filesize') . ") in php.ini."); + fancyDie(sprintf(_('The uploaded file exceeds the upload_max_filesize directive (%s) in php.ini.'), ini_get('upload_max_filesize'))); break; case UPLOAD_ERR_PARTIAL: - fancyDie("The uploaded file was only partially uploaded."); + fancyDie(_('The uploaded file was only partially uploaded.')); break; case UPLOAD_ERR_NO_FILE: - fancyDie("No file was uploaded."); + fancyDie(_('No file was uploaded.')); break; case UPLOAD_ERR_NO_TMP_DIR: - fancyDie("Missing a temporary folder."); + fancyDie(_('Missing a temporary folder.')); break; case UPLOAD_ERR_CANT_WRITE: - fancyDie("Failed to write file to disk"); + fancyDie(_('Failed to write file to disk')); break; default: - fancyDie("Unable to save the uploaded file."); + fancyDie(_('Unable to save the uploaded file.')); } } @@ -436,7 +436,7 @@ function checkDuplicateFile($hex) { $hexmatches = postsByHex($hex); if (count($hexmatches) > 0) { foreach ($hexmatches as $hexmatch) { - fancyDie("Duplicate file uploaded. That file has already been posted here."); + fancyDie(sprintf(_('Duplicate file uploaded. That file has already been posted here.'), 'res/' . (($hexmatch['parent'] == TINYIB_NEWTHREAD) ? $hexmatch['id'] : $hexmatch['parent'])) . '.html#' . $hexmatch['id']); } } } @@ -467,7 +467,7 @@ function createThumbnail($file_location, $thumb_location, $new_w, $new_h) { } if (!$src_img) { - fancyDie("Unable to read uploaded file during thumbnailing. A common cause for this is an incorrect extension when the file is actually of a different type."); + fancyDie(_('Unable to read the uploaded file while creating its thumbnail. A common cause for this is an incorrect extension when the file is actually of a different type.')); } $old_x = imageSX($src_img); diff --git a/inc/html.php b/inc/html.php index be3778a..2309bec 100644 --- a/inc/html.php +++ b/inc/html.php @@ -58,7 +58,11 @@ function supportedFileTypes() { ? implode(', ', $types_allowed) . ' and ' . $types_last : $types_last; - return "Supported file type" . (count($tinyib_uploads) != 1 ? "s are " : " is ") . $types_formatted . "."; + if (count($tinyib_uploads) == 1) { + return sprintf(_('Supported file type is %s'), $types_formatted); + } else { + return sprintf(_('Supported file types are %s.'), $types_formatted); + } } function makeLinksClickable($text) { @@ -93,22 +97,27 @@ function buildPostForm($parent, $raw_post = false) { $input_extra = ''; $rules_extra = ''; if ($raw_post) { + $txt_reply_to = _('Reply to'); + $txt_new_thread = _('0 to start a new thread'); + $txt_info_1 = _('Text entered in the Message field will be posted as is with no formatting applied.'); + $txt_info_2 = _('Line-breaks must be specified with "<br>".'); + $form_action = '?'; $form_extra = ''; $input_extra = << - Reply to + $txt_reply_to -  0 to start a new thread +  $txt_new_thread EOF; $rules_extra = << -
  • Text entered in the Message field will be posted as is with no formatting applied.
  • -
  • Line-breaks must be specified with "<br>".
  • +
  • $txt_info_1
  • +
  • $txt_info_2

  • EOF; } @@ -142,14 +151,15 @@ EOF; '; } else { // Simple CAPTCHA $captcha_inner_html = ' -  (enter the text below)
    +  ' . _('(enter the text below)') . '
    CAPTCHA'; } + $txt_captcha = _('CAPTCHA'); $captcha_html = << - CAPTCHA + $txt_captcha $captcha_inner_html @@ -161,15 +171,16 @@ EOF; if (!empty($tinyib_uploads) && ($raw_post || !in_array('file', $hide_fields))) { if (TINYIB_MAXKB > 0) { $max_file_size_input_html = ''; - $max_file_size_rules_html = '
  • Maximum file size allowed is ' . TINYIB_MAXKBDESC . '.
  • '; + $max_file_size_rules_html = '
  • ' . sprintf(_('Maximum file size allowed is %s.'), TINYIB_MAXKBDESC) . '
  • '; } $filetypes_html = '
  • ' . supportedFileTypes() . '
  • '; + $txt_file = _('File'); $file_input_html = << - File + $txt_file @@ -179,13 +190,15 @@ EOF; } if (!empty($tinyib_embeds) && ($raw_post || !in_array('embed', $hide_fields))) { + $txt_embed = _('Embed'); + $txt_embed_help = _('(paste a YouTube URL)'); $embed_input_html = << - Embed + $txt_embed -   (paste a YouTube URL) +   $txt_embed_help EOF; @@ -202,12 +215,12 @@ EOF; $maxdimensions .= ' (new thread) or ' . TINYIB_MAXW . 'x' . TINYIB_MAXH . ' (reply)'; } - $thumbnails_html = "
  • Images greater than $maxdimensions will be thumbnailed.
  • "; + $thumbnails_html = '
  • ' . sprintf(_('Images greater than %s will be thumbnailed.'), $maxdimensions) . '
  • '; } $unique_posts = uniquePosts(); if ($unique_posts > 0) { - $unique_posts_html = "
  • Currently $unique_posts unique user posts.
  • \n"; + $unique_posts_html = '
  • ' . printf(_('Currently %s unique user posts.'), $unique_posts) . '
  • ' . "\n"; } $output = << - Name + $txt_name @@ -233,10 +247,11 @@ EOF; EOF; } if ($raw_post || !in_array('email', $hide_fields)) { + $txt_email = _('E-mail'); $output .= << - E-mail + $txt_email @@ -246,10 +261,11 @@ EOF; EOF; } if ($raw_post || !in_array('subject', $hide_fields)) { + $txt_subject = _('Subject'); $output .= << - Subject + $txt_subject @@ -259,10 +275,11 @@ EOF; EOF; } if ($raw_post || !in_array('message', $hide_fields)) { + $txt_message = _('Message'); $output .= << - Message + $txt_message @@ -277,13 +294,15 @@ EOF; $embed_input_html EOF; if ($raw_post || !in_array('password', $hide_fields)) { + $txt_password = _('Password'); + $txt_password_help = _('(for post and file deletion)'); $output .= << - Password + $txt_password -   (for post and file deletion) +   $txt_password_help EOF; @@ -350,7 +369,7 @@ function buildPost($post, $res) { $direct_link = isEmbed($post["file_hex"]) ? "#" : (($res == TINYIB_RESPAGE ? "../" : "") . "src/" . $post["file"]); if ($post['parent'] == TINYIB_NEWTHREAD && $post["file"] != '') { - $filesize .= isEmbed($post['file_hex']) ? 'Embed: ' : 'File: '; + $filesize .= (isEmbed($post['file_hex']) ? _('Embed:') : _('File:')) . ' '; } if (isEmbed($post["file_hex"])) { @@ -447,13 +466,13 @@ EOF; } if ($post['parent'] == TINYIB_NEWTHREAD && $res == TINYIB_INDEXPAGE) { - $return .= " [Reply]"; + $return .= " [" . _("Reply") . "]"; } if (TINYIB_TRUNCATE > 0 && !$res && substr_count($post['message'], '
    ') > TINYIB_TRUNCATE) { // Truncate messages on board index pages for readability $br_offsets = strallpos($post['message'], '
    '); $post['message'] = substr($post['message'], 0, $br_offsets[TINYIB_TRUNCATE - 1]); - $post['message'] .= '
    Post truncated. Click Reply to view.
    '; + $post['message'] .= '
    ' . _('Post truncated. Click Reply to view.') . '
    '; } $return .= << @@ -463,7 +482,11 @@ EOF; if ($post['parent'] == TINYIB_NEWTHREAD) { if ($res == TINYIB_INDEXPAGE && $post['omitted'] > 0) { - $return .= '' . $post['omitted'] . ' ' . plural('post', $post['omitted']) . ' omitted. Click Reply to view.'; + if ($post['omitted'] == 1) { + $return .= '' . _('1 post omitted. Click Reply to view.') . ''; + } else { + $return .= '' . sprintf(_('%d posts omitted. Click Reply to view.'), $post['omitted']) . ''; + } } } else { $return .= <<Catalog]' : ''; + $cataloglink = TINYIB_CATALOG ? ('[' . _('Catalog') . ']') : ''; $managelink = basename($_SERVER['PHP_SELF']) . "?manage"; $postingmode = ""; @@ -488,7 +511,7 @@ function buildPage($htmlposts, $parent, $pages = 0, $thispage = 0) { $previous = ($thispage == 1) ? "index" : $thispage - 1; $next = $thispage + 1; - $pagelinks = ($thispage == 0) ? "Previous" : '
    '; + $pagelinks = ($thispage == 0) ? ('' . _('Previous') . '') : ('
    '); $pagelinks .= ""; for ($i = 0; $i <= $pages; $i++) { @@ -501,7 +524,7 @@ function buildPage($htmlposts, $parent, $pages = 0, $thispage = 0) { } $pagelinks .= ""; - $pagelinks .= ($pages <= $thispage) ? "Next" : '
    '; + $pagelinks .= ($pages <= $thispage) ? ('' . _('Next') . '') : ('
    '); $pagenavigator = << @@ -524,9 +547,9 @@ EOF; EOF; } } else if ($parent == -1) { - $postingmode = '[Return]
    Catalog
    '; + $postingmode = '[Return]
    ' . _('Catalog') . '
    '; } else { - $postingmode = '[Return]
    Posting mode: Reply
    '; + $postingmode = '[Return]
    ' . _('Posting mode: Reply') . '
    '; } $postform = ''; @@ -534,12 +557,15 @@ EOF; $postform = buildPostForm($parent); } + $txt_manage = _('Manage'); + $txt_style = _('Style'); + $txt_delete = _('Delete Post'); $body = <<
    $cataloglink - [Manage] - + [$txt_manage] +