Merge pull request #9251 from benediktwerner/trans-swiss

More swiss translations
pull/9311/head
Thibault Duplessis 2021-06-28 22:43:24 +02:00 committed by GitHub
commit 778e8a667e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 15 deletions

View File

@ -5,6 +5,7 @@ import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.i18n.{ I18nKeys => trans }
import lila.swiss.Swiss
import play.api.i18n.Lang
import controllers.routes
@ -70,17 +71,13 @@ object bits {
)
)
def showInterval(s: Swiss): Frag =
def showInterval(s: Swiss)(implicit lang: Lang): Frag =
s.settings.dailyInterval match {
case Some(1) => frag("One round per day")
case Some(d) => frag(s"One round every $d days")
case None if s.settings.manualRounds => frag("Rounds are started manually")
case Some(d) => trans.swiss.oneRoundEveryXDays.pluralSame(d)
case None if s.settings.manualRounds => trans.swiss.roundsAreStartedManually()
case None =>
frag(
if (s.settings.intervalSeconds < 60) pluralize("second", s.settings.intervalSeconds)
else pluralize("minute", s.settings.intervalSeconds / 60),
" between rounds"
)
if (s.settings.intervalSeconds < 60) trans.swiss.xSecondsBetweenRounds.pluralSame(s.settings.intervalSeconds)
else trans.swiss.xMinutesBetweenRounds.pluralSame(s.settings.intervalSeconds / 60)
}
def jsI18n(implicit ctx: Context) = i18nJsObject(i18nKeys)
@ -102,6 +99,10 @@ object bits {
trans.averageOpponent,
trans.tournamentComplete,
trans.password,
trans.swiss.viewAllXRounds
trans.swiss.viewAllXRounds,
trans.swiss.ongoingGames,
trans.swiss.startingIn,
trans.swiss.nextRound,
trans.team.joinTeam,
).map(_.key)
}

View File

@ -33,8 +33,7 @@ object side {
if (s.settings.rated) trans.ratedTournament() else trans.casualTournament()
),
p(
span(cls := "swiss__meta__round")(s"${s.round}/${s.settings.nbRounds}"),
" rounds",
span(cls := "swiss__meta__round")(trans.swiss.nbRounds.plural(s.settings.nbRounds, s"${s.round}/${s.settings.nbRounds}")),
separator,
a(href := routes.Swiss.home)("Swiss"),
(isGranted(_.ManageTournament) || (ctx.userId.has(s.createdBy) && !s.isFinished)) option frag(

View File

@ -1877,6 +1877,9 @@ val `lagCompensationExplanation` = new I18nKey("lag:lagCompensationExplanation")
object swiss {
val `swissTournaments` = new I18nKey("swiss:swissTournaments")
val `roundsAreStartedManually` = new I18nKey("swiss:roundsAreStartedManually")
val `startingIn` = new I18nKey("swiss:startingIn")
val `nextRound` = new I18nKey("swiss:nextRound")
val `tournStartDate` = new I18nKey("swiss:tournStartDate")
val `nbRounds` = new I18nKey("swiss:nbRounds")
val `nbRoundsHelp` = new I18nKey("swiss:nbRoundsHelp")
@ -1885,6 +1888,11 @@ val `forbiddenPairings` = new I18nKey("swiss:forbiddenPairings")
val `forbiddenPairingsHelp` = new I18nKey("swiss:forbiddenPairingsHelp")
val `newSwiss` = new I18nKey("swiss:newSwiss")
val `viewAllXRounds` = new I18nKey("swiss:viewAllXRounds")
val `nbRounds` = new I18nKey("swiss:nbRounds")
val `oneRoundEveryXDays` = new I18nKey("swiss:oneRoundEveryXDays")
val `xSecondsBetweenRounds` = new I18nKey("swiss:xSecondsBetweenRounds")
val `xMinutesBetweenRounds` = new I18nKey("swiss:xMinutesBetweenRounds")
val `ongoingGames` = new I18nKey("swiss:ongoingGames")
}
object puzzle {

View File

@ -5,6 +5,28 @@
<item quantity="one">View the round</item>
<item quantity="other">View all %s rounds</item>
</plurals>
<plurals name="nbRounds" comment="%s is currentRound/maxRounds e.g. 5/9&#10;maxRounds is always at least 3">
<item quantity="other">%s rounds</item>
</plurals>
<plurals name="oneRoundEveryXDays">
<item quantity="one">One round per day</item>
<item quantity="other">One round every %s days</item>
</plurals>
<string name="roundsAreStartedManually">Rounds are started manually</string>
<plurals name="xSecondsBetweenRounds">
<item quantity="one">%s second between rounds</item>
<item quantity="other">%s seconds between rounds</item>
</plurals>
<plurals name="xMinutesBetweenRounds">
<item quantity="one">%s minunte between rounds</item>
<item quantity="other">%s minutes between rounds</item>
</plurals>
<string name="startingIn" comment="Displayed above a timer">Starting in</string>
<string name="nextRound">Next round</string>
<plurals name="ongoingGames" comment="Displayed next to the ongoing games count">
<item quantity="one">Ongoing game</item>
<item quantity="other">Ongoing games</item>
</plurals>
<string name="tournStartDate">Tournament start date</string>
<string name="nbRounds">Number of rounds</string>
<string name="nbRoundsHelp">An odd number of rounds allows optimal color balance.</string>

View File

@ -27,7 +27,7 @@ function clock(ctrl: SwissCtrl): VNode | undefined {
}),
]);
return h(`div.clock.clock-created.time-cache-${next.at}`, [
h('span.shy', ctrl.data.status == 'created' ? 'Starting in' : 'Next round'),
h('span.shy', ctrl.data.status == 'created' ? ctrl.trans.noarg('startingIn') : ctrl.trans.noarg('nextRound')),
h('span.time.text', {
hook: startClock(next.in + 1),
}),
@ -36,7 +36,7 @@ function clock(ctrl: SwissCtrl): VNode | undefined {
function ongoing(ctrl: SwissCtrl): VNode | undefined {
const nb = ctrl.data.nbOngoing;
return nb ? h('div.ongoing', [h('span.nb', [nb]), h('span.shy', 'Ongoing games')]) : undefined;
return nb ? h('div.ongoing', [h('span.nb', [nb]), h('span.shy', ctrl.trans.plural('ongoingGames', nb))]) : undefined;
}
export default function (ctrl: SwissCtrl): VNode {

View File

@ -150,7 +150,7 @@ function joinButton(ctrl: SwissCtrl): VNode | undefined {
'data-icon': '',
},
},
'Join the team'
ctrl.trans.noarg('joinTeam')
);
if (d.canJoin)