mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:11:47 +02:00
[ticket/11959] Remove use of plurals and make it possible to use Oxford comma.
PHPBB3-11959
This commit is contained in:
@@ -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 array $items Array of items to concatenate
|
||||||
* @param object $user The phpBB $user object.
|
* @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)
|
function phpbb_generate_string_list($items, $user)
|
||||||
{
|
{
|
||||||
$count = sizeof($items);
|
if (empty($items))
|
||||||
$last_item = '';
|
|
||||||
|
|
||||||
if ($count > 1)
|
|
||||||
{
|
{
|
||||||
$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);
|
$list = implode($user->lang['COMMA_SEPARATOR'], $items);
|
||||||
|
|
||||||
return $user->lang('STRING_LIST', $list, $last_item, $count);
|
return $user->lang($lang_key, $list, $last_item);
|
||||||
}
|
}
|
||||||
|
@@ -683,11 +683,8 @@ $lang = array_merge($lang, array(
|
|||||||
'START_WATCHING_TOPIC' => 'Subscribe topic',
|
'START_WATCHING_TOPIC' => 'Subscribe topic',
|
||||||
'STOP_WATCHING_FORUM' => 'Unsubscribe forum',
|
'STOP_WATCHING_FORUM' => 'Unsubscribe forum',
|
||||||
'STOP_WATCHING_TOPIC' => 'Unsubscribe topic',
|
'STOP_WATCHING_TOPIC' => 'Unsubscribe topic',
|
||||||
'STRING_LIST' => array(
|
'STRING_LIST_MULTI' => '%1$s, and %2$s',
|
||||||
1 => '%1$s',
|
'STRING_LIST_SIMPLE' => '%1$s and %2$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',
|
'SUBFORUM' => 'Subforum',
|
||||||
'SUBFORUMS' => 'Subforums',
|
'SUBFORUMS' => 'Subforums',
|
||||||
'SUBJECT' => 'Subject',
|
'SUBJECT' => 'Subject',
|
||||||
|
Reference in New Issue
Block a user