mirror of
https://github.com/flarum/framework.git
synced 2025-02-01 06:29:45 +08:00
Concatenate items in {second}, not {first}
This commit is contained in:
parent
47b5919480
commit
a48f396649
|
@ -16,17 +16,17 @@ export default function punctuateSeries(items) {
|
||||||
second: items[1]
|
second: items[1]
|
||||||
});
|
});
|
||||||
} else if (items.length >= 3) {
|
} else if (items.length >= 3) {
|
||||||
// If there are three or more items, we will join all of the items up until
|
// If there are three or more items, we will join all but the first and
|
||||||
// the second-to-last one with the equivalent of a comma, and then we will
|
// last items with the equivalent of a comma, and then we will feed that
|
||||||
// feed that into the translator along with the last two items.
|
// into the translator along with the first and last item.
|
||||||
const first = items
|
const second = items
|
||||||
.slice(0, items.length - 2)
|
.slice(1, items.length - 1)
|
||||||
.reduce((list, item) => list.concat([item, app.trans('core.lib.series_glue_text')]), [])
|
.reduce((list, item) => list.concat([item, app.trans('core.lib.series_glue_text')]), [])
|
||||||
.slice(0, -1);
|
.slice(0, -1);
|
||||||
|
|
||||||
return app.trans('core.lib.series_three_text', {
|
return app.trans('core.lib.series_three_text', {
|
||||||
first,
|
first: items[0],
|
||||||
second: items[items.length - 2],
|
second,
|
||||||
third: items[items.length - 1]
|
third: items[items.length - 1]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user