diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-12-24 16:34:27 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-12-24 16:34:27 +0000 |
commit | a8277d444a756e2cea896701ffb5c350dcb17d81 (patch) | |
tree | 42e5512f6e841077f585d9f8fec62b39696a2f91 | |
parent | 8b9857c20013b031088b888d62280c9524831da2 (diff) | |
download | forums-a8277d444a756e2cea896701ffb5c350dcb17d81.tar forums-a8277d444a756e2cea896701ffb5c350dcb17d81.tar.gz forums-a8277d444a756e2cea896701ffb5c350dcb17d81.tar.bz2 forums-a8277d444a756e2cea896701ffb5c350dcb17d81.tar.xz forums-a8277d444a756e2cea896701ffb5c350dcb17d81.zip |
Fixed 'bug' #495108, introduced a further string for fields with plural and singular entries, copes with zero conditions.
git-svn-id: file:///svn/phpbb/trunk@1702 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/includes/page_header.php | 62 | ||||
-rw-r--r-- | phpBB/index.php | 31 | ||||
-rw-r--r-- | phpBB/language/lang_english/lang_main.php | 21 | ||||
-rw-r--r-- | phpBB/viewonline.php | 40 |
4 files changed, 139 insertions, 15 deletions
diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index dd5efb3f24..6199ec72e9 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -148,10 +148,64 @@ $online_userlist = $lang['Registered_users'] . " " . $online_userlist; $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online; -$l_online_users = ( $total_online_users == 1 ) ? sprintf($lang['Online_user_total'], $total_online_users) : sprintf($lang['Online_users_total'], $total_online_users); -$l_online_users .= ( $logged_visible_online == 1 ) ? sprintf($lang['Reg_user_total'], $logged_visible_online) : sprintf($lang['Reg_users_total'], $logged_visible_online); -$l_online_users .= ( $logged_hidden_online == 1 ) ? sprintf($lang['Hidden_user_total'], $logged_hidden_online) : sprintf($lang['Hidden_user_total'], $logged_hidden_online); -$l_online_users .= ( $guests_online == 1 ) ? sprintf($lang['Guest_user_total'], $guests_online) : sprintf($lang['Guest_users_total'], $guests_online); + +if( $total_online_users == 0 ) +{ + $l_t_user_s = $lang['Online_users_zero_total']; +} +else if( $total_online_users == 1 ) +{ + $l_t_user_s = $lang['Online_user_total']; +} +else +{ + $l_t_user_s = $lang['Online_users_total']; +} + +if( $logged_visible_online == 0 ) +{ + $l_r_user_s = $lang['Reg_users_zero_total']; +} +else if( $logged_visible_online == 1 ) +{ + $l_r_user_s = $lang['Reg_user_total']; +} +else +{ + $l_r_user_s = $lang['Reg_users_total']; +} + +if( $logged_hidden_online == 0 ) +{ + $l_h_user_s = $lang['Hidden_users_zero_total']; +} +else if( $logged_hidden_online == 1 ) +{ + $l_h_user_s = $lang['Hidden_user_total']; +} +else +{ + $l_h_user_s = $lang['Hidden_users_total']; +} + +if( $guests_online == 0 ) +{ + $l_g_user_s = $lang['Guest_users_zero_total']; +} +else if( $guests_online == 1 ) +{ + $l_g_user_s = $lang['Guest_user_total']; +} +else +{ + $l_g_user_s = $lang['Guest_users_total']; +} + + +$l_online_users = sprintf($l_t_user_s, $total_online_users); +$l_online_users .= sprintf($l_r_user_s, $logged_visible_online); +$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online); +$l_online_users .= sprintf($l_g_user_s, $guests_online); // // Obtain number of new private messages diff --git a/phpBB/index.php b/phpBB/index.php index 3f995e2a76..7d4e46d613 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -96,6 +96,33 @@ $newest_userdata = get_db_stat('newestuser'); $newest_user = $newest_userdata['username']; $newest_uid = $newest_userdata['user_id']; +if( $total_posts == 0 ) +{ + $l_total_post_s = $lang['Posted_articles_zero_total']; +} +else if( $total_posts == 1 ) +{ + $l_total_post_s = $lang['Posted_article_total']; +} +else +{ + $l_total_post_s = $lang['Posted_articles_total']; +} + +if( $total_users == 0 ) +{ + $l_total_user_s = $lang['Registered_users_zero_total']; +} +else if( $total_users == 1 ) +{ + $l_total_user_s = $lang['Registered_user_total']; +} +else +{ + $l_total_user_s = $lang['Registered_users_total']; +} + + // // Start page proper // @@ -237,8 +264,8 @@ if($total_categories = $db->sql_numrows($q_categories)) ); $template->assign_vars(array( - "TOTAL_POSTS" => ( $total_posts == 1 ) ? sprintf($lang['Posted_article_total'], $total_posts) : sprintf($lang['Posted_articles_total'], $total_posts), - "TOTAL_USERS" => ( $total_users == 1 ) ? sprintf($lang['Registered_user_total'], $total_users) : sprintf($lang['Registered_users_total'], $total_users), + "TOTAL_POSTS" => sprintf($l_total_post_s, $total_posts), + "TOTAL_USERS" => sprintf($l_total_user_s, $total_users), "NEWEST_USER" => sprintf($lang['Newest_user'], "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . "\">", $newest_user, "</a>"), "FORUM_IMG" => $images['forum'], diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 442ab07971..d040275330 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -120,12 +120,16 @@ $lang['Board_disable'] = "Sorry but this board is currently unavailable, please // Global Header strings // $lang['Registered_users'] = "Registered Users:"; +$lang['Online_users_zero_total'] = "In total there are <b>0</b> users online :: "; $lang['Online_users_total'] = "In total there are <b>%d</b> users online :: "; $lang['Online_user_total'] = "In total there is <b>%d</b> user online :: "; +$lang['Reg_users_zero_total'] = "0 Registered, "; $lang['Reg_users_total'] = "%d Registered, "; $lang['Reg_user_total'] = "%d Registered, "; -$lang['Hidden_users_total'] = "%d Hidden and "; +$lang['Hidden_users_zero_total'] = "0 Hidden and "; $lang['Hidden_user_total'] = "%d Hidden and "; +$lang['Hidden_user_total'] = "%d Hidden and "; +$lang['Guest_users_zero_total'] = "0 Guests"; $lang['Guest_users_total'] = "%d Guests"; $lang['Guest_user_total'] = "%d Guest"; @@ -152,10 +156,12 @@ $lang['Moderators'] = "Moderators"; // // Stats block text // -$lang['Posted_article_total'] = "Our users have posted a total of <b>%d</b> article"; // Number of posts +$lang['Posted_articles_zero_total'] = "Our users have posted a total of <b>0</b> article"; // Number of posts $lang['Posted_articles_total'] = "Our users have posted a total of <b>%d</b> articles"; // Number of posts -$lang['Registered_user_total'] = "We have <b>%d</b> registered user"; // # registered users +$lang['Posted_article_total'] = "Our users have posted a total of <b>%d</b> article"; // Number of posts +$lang['Registered_users_zero_total'] = "We have <b>0</b> registered users"; // # registered users $lang['Registered_users_total'] = "We have <b>%d</b> registered users"; // # registered users +$lang['Registered_user_total'] = "We have <b>%d</b> registered user"; // # registered users $lang['Newest_user'] = "The newest registered user is <b>%s%s%s</b>"; // a href, username, /a $lang['No_new_posts_last_visit'] = "No new posts since your last visit"; @@ -764,11 +770,14 @@ $lang['You_been_banned'] = "You have been banned from this forum<br />Please con // // Viewonline // -$lang['Reg_user_online'] = "There is %d Registered user and "; // There ae 5 Registered and +$lang['Reg_users_zero_online'] = "There are 0 Registered users and "; // There ae 5 Registered and $lang['Reg_users_online'] = "There are %d Registered users and "; // There ae 5 Registered and -$lang['Hidden_user_online'] = "%d Hidden user online"; // 6 Hidden users online +$lang['Reg_user_online'] = "There is %d Registered user and "; // There ae 5 Registered and +$lang['Hidden_users_zero_online'] = "0 Hidden users online"; // 6 Hidden users online $lang['Hidden_users_online'] = "%d Hidden users online"; // 6 Hidden users online +$lang['Hidden_user_online'] = "%d Hidden user online"; // 6 Hidden users online $lang['Guest_users_online'] = "There are %d Guest users online"; // There are 10 Guest users online +$lang['Guest_users_zero_online'] = "There are 0 Guest users online"; // There are 10 Guest users online $lang['Guest_user_online'] = "There is %d Guest user online"; // There is 1 Guest user online $lang['No_users_browsing'] = "There are no users currently browsing this forum"; @@ -961,4 +970,4 @@ $lang['A_critical_error'] = "A Critical Error Occurred"; // That's all Folks! // ------------------------------------------------- -?> +?>
\ No newline at end of file diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 612821f350..d7ae7989f1 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -231,8 +231,31 @@ if( count($onlinerow_reg) ) } } - $l_r_user_s = ( $registered_users == 1 ) ? $lang['Reg_user_online'] : $lang['Reg_users_online']; - $l_h_user_s = ( $hidden_users == 1 ) ? $lang['Hidden_user_online'] : $lang['Hidden_users_online']; + if( $registered_users == 0 ) + { + $l_r_user_s = $lang['Reg_users_zero_online']; + } + else if( $registered_users == 1 ) + { + $l_r_user_s = $lang['Reg_user_online']; + } + else + { + $l_r_user_s = $lang['Reg_users_online']; + } + + if( $hidden_users == 0 ) + { + $l_h_user_s = $lang['Hidden_users_zero_online']; + } + else if( $hidden_users == 1 ) + { + $l_h_user_s = $lang['Hidden_user_online']; + } + else + { + $l_h_user_s = $lang['Hidden_users_online']; + } $template->assign_vars(array( "TOTAL_REGISTERED_USERS_ONLINE" => sprintf($l_r_user_s, $registered_users) . sprintf($l_h_user_s, $hidden_users)) @@ -324,7 +347,18 @@ if( count($onlinerow_guest) ) ); } - $l_g_user_s = ( $guest_users == 1 ) ? $lang['Guest_user_online'] : $lang['Guest_users_online']; + if( $guest_users == 0 ) + { + $l_g_user_s = $lang['Guest_users_zero_online']; + } + else if( $guest_users == 1 ) + { + $l_g_user_s = $lang['Guest_user_online']; + } + else + { + $l_g_user_s = $lang['Guest_users_online']; + } $template->assign_vars(array( "TOTAL_GUEST_USERS_ONLINE" => sprintf($l_g_user_s, $guest_users)) |