summaryrefslogtreecommitdiffstats
path: root/models/shared/types/ownertype.go
blob: a1d46c986f9cc416f17335abb9283f3eee1694b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package types

import "code.gitea.io/gitea/modules/translation"

type OwnerType string

const (
	OwnerTypeSystemGlobal = "system-global"
	OwnerTypeIndividual   = "individual"
	OwnerTypeRepository   = "repository"
	OwnerTypeOrganization = "organization"
)

func (o OwnerType) LocaleString(locale translation.Locale) string {
	switch o {
	case OwnerTypeSystemGlobal:
		return locale.TrString("concept_system_global")
	case OwnerTypeIndividual:
		return locale.TrString("concept_user_individual")
	case OwnerTypeRepository:
		return locale.TrString("concept_code_repository")
	case OwnerTypeOrganization:
		return locale.TrString("concept_user_organization")
	}
	return locale.TrString("unknown")
}