1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11959] Remove use of plurals and make it possible to use Oxford comma.

PHPBB3-11959
This commit is contained in:
Cesar G
2014-03-19 03:03:20 -07:00
parent 3da1f6d989
commit 7c1ab5f79d
2 changed files with 19 additions and 12 deletions

View File

@@ -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)
{
$count = sizeof($items);
$last_item = '';
if ($count > 1)
if (empty($items))
{
$last_item = array_pop($items);
return '';
}
$count = sizeof($items);
$last_item = array_pop($items);
$lang_key = 'STRING_LIST_MULTI';
if ($count == 1)
{
return $last_item;
}
else if ($count == 2)
{
$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);
}