diff options
| author | Cesar G <prototech91@gmail.com> | 2014-02-07 14:56:14 -0800 | 
|---|---|---|
| committer | Cesar G <prototech91@gmail.com> | 2014-03-19 03:08:33 -0700 | 
| commit | 285ad0f6faac275c56576616ed6a880a7f88e94b (patch) | |
| tree | 0e64dbd8327004dae47f0798b428684e7131e5fb | |
| parent | f0a85a90cc61859d1821960b8e3c50a8187202a7 (diff) | |
| download | forums-285ad0f6faac275c56576616ed6a880a7f88e94b.tar forums-285ad0f6faac275c56576616ed6a880a7f88e94b.tar.gz forums-285ad0f6faac275c56576616ed6a880a7f88e94b.tar.bz2 forums-285ad0f6faac275c56576616ed6a880a7f88e94b.tar.xz forums-285ad0f6faac275c56576616ed6a880a7f88e94b.zip  | |
[ticket/11959] Simplify how the users are trimmed.
PHPBB3-11959
| -rw-r--r-- | phpBB/language/en/common.php | 44 | ||||
| -rw-r--r-- | phpBB/phpbb/notification/type/post.php | 22 | 
2 files changed, 27 insertions, 39 deletions
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index e84033f1b7..757e421759 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -424,41 +424,28 @@ $lang = array_merge($lang, array(  	'NOT_WATCHING_FORUM'		=> 'You are no longer subscribed to updates on this forum.',  	'NOT_WATCHING_TOPIC'		=> 'You are no longer subscribed to this topic.',  	'NOTIFICATIONS'				=> 'Notifications', -	// This is used for a list of up to 4 users. 5 users or more uses _TRIMMED. +	// This applies for NOTIFICATION_BOOKMARK, NOTIFICATION_POST, and NOTIFICATION_QUOTE. +	// %1$s will return a list of users that's concatenated using "," and "and" - see STRING_LIST +	// Once the user count reaches 5 users or more, the list is trimmed using NOTIFICATION_X_OTHERS +	// Examples: +	// A replied... +	// A and B replied... +	// A, B and C replied... +	// A, B, C and 2 others replied...  	'NOTIFICATION_BOOKMARK'				=> array( -		1	=> '%1$s replied to the topic “%3$s” you have bookmarked.', -		// X, Y, and Z replied to the topic “Test” you have bookmarked. -		2	=> '%1$s and %2$s replied to the topic “%3$s” you have bookmarked.', -	), -	// X, Y, Z and 2 others replied to the topic “Test” you have bookmarked. -	'NOTIFICATION_BOOKMARK_TRIMMED'		=> array( -		2	=> '%1$s and %4$d others replied to the topic “%3$s” you have bookmarked.', +		1	=> '%1$s replied to the topic “%2$s” you have bookmarked.',  	),  	'NOTIFICATION_GROUP_REQUEST'		=> '%1$s is requesting to join the group %2$s.',  	'NOTIFICATION_GROUP_REQUEST_APPROVED'	=> 'Your request to join the group %1$s has been approved.',  	'NOTIFICATION_PM'					=> '%1$s sent you a Private Message "%2$s".', -	// This is used for a list of up to 4 users. 5 users or more uses _TRIMMED.  	'NOTIFICATION_POST'					=> array( -		1	=> '%1$s replied to the topic “%3$s”.', -		// X, Y, and Z replied to the topic “Test”. -		2	=> '%1$s and %2$s replied to the topic “%3$s”.', -	), -	// X, Y, Z and 2 others replied to the topic “Test”. -	'NOTIFICATION_POST_TRIMMED'			=> array( -		2	=> '%1$s and %4$d others replied to the topic “%3$s”', +		1	=> '%1$s replied to the topic “%2$s”.',  	),  	'NOTIFICATION_POST_APPROVED'		=> 'Your post was approved "%2$s".',  	'NOTIFICATION_POST_DISAPPROVED'		=> 'Your post "%1$s" was disapproved for reason: "%2$s".',  	'NOTIFICATION_POST_IN_QUEUE'		=> 'A new post titled "%2$s" was posted by %1$s and needs approval.', -	// This is used for a list of up to 4 users. 5 users or more uses _TRIMMED.  	'NOTIFICATION_QUOTE'				=> array( -		1	=> '%1$s quoted you in the post “%3$s”.', -		// X, Y, and Z quoted you in the post “Re: Test”. -		2	=> '%1$s and %2$s quoted you in the post “%3$s”.', -	), -	// X, Y, Z and 2 others quoted you in the post “Re: Test”. -	'NOTIFICATION_QUOTE_TRIMMED'		=> array( -		2	=> '%1$s and %4$d quoted you in the post “%3$s”', +		1	=> '%1$s quoted you in the post “%2$s”.',  	),  	'NOTIFICATION_REPORT_PM'			=> '%1$s reported a Private Message "%2$s" for reason: "%3$s".',  	'NOTIFICATION_REPORT_POST'			=> '%1$s reported a post "%2$s" for reason: "%3$s".', @@ -469,6 +456,10 @@ $lang = array_merge($lang, array(  	'NOTIFICATION_TOPIC_IN_QUEUE'		=> 'A new topic titled "%2$s" was posted by %1$s and needs approval.',  	'NOTIFICATION_TYPE_NOT_EXIST'		=> 'The notification type "%s" is missing from the file system.',  	'NOTIFICATION_ADMIN_ACTIVATE_USER'	=> 'The user “%1$s” is newly registered and requires activation.', +	// Used in conjuction with NOTIFICATION_BOOKMARK, NOTIFICATION_POST, and NOTIFICATION_QUOTE. +	'NOTIFICATION_X_OTHERS'				=> array( +		2	=> '%d others', +	),  	'NOTIFY_ADMIN'				=> 'Please notify the board administrator or webmaster.',  	'NOTIFY_ADMIN_EMAIL'		=> 'Please notify the board administrator or webmaster: <a href="mailto:%1$s">%1$s</a>',  	'NO_ACCESS_ATTACHMENT'		=> 'You are not allowed to access this file.', @@ -692,6 +683,11 @@ $lang = array_merge($lang, array(  	'START_WATCHING_TOPIC'		=> 'Subscribe topic',  	'STOP_WATCHING_FORUM'		=> 'Unsubscribe forum',  	'STOP_WATCHING_TOPIC'		=> 'Unsubscribe topic', +	'STRING_LIST'				=> array( +		1 => '%1$s', +		2 => '%1$s and %2$s', +		// At 3 or more, %1$s returns comma separated items. So output would be: X, Y and Z +	),  	'SUBFORUM'					=> 'Subforum',  	'SUBFORUMS'					=> 'Subforums',  	'SUBJECT'					=> 'Subject', diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 944023cba4..62c8bd52cb 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -205,30 +205,22 @@ class post extends \phpbb\notification\type\base  				$usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile');  			}  		} -		$last_user = ''; -		$lang_key = $this->language_key;  		if ($trimmed_responders_cnt)  		{ -			$lang_key .= '_TRIMMED'; -			$lang_user_cnt = $trimmed_responders_cnt; +			$usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt);  		} -		else -		{ -			$lang_user_cnt = $responders_cnt; -			if ($responders_cnt > 1) -			{ -				$last_user = array_pop($usernames); -			} +		if (!function_exists('phpbb_gen_string_list')) +		{ +			include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ex);  		}  		return $this->user->lang( -			$lang_key, -			implode($this->user->lang['COMMA_SEPARATOR'], $usernames), -			$last_user, +			$this->language_key, +			phpbb_gen_string_list($usernames, $this->user),  			censor_text($this->get_data('topic_title')), -			$lang_user_cnt +			$responders_cnt  		);  	}  | 
