mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
[ticket/11959] Remove use of plurals and make it possible to use Oxford comma.
PHPBB3-11959
This commit is contained in:
parent
3da1f6d989
commit
7c1ab5f79d
2 changed files with 19 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Reference in a new issue