extract and complete team translations

pull/6012/head
Thibault Duplessis 2020-02-10 10:25:44 -06:00
parent dd912d7ff9
commit 5f6eb9f23c
14 changed files with 115 additions and 76 deletions

View File

@ -301,7 +301,7 @@ object layout {
href := routes.Team.requests,
dataCount := ctx.teamNbRequests,
dataIcon := "f",
title := trans.teams.txt()
title := trans.team.teams.txt()
)
def apply(playing: Boolean)(implicit ctx: Context) =

View File

@ -60,7 +60,7 @@ object topnav {
linkTitle(routes.User.list.toString, trans.community()),
div(role := "group")(
a(href := routes.User.list)(trans.players()),
a(href := routes.Team.home())(trans.teams()),
a(href := routes.Team.home())(trans.team.teams()),
ctx.noKid option a(href := routes.ForumCateg.index)(trans.forum())
)
),

View File

@ -8,16 +8,18 @@ import controllers.routes
object admin {
import trans.team._
def changeOwner(t: lila.team.Team, userIds: Iterable[lila.user.User.ID])(implicit ctx: Context) = {
val title = s"Change owner of Team ${t.name}"
val title = s"${t.name} - ${appointOwner.txt()}"
bits.layout(title = title) {
main(cls := "page-menu page-small")(
bits.menu(none),
div(cls := "page-menu__content box box-pad")(
h1(title),
p("Who do you want to make owner of this team?"),
p(trans.team.changeOwner()),
br,
br,
postForm(cls := "kick", action := routes.Team.changeOwner(t.id))(
@ -34,14 +36,14 @@ object admin {
def kick(t: lila.team.Team, userIds: Iterable[lila.user.User.ID])(implicit ctx: Context) = {
val title = s"Kick from Team ${t.name}"
val title = s"${t.name} - ${kickSomeone.txt()}"
bits.layout(title = title) {
main(cls := "page-menu page-small")(
bits.menu(none),
div(cls := "page-menu__content box box-pad")(
h1(title),
p("Who do you want to kick out of the team?"),
p(whoToKick()),
br,
br,
postForm(cls := "kick", action := routes.Team.kick(t.id))(

View File

@ -8,23 +8,24 @@ import controllers.routes
object bits {
import trans.team._
def menu(currentTab: Option[String])(implicit ctx: Context) = ~currentTab |> { tab =>
st.nav(cls := "page-menu__menu subnav")(
(ctx.teamNbRequests > 0) option
a(cls := tab.active("requests"), href := routes.Team.requests())(
ctx.teamNbRequests,
" join requests"
xJoinRequests(ctx.teamNbRequests)
),
ctx.isAuth option
a(cls := tab.active("mine"), href := routes.Team.mine())(
trans.myTeams()
myTeams()
),
a(cls := tab.active("all"), href := routes.Team.all())(
trans.allTeams()
allTeams()
),
ctx.isAuth option
a(cls := tab.active("form"), href := routes.Team.form())(
trans.newTeam()
newTeam()
)
)
}
@ -42,7 +43,7 @@ object bits {
shorten(t.description, 200)
),
td(cls := "info")(
p(trans.nbMembers.plural(t.nbMembers, t.nbMembers.localize))
p(nbMembers.plural(t.nbMembers, t.nbMembers.localize))
)
)

View File

@ -10,23 +10,25 @@ import controllers.routes
object form {
import trans.team._
def create(form: Form[_], captcha: lila.common.Captcha)(implicit ctx: Context) =
views.html.base.layout(
title = trans.newTeam.txt(),
title = newTeam.txt(),
moreCss = cssTag("team"),
moreJs = frag(infiniteScrollTag, captchaTag)
) {
main(cls := "page-menu page-small")(
bits.menu("form".some),
div(cls := "page-menu__content box box-pad")(
h1(trans.newTeam()),
h1(newTeam()),
postForm(cls := "form3", action := routes.Team.create())(
form3.globalError(form),
form3.group(form("name"), trans.name())(form3.input(_)),
form3.group(form("open"), trans.joiningPolicy()) { _ =>
form3.group(form("open"), joiningPolicy()) { _ =>
form3.select(
form("open"),
Seq(0 -> trans.aConfirmationIsRequiredToJoin.txt(), 1 -> trans.anyoneCanJoin.txt())
Seq(0 -> aConfirmationIsRequiredToJoin.txt(), 1 -> anyoneCanJoin.txt())
)
},
form3.group(form("location"), trans.location())(form3.input(_)),
@ -34,7 +36,7 @@ object form {
views.html.base.captcha(form, captcha),
form3.actions(
a(href := routes.Team.home(1))(trans.cancel()),
form3.submit(trans.newTeam())
form3.submit(newTeam())
)
)
)
@ -50,15 +52,13 @@ object form {
h1(title),
postForm(cls := "form3", action := routes.Team.update(t.id))(
div(cls := "form-group")(
a(cls := "button button-empty", href := routes.Team.kick(t.id))("Kick someone out of the team"),
a(cls := "button button-empty", href := routes.Team.changeOwner(t.id))(
"Appoint another team owner"
)
a(cls := "button button-empty", href := routes.Team.kick(t.id))(kickSomeone()),
a(cls := "button button-empty", href := routes.Team.changeOwner(t.id))(appointOwner())
),
form3.group(form("open"), trans.joiningPolicy()) { f =>
form3.group(form("open"), joiningPolicy()) { f =>
form3.select(
f,
Seq(0 -> trans.aConfirmationIsRequiredToJoin.txt(), 1 -> trans.anyoneCanJoin.txt())
Seq(0 -> aConfirmationIsRequiredToJoin.txt(), 1 -> anyoneCanJoin.txt())
)
},
form3.group(form("location"), trans.location())(form3.input(_)),
@ -75,7 +75,7 @@ object form {
dataIcon := "q",
cls := "text button button-empty button-red confirm",
st.title := "Deletes the team and its memberships. Cannot be reverted!"
)("Delete")
)(trans.delete())
)
)
)

View File

@ -9,6 +9,8 @@ import controllers.routes
object list {
import trans.team._
def search(text: String, teams: Paginator[lila.team.Team])(implicit ctx: Context) = list(
name = trans.search.txt() + " \"" + text + "\"",
teams = teams,
@ -17,17 +19,17 @@ object list {
)
def all(teams: Paginator[lila.team.Team])(implicit ctx: Context) = list(
name = trans.teams.txt(),
name = trans.team.teams.txt(),
teams = teams,
nextPageUrl = n => routes.Team.all(n).url
)
def mine(teams: List[lila.team.Team])(implicit ctx: Context) =
bits.layout(title = trans.myTeams.txt()) {
bits.layout(title = myTeams.txt()) {
main(cls := "team-list page-menu")(
bits.menu("mine".some),
div(cls := "page-menu__content box")(
h1(trans.myTeams()),
h1(myTeams()),
table(cls := "slist slist-pad")(
if (teams.size > 0) tbody(teams.map(bits.teamTr(_)))
else noTeam()
@ -40,7 +42,7 @@ object list {
tr(
td(colspan := "2")(
br,
trans.noTeamFound()
noTeamFound()
)
)
)

View File

@ -11,9 +11,11 @@ import controllers.routes
object request {
import trans.team._
def requestForm(t: lila.team.Team, form: Form[_], captcha: lila.common.Captcha)(implicit ctx: Context) = {
val title = s"${trans.joinTeam.txt()} ${t.name}"
val title = s"${joinTeam.txt()} ${t.name}"
views.html.base.layout(
title = title,
@ -26,12 +28,12 @@ object request {
h1(title),
p(style := "margin:2em 0")(richText(t.description)),
postForm(cls := "form3", action := routes.Team.requestCreate(t.id))(
form3.group(form("message"), raw("Message"))(form3.textarea(_)()),
p("Your join request will be reviewed by the team leader."),
form3.group(form("message"), trans.message())(form3.textarea(_)()),
p(willBeReviewed()),
views.html.base.captcha(form, captcha),
form3.actions(
a(href := routes.Team.show(t.slug))(trans.cancel()),
form3.submit(trans.joinTeam())
form3.submit(joinTeam())
)
)
)

View File

@ -11,6 +11,8 @@ import controllers.routes
object show {
import trans.team._
def apply(t: Team, members: Paginator[lila.team.MemberWithUser], info: lila.app.mashup.TeamInfo)(
implicit ctx: Context
) =
@ -28,19 +30,19 @@ object show {
bits.menu(none),
div(cls := "team-show page-menu__content box team-show")(
div(cls := "box__top")(
h1(cls := "text", dataIcon := "f")(t.name, " ", em("TEAM")),
h1(cls := "text", dataIcon := "f")(t.name, " ", em(trans.team.team.txt().toUpperCase)),
div(
if (t.disabled) span(cls := "staff")("CLOSED")
else trans.nbMembers.plural(t.nbMembers, strong(t.nbMembers.localize))
else nbMembers.plural(t.nbMembers, strong(t.nbMembers.localize))
)
),
(info.mine || t.enabled) option div(cls := "team-show__content")(
st.section(cls := "team-show__meta")(
p(trans.teamLeader(), ": ", userIdLink(t.createdBy.some))
p(teamLeader(), ": ", userIdLink(t.createdBy.some))
),
div(cls := "team-show__members")(
st.section(cls := "recent-members")(
h2(trans.teamRecentMembers()),
h2(teamRecentMembers()),
div(cls := "userlist infinitescroll")(
pagerNext(members, np => routes.Team.show(t.id, np).url),
members.currentPageResults.map { member =>
@ -55,18 +57,18 @@ object show {
frag(br, trans.location(), ": ", richText(loc))
},
info.hasRequests option div(cls := "requests")(
h2(info.requests.size, " join requests"),
h2(xJoinRequests(info.requests.size)),
views.html.team.request.list(info.requests, t.some)
)
),
st.section(cls := "team-show__actions")(
(t.enabled && !info.mine) option frag(
if (info.requestedByMe) strong("Your join request is being reviewed by the team leader")
if (info.requestedByMe) strong(beingReviewed())
else ctx.isAuth option joinButton(t)
),
(info.mine && !info.createdByMe) option
postForm(cls := "quit", action := routes.Team.quit(t.id))(
submitButton(cls := "button button-empty button-red confirm")(trans.quitTeam.txt())
submitButton(cls := "button button-empty button-red confirm")(quitTeam.txt())
),
(info.createdByMe || isGranted(_.Admin)) option
a(href := routes.Team.edit(t.id), cls := "button button-empty text", dataIcon := "%")(
@ -77,7 +79,7 @@ object show {
href := routes.Tournament.teamBattleForm(t.id),
cls := "button button-empty text",
dataIcon := "g"
)("Team Battle")
)(teamBattle())
),
div(cls := "team-show__tour-forum")(
info.teamBattles.nonEmpty option frag(
@ -123,10 +125,10 @@ object show {
case "ecf" => joinAt(routes.Team.show("english-chess-players").url)
case _ =>
postForm(cls := "inline", action := routes.Team.join(t.id))(
submitButton(cls := "button button-green")(trans.joinTeam())
submitButton(cls := "button button-green")(joinTeam())
)
}
private def joinAt(url: String)(implicit ctx: Context) =
a(cls := "button button-green", href := url)(trans.joinTeam())
a(cls := "button button-green", href := url)(joinTeam())
}

View File

@ -2,7 +2,7 @@ const fs = require('fs-extra');
const parseString = require('xml2js').parseString;
const baseDir = 'translation/source';
const dbs = 'site arena emails learn activity coordinates study clas contact patron coach broadcast streamer tfa settings preferences'.split(' ');
const dbs = 'site arena emails learn activity coordinates study clas contact patron coach broadcast streamer tfa settings preferences team'.split(' ');
function ucfirst(s) {
return s.charAt(0).toUpperCase() + s.slice(1);

View File

@ -76,7 +76,7 @@ lazy val i18n = module("i18n",
MessageCompiler(
sourceDir = new File("translation/source"),
destDir = new File("translation/dest"),
dbs = "site arena emails learn activity coordinates study class contact patron coach broadcast streamer tfa settings preferences".split(' ').toList,
dbs = "site arena emails learn activity coordinates study class contact patron coach broadcast streamer tfa settings preferences team".split(' ').toList,
compileTo = (sourceManaged in Compile).value / "messages"
)
}.taskValue,

View File

@ -21,6 +21,7 @@ object I18nDb {
case object Tfa extends Ref
case object Settings extends Ref
case object Preferences extends Ref
case object Team extends Ref
val site: Messages = lila.i18n.db.site.Registry.load
val arena: Messages = lila.i18n.db.arena.Registry.load
@ -38,6 +39,7 @@ object I18nDb {
val tfa: Messages = lila.i18n.db.tfa.Registry.load
val settings: Messages = lila.i18n.db.settings.Registry.load
val preferences: Messages = lila.i18n.db.preferences.Registry.load
val team: Messages = lila.i18n.db.team.Registry.load
def apply(ref: Ref): Messages = ref match {
case Site => site
@ -56,6 +58,7 @@ object I18nDb {
case Tfa => tfa
case Settings => settings
case Preferences => preferences
case Team => team
}
val langs: Set[Lang] = site.keys.toSet

View File

@ -1,7 +1,7 @@
// Generated with bin/trans-dump.js
package lila.i18n
import I18nDb.{ Activity, Arena, Broadcast, Clas, Coach, Contact, Coordinates, Emails, Learn, Patron, Preferences, Settings, Site, Streamer, Study, Tfa }
import I18nDb.{ Activity, Arena, Broadcast, Clas, Coach, Contact, Coordinates, Emails, Learn, Patron, Preferences, Settings, Site, Streamer, Study, Team, Tfa }
// format: OFF
object I18nKeys {
@ -243,19 +243,6 @@ val `mustBeInTeam` = new Translated("mustBeInTeam", Site)
val `youAreNotInTeam` = new Translated("youAreNotInTeam", Site)
val `backToGame` = new Translated("backToGame", Site)
val `siteDescription` = new Translated("siteDescription", Site)
val `teams` = new Translated("teams", Site)
val `allTeams` = new Translated("allTeams", Site)
val `newTeam` = new Translated("newTeam", Site)
val `myTeams` = new Translated("myTeams", Site)
val `noTeamFound` = new Translated("noTeamFound", Site)
val `joinTeam` = new Translated("joinTeam", Site)
val `quitTeam` = new Translated("quitTeam", Site)
val `anyoneCanJoin` = new Translated("anyoneCanJoin", Site)
val `aConfirmationIsRequiredToJoin` = new Translated("aConfirmationIsRequiredToJoin", Site)
val `joiningPolicy` = new Translated("joiningPolicy", Site)
val `teamLeader` = new Translated("teamLeader", Site)
val `teamBestPlayers` = new Translated("teamBestPlayers", Site)
val `teamRecentMembers` = new Translated("teamRecentMembers", Site)
val `xJoinedTeamY` = new Translated("xJoinedTeamY", Site)
val `xCreatedTeamY` = new Translated("xCreatedTeamY", Site)
val `averageElo` = new Translated("averageElo", Site)
@ -734,7 +721,6 @@ val `moreThanNbRatedGames` = new Translated("moreThanNbRatedGames", Site)
val `moreThanNbPerfRatedGames` = new Translated("moreThanNbPerfRatedGames", Site)
val `needNbMorePerfGames` = new Translated("needNbMorePerfGames", Site)
val `needNbMoreGames` = new Translated("needNbMoreGames", Site)
val `nbMembers` = new Translated("nbMembers", Site)
val `nbImportedGames` = new Translated("nbImportedGames", Site)
val `nbFriendsOnline` = new Translated("nbFriendsOnline", Site)
val `nbFollowers` = new Translated("nbFollowers", Site)
@ -1513,4 +1499,30 @@ val `inputMovesWithTheKeyboard` = new Translated("inputMovesWithTheKeyboard", Pr
val `yourPreferencesHaveBeenSaved` = new Translated("yourPreferencesHaveBeenSaved", Preferences)
}
object team {
val `team` = new Translated("team", Team)
val `teams` = new Translated("teams", Team)
val `allTeams` = new Translated("allTeams", Team)
val `newTeam` = new Translated("newTeam", Team)
val `myTeams` = new Translated("myTeams", Team)
val `noTeamFound` = new Translated("noTeamFound", Team)
val `joinTeam` = new Translated("joinTeam", Team)
val `quitTeam` = new Translated("quitTeam", Team)
val `anyoneCanJoin` = new Translated("anyoneCanJoin", Team)
val `aConfirmationIsRequiredToJoin` = new Translated("aConfirmationIsRequiredToJoin", Team)
val `joiningPolicy` = new Translated("joiningPolicy", Team)
val `teamLeader` = new Translated("teamLeader", Team)
val `teamBestPlayers` = new Translated("teamBestPlayers", Team)
val `teamRecentMembers` = new Translated("teamRecentMembers", Team)
val `kickSomeone` = new Translated("kickSomeone", Team)
val `whoToKick` = new Translated("whoToKick", Team)
val `appointOwner` = new Translated("appointOwner", Team)
val `changeOwner` = new Translated("changeOwner", Team)
val `willBeReviewed` = new Translated("willBeReviewed", Team)
val `beingReviewed` = new Translated("beingReviewed", Team)
val `teamBattle` = new Translated("teamBattle", Team)
val `nbMembers` = new Translated("nbMembers", Team)
val `xJoinRequests` = new Translated("xJoinRequests", Team)
}
}

View File

@ -327,23 +327,6 @@
<string name="youAreNotInTeam">You are not in the team %s</string>
<string name="backToGame">Back to game</string>
<string name="siteDescription">Free online chess server. Play chess in a clean interface. No registration, no ads, no plugin required. Play chess with the computer, friends or random opponents.</string>
<string name="teams">Teams</string>
<plurals name="nbMembers">
<item quantity="one">%s member</item>
<item quantity="other">%s members</item>
</plurals>
<string name="allTeams">All teams</string>
<string name="newTeam">New team</string>
<string name="myTeams">My teams</string>
<string name="noTeamFound">No team found</string>
<string name="joinTeam">Join team</string>
<string name="quitTeam">Leave team</string>
<string name="anyoneCanJoin">Free for all</string>
<string name="aConfirmationIsRequiredToJoin">A confirmation is required to join</string>
<string name="joiningPolicy">Joining policy</string>
<string name="teamLeader">Team leader</string>
<string name="teamBestPlayers">Best players</string>
<string name="teamRecentMembers">Recent members</string>
<string name="xJoinedTeamY">%1$s joined team %2$s</string>
<string name="xCreatedTeamY">%1$s created team %2$s</string>
<string name="averageElo">Average rating</string>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="team">Team</string>
<string name="teams">Teams</string>
<plurals name="nbMembers">
<item quantity="one">%s member</item>
<item quantity="other">%s members</item>
</plurals>
<string name="allTeams">All teams</string>
<string name="newTeam">New team</string>
<string name="myTeams">My teams</string>
<string name="noTeamFound">No team found</string>
<string name="joinTeam">Join team</string>
<string name="quitTeam">Leave team</string>
<string name="anyoneCanJoin">Free for all</string>
<string name="aConfirmationIsRequiredToJoin">A confirmation is required to join</string>
<string name="joiningPolicy">Joining policy</string>
<string name="teamLeader">Team leader</string>
<string name="teamBestPlayers">Best players</string>
<string name="teamRecentMembers">Recent members</string>
<string name="kickSomeone">Kick someone out of the team</string>
<string name="whoToKick">Who do you want to kick out of the team?</string>
<string name="appointOwner">Appoint another team owner</string>
<string name="changeOwner">Who do you want to make owner of this team?</string>
<plurals name="xJoinRequests">
<item quantity="one">%s join request</item>
<item quantity="other">%s join requests</item>
</plurals>
<string name="willBeReviewed">Your join request will be reviewed by the team leader.</string>
<string name="beingReviewed">Your join request is being reviewed by the team leader.</string>
<string name="teamBattle">Team Battle</string>
</resources>