/broadcast translation WIP

pull/6012/head
Thibault Duplessis 2020-02-09 13:09:00 -06:00
parent 7a791660c6
commit 29fbcceffa
9 changed files with 82 additions and 36 deletions

View File

@ -52,7 +52,7 @@ object topnav {
a(href := routes.Tv.index)("Lichess TV"),
a(href := routes.Tv.games)(trans.currentGames()),
a(href := routes.Streamer.index())(trans.streamersMenu()),
a(href := routes.Relay.index())(trans.broadcastsMenu()),
a(href := routes.Relay.index())(trans.broadcast.broadcasts()),
ctx.noBot option a(href := routes.Video.index)(trans.videoLibrary())
)
),

View File

@ -12,9 +12,11 @@ import controllers.routes
object form {
import trans.broadcast._
def create(form: Form[Data])(implicit ctx: Context) =
layout("New live broadcast")(
h1("New live broadcast"),
layout(newBroadcast.txt())(
h1(newBroadcast()),
inner(form, routes.Relay.create)
)
@ -27,14 +29,14 @@ object form {
submitButton(
cls := "button button-empty confirm",
title := "Create an new identical broadcast, for another round or a similar tournament"
)("Clone the broadcast")
)(cloneBroadcast())
),
hr,
postForm(action := routes.Relay.reset(r.slug, r.id.value))(
submitButton(
cls := "button button-red button-empty confirm",
title := "The source will need to be active in order to re-create the chapters!"
)("Reset the broadcast")
)(resetBroadcast())
)
)
@ -53,17 +55,14 @@ object form {
private def inner(form: Form[Data], url: play.api.mvc.Call)(implicit ctx: Context) =
postForm(cls := "form3", action := url)(
form3.globalError(form),
form3.group(form("name"), frag("Event name"))(form3.input(_)(autofocus)),
form3.group(form("description"), raw("Short event description"))(form3.textarea(_)(rows := 2)),
form3.group(form("name"), eventName())(form3.input(_)(autofocus)),
form3.group(form("description"), eventDescription())(form3.textarea(_)(rows := 2)),
form3.group(
form("markup"),
raw("Full event description"),
help = frag(
"Optional long description of the broadcast. ",
a(href := "https://guides.github.com/features/mastering-markdown/", target := "_blank")(
"Markdown"
),
" is available. Length must be less than 20,000 characters."
fullDescription(),
help = fullDescriptionHelp(
a(href := "https://guides.github.com/features/mastering-markdown/", target := "_blank")("Markdown"),
20000.localize
).some
)(form3.textarea(_)(rows := 10)),
if (isGranted(_.Relay))
@ -75,32 +74,30 @@ object form {
else form3.hidden(form("official")),
form3.group(
form("syncUrl"),
raw("Source URL"),
help = raw(
"URL that Lichess will poll to get PGN updates. It must be publicly accessible from the Internet."
).some
sourceUrl(),
help = sourceUrlHelp().some
)(form3.input(_, typ = "url")),
form("syncUrl").value.exists(LccRegex.matches) option {
form3.group(form("syncUrlRound"), raw("Round number"))(
form3.group(form("syncUrlRound"), roundNumber())(
form3.input(_, typ = "number")(required := true)
)
},
form3.split(
form3.group(
form("startsAt"),
frag("Start date in your own timezone"),
help = raw("Optional, if you know when the event starts").some,
startDate(),
help = startDateHelp().some,
half = true
)(form3.flatpickr(_)),
isGranted(_.Relay) option
form3.group(
form("throttle"),
raw("Throttle in seconds"),
help = raw("Optional, to manually throttle requests. Min 2s, max 60s.").some,
throttleSeconds(),
help = throttleSecondsHelp().some,
half = true
)(form3.input(_, typ = "number"))
),
isGranted(_.Relay) option form3.group(form("credit"), raw("Credit the source"))(form3.input(_)),
isGranted(_.Relay) option form3.group(form("credit"), credits())(form3.input(_)),
form3.actions(
a(href := routes.Relay.index(1))(trans.cancel()),
form3.submit(trans.apply())

View File

@ -11,13 +11,15 @@ import controllers.routes
object index {
import trans.broadcast._
def apply(
fresh: Option[lila.relay.Relay.Fresh],
pager: Paginator[lila.relay.Relay.WithStudyAndLiked],
url: Call
)(implicit ctx: Context) = {
def sublist(name: String, relays: Seq[lila.relay.Relay.WithStudyAndLiked]) =
def sublist(name: Frag, relays: Seq[lila.relay.Relay.WithStudyAndLiked]) =
relays.nonEmpty option st.section(
h2(name),
div(cls := "list")(
@ -26,28 +28,28 @@ object index {
)
views.html.base.layout(
title = "Live tournament broadcasts",
title = liveBroadcasts.txt(),
moreCss = cssTag("relay.index"),
moreJs = infiniteScrollTag
) {
main(cls := "relay-index page-small box")(
div(cls := "box__top")(
h1("Live tournament broadcasts"),
h1(liveBroadcasts()),
a(
href := routes.Relay.form,
cls := "new button button-empty",
title := "New Broadcast",
title := newBroadcast.txt(),
dataIcon := "O"
)
),
fresh.map { f =>
frag(
sublist("Ongoing", f.started),
sublist("Upcoming", f.created)
sublist(ongoing(), f.started),
sublist(upcoming(), f.created)
)
},
st.section(
h2("Completed"),
h2(completed()),
div(cls := "infinitescroll")(
pager.currentPageResults.map { show.widget(_, "paginated") },
pagerNext(pager, np => addQueryParameter(url.url, "page", np))

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'];
const dbs = 'site arena emails learn activity coordinates study clas contact patron coach broadcast'.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 = List("site", "arena", "emails", "learn", "activity", "coordinates", "study", "class", "contact", "patron", "coach"),
dbs = List("site", "arena", "emails", "learn", "activity", "coordinates", "study", "class", "contact", "patron", "coach", "broadcast"),
compileTo = (sourceManaged in Compile).value / "messages"
)
}.taskValue,

View File

@ -16,6 +16,7 @@ object I18nDb {
case object Contact extends Ref
case object Patron extends Ref
case object Coach extends Ref
case object Broadcast extends Ref
val site: Messages = lila.i18n.db.site.Registry.load
val arena: Messages = lila.i18n.db.arena.Registry.load
@ -28,6 +29,7 @@ object I18nDb {
val contact: Messages = lila.i18n.db.contact.Registry.load
val patron: Messages = lila.i18n.db.patron.Registry.load
val coach: Messages = lila.i18n.db.coach.Registry.load
val broadcast: Messages = lila.i18n.db.broadcast.Registry.load
def apply(ref: Ref): Messages = ref match {
case Site => site
@ -41,6 +43,7 @@ object I18nDb {
case Contact => contact
case Patron => patron
case Coach => coach
case Broadcast => broadcast
}
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, Clas, Coach, Contact, Coordinates, Emails, Learn, Patron, Site, Study }
import I18nDb.{ Activity, Arena, Broadcast, Clas, Coach, Contact, Coordinates, Emails, Learn, Patron, Site, Study }
// format: OFF
object I18nKeys {
@ -545,7 +545,6 @@ val `tpTimeSpentOnTV` = new Translated("tpTimeSpentOnTV", Site)
val `watch` = new Translated("watch", Site)
val `videoLibrary` = new Translated("videoLibrary", Site)
val `streamersMenu` = new Translated("streamersMenu", Site)
val `broadcastsMenu` = new Translated("broadcastsMenu", Site)
val `mobileApp` = new Translated("mobileApp", Site)
val `webmasters` = new Translated("webmasters", Site)
val `about` = new Translated("about", Site)
@ -1418,4 +1417,27 @@ val `describeExperienceWith` = new Translated("describeExperienceWith", Coach)
val `studentReviews` = new Translated("studentReviews", Coach)
}
object broadcast {
val `broadcasts` = new Translated("broadcasts", Broadcast)
val `liveBroadcasts` = new Translated("liveBroadcasts", Broadcast)
val `newBroadcast` = new Translated("newBroadcast", Broadcast)
val `ongoing` = new Translated("ongoing", Broadcast)
val `upcoming` = new Translated("upcoming", Broadcast)
val `completed` = new Translated("completed", Broadcast)
val `eventName` = new Translated("eventName", Broadcast)
val `eventDescription` = new Translated("eventDescription", Broadcast)
val `fullDescription` = new Translated("fullDescription", Broadcast)
val `fullDescriptionHelp` = new Translated("fullDescriptionHelp", Broadcast)
val `sourceUrl` = new Translated("sourceUrl", Broadcast)
val `sourceUrlHelp` = new Translated("sourceUrlHelp", Broadcast)
val `roundNumber` = new Translated("roundNumber", Broadcast)
val `startDate` = new Translated("startDate", Broadcast)
val `startDateHelp` = new Translated("startDateHelp", Broadcast)
val `throttleSeconds` = new Translated("throttleSeconds", Broadcast)
val `throttleSecondsHelp` = new Translated("throttleSecondsHelp", Broadcast)
val `credits` = new Translated("credits", Broadcast)
val `cloneBroadcast` = new Translated("cloneBroadcast", Broadcast)
val `resetBroadcast` = new Translated("resetBroadcast", Broadcast)
}
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="broadcasts">Broadcasts</string>
<string name="liveBroadcasts">Live tournament broadcasts</string>
<string name="newBroadcast">New live broadcast</string>
<string name="ongoing">Ongoing</string>
<string name="upcoming">Upcoming</string>
<string name="completed">Completed</string>
<string name="eventName">Event name</string>
<string name="eventDescription">Short event description</string>
<string name="fullDescription">Full event description</string>
<string name="fullDescriptionHelp">Optional long description of the broadcast. %1$s is available. Length must be less than %2$s characters.</string>
<string name="sourceUrl">Source URL</string>
<string name="sourceUrlHelp">URL that Lichess will poll to get PGN updates. It must be publicly accessible from the Internet.</string>
<string name="roundNumber">Round number</string>
<string name="startDate">Start date in your own timezone</string>
<string name="startDateHelp">Optional, if you know when the event starts</string>
<string name="throttleSeconds">Throttle in seconds</string>
<string name="throttleSecondsHelp">Optional, to manually throttle requests. Min 2s, max 60s.</string>
<string name="credits">Credit the source</string>
<string name="cloneBroadcast">Clone the broadcast</string>
<string name="resetBroadcast">Reset the broadcast</string>
</resources>

View File

@ -674,7 +674,6 @@ computer analysis, game chat and shareable URL.</string>
<string name="watch">Watch</string>
<string name="videoLibrary">Video library</string>
<string name="streamersMenu">Streamers</string>
<string name="broadcastsMenu">Broadcasts</string>
<string name="mobileApp">Mobile App</string>
<string name="webmasters">Webmasters</string>
<string name="about">About</string>