aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCesar G <prototech91@gmail.com>2014-03-19 03:03:20 -0700
committerCesar G <prototech91@gmail.com>2014-03-19 03:08:34 -0700
commit7c1ab5f79d621f210fa1bdea0e9b217a10c20fa9 (patch)
tree41ce6806f6008eb6fa0ff4b2a5e5a0d5ca208e10
parent3da1f6d989357c9076ffde532cfbbd3d6375aa3c (diff)
downloadforums-7c1ab5f79d621f210fa1bdea0e9b217a10c20fa9.tar
forums-7c1ab5f79d621f210fa1bdea0e9b217a10c20fa9.tar.gz
forums-7c1ab5f79d621f210fa1bdea0e9b217a10c20fa9.tar.bz2
forums-7c1ab5f79d621f210fa1bdea0e9b217a10c20fa9.tar.xz
forums-7c1ab5f79d621f210fa1bdea0e9b217a10c20fa9.zip
[ticket/11959] Remove use of plurals and make it possible to use Oxford comma.
PHPBB3-11959
-rw-r--r--phpBB/includes/functions_display.php20
-rw-r--r--phpBB/language/en/common.php7
2 files changed, 17 insertions, 10 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 311f86296d..d760f09dcd 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1506,18 +1506,28 @@ function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $php
* @param array $items Array of items to concatenate
* @param object $user The phpBB $user object.
*
-* @return string String list. Examples: "A"; "A and B"; "A, B and C"
+* @return string String list. Examples: "A"; "A and B"; "A, B, and C"
*/
function phpbb_generate_string_list($items, $user)
{
+ if (empty($items))
+ {
+ return '';
+ }
+
$count = sizeof($items);
- $last_item = '';
+ $last_item = array_pop($items);
+ $lang_key = 'STRING_LIST_MULTI';
- if ($count > 1)
+ if ($count == 1)
+ {
+ return $last_item;
+ }
+ else if ($count == 2)
{
- $last_item = array_pop($items);
+ $lang_key = 'STRING_LIST_SIMPLE';
}
$list = implode($user->lang['COMMA_SEPARATOR'], $items);
- return $user->lang('STRING_LIST', $list, $last_item, $count);
+ return $user->lang($lang_key, $list, $last_item);
}
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 757e421759..f073954817 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -683,11 +683,8 @@ $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
- ),
+ 'STRING_LIST_MULTI' => '%1$s, and %2$s',
+ 'STRING_LIST_SIMPLE' => '%1$s and %2$s',
'SUBFORUM' => 'Subforum',
'SUBFORUMS' => 'Subforums',
'SUBJECT' => 'Subject',