Localize collaboration settings. (#3100)

Closes #2764
This commit is contained in:
Andrey Nering 2016-06-27 13:22:30 -03:00 committed by 无闻
parent 73b4acbb63
commit 6efb1e5626
3 changed files with 14 additions and 9 deletions

View File

@ -561,6 +561,10 @@ wiki.last_updated = Last updated %s
settings = Settings settings = Settings
settings.options = Options settings.options = Options
settings.collaboration = Collaboration settings.collaboration = Collaboration
settings.collaboration.admin = Admin
settings.collaboration.write = Write
settings.collaboration.read = Read
settings.collaboration.undefined = Undefined
settings.hooks = Webhooks settings.hooks = Webhooks
settings.githooks = Git Hooks settings.githooks = Git Hooks
settings.basic_settings = Basic Settings settings.basic_settings = Basic Settings

View File

@ -16,16 +16,17 @@ type Collaboration struct {
Mode AccessMode `xorm:"DEFAULT 2 NOT NULL"` Mode AccessMode `xorm:"DEFAULT 2 NOT NULL"`
} }
func (c *Collaboration) ModeName() string { func (c *Collaboration) ModeI18nKey() string {
switch c.Mode { switch c.Mode {
case ACCESS_MODE_READ: case ACCESS_MODE_READ:
return "Read" return "repo.settings.collaboration.read"
case ACCESS_MODE_WRITE: case ACCESS_MODE_WRITE:
return "Write" return "repo.settings.collaboration.write"
case ACCESS_MODE_ADMIN: case ACCESS_MODE_ADMIN:
return "Admin" return "repo.settings.collaboration.admin"
default:
return "repo.settings.collaboration.undefined"
} }
return "Undefined"
} }
// AddCollaborator adds new collaboration relation between an individual and a repository. // AddCollaborator adds new collaboration relation between an individual and a repository.

View File

@ -21,12 +21,12 @@
<div class="ui eight wide column"> <div class="ui eight wide column">
<span class="octicon octicon-shield"></span> <span class="octicon octicon-shield"></span>
<div class="ui inline dropdown"> <div class="ui inline dropdown">
<div class="text">{{.Collaboration.ModeName}}</div> <div class="text">{{$.i18n.Tr .Collaboration.ModeI18nKey}}</div>
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
<div class="access-mode menu" data-url="{{$.Link}}/access_mode" data-uid="{{.Id}}"> <div class="access-mode menu" data-url="{{$.Link}}/access_mode" data-uid="{{.Id}}">
<div class="item" data-text="Admin" data-value="3">Admin</div> <div class="item" data-text="{{$.i18n.Tr "repo.settings.collaboration.admin"}}" data-value="3">{{$.i18n.Tr "repo.settings.collaboration.admin"}}</div>
<div class="item" data-text="Write" data-value="2">Write</div> <div class="item" data-text="{{$.i18n.Tr "repo.settings.collaboration.write"}}" data-value="2">{{$.i18n.Tr "repo.settings.collaboration.write"}}</div>
<div class="item" data-text="Read" data-value="1">Read</div> <div class="item" data-text="{{$.i18n.Tr "repo.settings.collaboration.read"}}" data-value="1">{{$.i18n.Tr "repo.settings.collaboration.read"}}</div>
</div> </div>
</div> </div>
</div> </div>