From daa69ecfa97c5462835e42b1046ba91b7abe3469 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 29 Apr 2014 00:44:32 +0200 Subject: [PATCH 1/4] [ticket/12451] Split TOO_FEW_CHARS_LIMIT for plurals PHPBB3-12451 --- phpBB/includes/message_parser.php | 2 +- phpBB/language/en/posting.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 17a350bab3..5de925b6ae 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1137,7 +1137,7 @@ class parse_message extends bbcode_firstpass { if (!$message_length || $message_length < (int) $config['min_post_chars']) { - $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : $user->lang('TOO_FEW_CHARS_LIMIT', $message_length, (int) $config['min_post_chars']); + $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('TOO_FEW_CHARS_CONTAINS', $message_length) . ' ' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); return (!$update_this_message) ? $return_message : $this->warn_msg; } } diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index e3b6101310..29ca7d82c8 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -227,9 +227,13 @@ $lang = array_merge($lang, array( 'STYLES_TIP' => 'Tip: Styles can be applied quickly to selected text.', 'TOO_FEW_CHARS' => 'Your message contains too few characters.', + 'TOO_FEW_CHARS_CONTAINS' => array( + 1 => 'Your message contains %1$d character.', + 2 => 'Your message contains %1$d characters.', + ), 'TOO_FEW_CHARS_LIMIT' => array( - 1 => 'Your message contains %1$d character. The minimum number of characters you need to enter is %2$d.', - 2 => 'Your message contains %1$d characters. The minimum number of characters you need to enter is %2$d.', + 1 => 'You need to enter at least %1$d character.', + 2 => 'You need to enter at least %1$d characters.', ), 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attachment, %d is the maximum.', From d7c0d604b56791481200fec2ebacb71615e303b0 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 29 Apr 2014 00:53:57 +0200 Subject: [PATCH 2/4] [ticket/12451] Split TOO_MANY_CHARS vars for plurals PHPBB3-12451 --- phpBB/includes/message_parser.php | 2 +- phpBB/language/en/posting.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 5de925b6ae..8b64f700d3 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1128,7 +1128,7 @@ class parse_message extends bbcode_firstpass // Maximum message length check. 0 disables this check completely. if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars']) { - $this->warn_msg[] = $user->lang('TOO_MANY_CHARS_' . strtoupper($mode), $message_length, (int) $config['max_' . $mode . '_chars']); + $this->warn_msg[] = $user->lang('TOO_MANY_CHARS_' . strtoupper($mode), $message_length) . ' ' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); return (!$update_this_message) ? $return_message : $this->warn_msg; } diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 29ca7d82c8..600bc2dd9f 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -238,11 +238,14 @@ $lang = array_merge($lang, array( 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attachment, %d is the maximum.', 'TOO_MANY_CHARS' => 'Your message contains too many characters.', + 'TOO_MANY_CHARS_LIMIT' => array( + 2 => 'The maximum number of allowed characters is %1$d.', + ), 'TOO_MANY_CHARS_POST' => array( - 2 => 'Your message contains %1$d characters. The maximum number of allowed characters is %2$d.', + 2 => 'Your message contains %1$d characters.', ), 'TOO_MANY_CHARS_SIG' => array( - 2 => 'Your signature contains %1$d characters. The maximum number of allowed characters is %2$d.', + 2 => 'Your signature contains %1$d characters.', ), 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', 'TOO_MANY_SMILIES' => 'Your message contains too many smilies. The maximum number of smilies allowed is %d.', From 1f76a95bf61669444e4f69f83494f1ddf8f7b34a Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 2 May 2014 23:20:05 +0200 Subject: [PATCH 3/4] [ticket/12451] Use new line to concatenate strings PHPBB3-12451 --- phpBB/includes/message_parser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 8b64f700d3..2578f50b27 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1128,7 +1128,7 @@ class parse_message extends bbcode_firstpass // Maximum message length check. 0 disables this check completely. if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars']) { - $this->warn_msg[] = $user->lang('TOO_MANY_CHARS_' . strtoupper($mode), $message_length) . ' ' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); + $this->warn_msg[] = $user->lang('TOO_MANY_CHARS_' . strtoupper($mode), $message_length) . '
' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); return (!$update_this_message) ? $return_message : $this->warn_msg; } @@ -1137,7 +1137,7 @@ class parse_message extends bbcode_firstpass { if (!$message_length || $message_length < (int) $config['min_post_chars']) { - $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('TOO_FEW_CHARS_CONTAINS', $message_length) . ' ' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); + $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('TOO_FEW_CHARS_CONTAINS', $message_length) . '
' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); return (!$update_this_message) ? $return_message : $this->warn_msg; } } From b7fde768528a1f3e17280b728c7781c4f262e8d1 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 2 May 2014 23:55:30 +0200 Subject: [PATCH 4/4] [ticket/12451] Remove duplicated lang var PHPBB3-12451 --- phpBB/includes/message_parser.php | 4 ++-- phpBB/language/en/posting.php | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 2578f50b27..901bafbb2e 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1128,7 +1128,7 @@ class parse_message extends bbcode_firstpass // Maximum message length check. 0 disables this check completely. if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars']) { - $this->warn_msg[] = $user->lang('TOO_MANY_CHARS_' . strtoupper($mode), $message_length) . '
' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); + $this->warn_msg[] = $user->lang('CHARS_' . strtoupper($mode) . '_CONTAINS', $message_length) . '
' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); return (!$update_this_message) ? $return_message : $this->warn_msg; } @@ -1137,7 +1137,7 @@ class parse_message extends bbcode_firstpass { if (!$message_length || $message_length < (int) $config['min_post_chars']) { - $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('TOO_FEW_CHARS_CONTAINS', $message_length) . '
' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); + $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('CHARS_POST_CONTAINS', $message_length) . '
' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); return (!$update_this_message) ? $return_message : $this->warn_msg; } } diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 600bc2dd9f..5068f60573 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -70,6 +70,14 @@ $lang = array_merge($lang, array( 'CANNOT_POST_ANNOUNCE' => 'Sorry but you cannot post announcements.', 'CANNOT_POST_STICKY' => 'Sorry but you cannot post sticky topics.', 'CHANGE_TOPIC_TO' => 'Change topic type to', + 'CHARS_POST_CONTAINS' => array( + 1 => 'Your message contains %1$d character.', + 2 => 'Your message contains %1$d characters.', + ), + 'CHARS_SIG_CONTAINS' => array( + 1 => 'Your signature contains %1$d character.', + 2 => 'Your signature contains %1$d characters.', + ), 'CLOSE_TAGS' => 'Close tags', 'CURRENT_TOPIC' => 'Current topic', @@ -227,10 +235,6 @@ $lang = array_merge($lang, array( 'STYLES_TIP' => 'Tip: Styles can be applied quickly to selected text.', 'TOO_FEW_CHARS' => 'Your message contains too few characters.', - 'TOO_FEW_CHARS_CONTAINS' => array( - 1 => 'Your message contains %1$d character.', - 2 => 'Your message contains %1$d characters.', - ), 'TOO_FEW_CHARS_LIMIT' => array( 1 => 'You need to enter at least %1$d character.', 2 => 'You need to enter at least %1$d characters.', @@ -241,12 +245,6 @@ $lang = array_merge($lang, array( 'TOO_MANY_CHARS_LIMIT' => array( 2 => 'The maximum number of allowed characters is %1$d.', ), - 'TOO_MANY_CHARS_POST' => array( - 2 => 'Your message contains %1$d characters.', - ), - 'TOO_MANY_CHARS_SIG' => array( - 2 => 'Your signature contains %1$d characters.', - ), 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', 'TOO_MANY_SMILIES' => 'Your message contains too many smilies. The maximum number of smilies allowed is %d.', 'TOO_MANY_URLS' => 'Your message contains too many URLs. The maximum number of URLs allowed is %d.',