mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
https://mattermost.atlassian.net/browse/MM-57378 ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
24 lines
499 B
Go
24 lines
499 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package utils
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
|
)
|
|
|
|
func JoinList(items []string) string {
|
|
if len(items) == 0 {
|
|
return ""
|
|
} else if len(items) == 1 {
|
|
return items[0]
|
|
}
|
|
return i18n.T(
|
|
"humanize.list_join",
|
|
map[string]any{
|
|
"OtherItems": strings.Join(items[:len(items)-1], ", "),
|
|
"LastItem": items[len(items)-1],
|
|
})
|
|
}
|