aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
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 /phpBB/includes
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
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_display.php20
1 files changed, 15 insertions, 5 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);
}