code.gitea.io/gitea@v1.21.7/models/shared/types/ownertype.go (about)

     1  // Copyright 2023 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package types
     5  
     6  import "code.gitea.io/gitea/modules/translation"
     7  
     8  type OwnerType string
     9  
    10  const (
    11  	OwnerTypeSystemGlobal = "system-global"
    12  	OwnerTypeIndividual   = "individual"
    13  	OwnerTypeRepository   = "repository"
    14  	OwnerTypeOrganization = "organization"
    15  )
    16  
    17  func (o OwnerType) LocaleString(locale translation.Locale) string {
    18  	switch o {
    19  	case OwnerTypeSystemGlobal:
    20  		return locale.Tr("concept_system_global")
    21  	case OwnerTypeIndividual:
    22  		return locale.Tr("concept_user_individual")
    23  	case OwnerTypeRepository:
    24  		return locale.Tr("concept_code_repository")
    25  	case OwnerTypeOrganization:
    26  		return locale.Tr("concept_user_organization")
    27  	}
    28  	return locale.Tr("unknown")
    29  }