Make glyphs translateable
parent
12d562e6f9
commit
087debe00f
|
@ -105,18 +105,46 @@ final class Main(
|
|||
NoContent
|
||||
}
|
||||
|
||||
private lazy val glyphsResult: Result = {
|
||||
import chess.format.pgn.Glyph
|
||||
import lila.tree.Node.glyphWriter
|
||||
JsonOk(
|
||||
Json.obj(
|
||||
"move" -> (Glyph.MoveAssessment.display: List[Glyph]),
|
||||
"position" -> (Glyph.PositionAssessment.display: List[Glyph]),
|
||||
"observation" -> (Glyph.Observation.display: List[Glyph])
|
||||
)
|
||||
)
|
||||
}
|
||||
val glyphs = Action(glyphsResult)
|
||||
def glyphs =
|
||||
Open { implicit ctx =>
|
||||
import chess.format.pgn.Glyph
|
||||
import lila.tree.Node.glyphWriter
|
||||
import lila.i18n.{ I18nKeys => trans }
|
||||
JsonOk(
|
||||
Json.obj(
|
||||
"move" -> List(
|
||||
Glyph.MoveAssessment.good.copy(name = trans.glyphs.goodMove.txt()),
|
||||
Glyph.MoveAssessment.mistake.copy(name = trans.glyphs.mistake.txt()),
|
||||
Glyph.MoveAssessment.brillant.copy(name = trans.glyphs.brilliantMove.txt()),
|
||||
Glyph.MoveAssessment.blunder.copy(name = trans.glyphs.blunder.txt()),
|
||||
Glyph.MoveAssessment.interesting.copy(name = trans.glyphs.interestingMove.txt()),
|
||||
Glyph.MoveAssessment.dubious.copy(name = trans.glyphs.dubiousMove.txt()),
|
||||
Glyph.MoveAssessment.only.copy(name = trans.glyphs.onlyMove.txt()),
|
||||
Glyph.MoveAssessment.zugzwang.copy(name = trans.glyphs.zugzwang.txt())
|
||||
),
|
||||
"position" -> List(
|
||||
Glyph.PositionAssessment.equal.copy(name = trans.glyphs.equalPosition.txt()),
|
||||
Glyph.PositionAssessment.unclear.copy(name = trans.glyphs.unclearPosition.txt()),
|
||||
Glyph.PositionAssessment.whiteSlightlyBetter.copy(name = trans.glyphs.whiteIsSlightlyBetter.txt()),
|
||||
Glyph.PositionAssessment.blackSlightlyBetter.copy(name = trans.glyphs.blackIsSlightlyBetter.txt()),
|
||||
Glyph.PositionAssessment.whiteQuiteBetter.copy(name = trans.glyphs.whiteIsBetter.txt()),
|
||||
Glyph.PositionAssessment.blackQuiteBetter.copy(name = trans.glyphs.blackIsBetter.txt()),
|
||||
Glyph.PositionAssessment.whiteMuchBetter.copy(name = trans.glyphs.whiteIsWinning.txt()),
|
||||
Glyph.PositionAssessment.blackMuchBetter.copy(name = trans.glyphs.blackIsWinning.txt())
|
||||
),
|
||||
"observation" -> List(
|
||||
Glyph.Observation.novelty.copy(name = trans.glyphs.novelty.txt()),
|
||||
Glyph.Observation.development.copy(name = trans.glyphs.development.txt()),
|
||||
Glyph.Observation.initiative.copy(name = trans.glyphs.initiative.txt()),
|
||||
Glyph.Observation.attack.copy(name = trans.glyphs.attack.txt()),
|
||||
Glyph.Observation.counterplay.copy(name = trans.glyphs.counterplay.txt()),
|
||||
Glyph.Observation.timeTrouble.copy(name = trans.glyphs.timeTrouble.txt()),
|
||||
Glyph.Observation.compensation.copy(name = trans.glyphs.withCompensation.txt()),
|
||||
Glyph.Observation.withIdea.copy(name = trans.glyphs.withTheIdea.txt())
|
||||
)
|
||||
)
|
||||
).fuccess
|
||||
}
|
||||
|
||||
def image(id: String, @nowarn("cat=unused") hash: String, @nowarn("cat=unused") name: String) =
|
||||
Action.async {
|
||||
|
|
|
@ -2,7 +2,7 @@ const fs = require('fs').promises;
|
|||
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 team perfStat search tourname faq lag swiss puzzle puzzleTheme challenge storm'.split(
|
||||
const dbs = 'site arena emails learn activity coordinates study clas contact patron coach broadcast streamer tfa settings preferences team perfStat search tourname faq lag swiss puzzle puzzleTheme challenge storm glyphs'.split(
|
||||
' '
|
||||
);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ lazy val i18n = smallModule("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 team perfStat search tourname faq lag swiss puzzle puzzleTheme challenge storm".split(' ').toList,
|
||||
dbs = "site arena emails learn activity coordinates study class contact patron coach broadcast streamer tfa settings preferences team perfStat search tourname faq lag swiss puzzle puzzleTheme challenge storm glyphs".split(' ').toList,
|
||||
compileTo = (Compile / sourceManaged).value
|
||||
)
|
||||
}.taskValue
|
||||
|
|
|
@ -785,6 +785,7 @@ POST /jsmon/:event controllers.Main.jsmon(event: String)
|
|||
GET /swag controllers.Main.movedPermanently(to: String = "https://shop.spreadshirt.com/lichess-org")
|
||||
GET /yt controllers.Main.movedPermanently(to: String = "https://www.youtube.com/channel/UCr6RfQga70yMM9-nuzAYTsA")
|
||||
|
||||
GET /glyphs controllers.Main.glyphs
|
||||
GET /assets/_$v<\w{6}>/*file controllers.Main.devAsset(v, path="public", file)
|
||||
GET /assets/*file controllers.ExternalAssets.at(path="public", file)
|
||||
|
||||
|
|
|
@ -2055,4 +2055,31 @@ val `xRuns` = new I18nKey("storm:xRuns")
|
|||
val `playedNbRunsOfPuzzleStorm` = new I18nKey("storm:playedNbRunsOfPuzzleStorm")
|
||||
}
|
||||
|
||||
object glyphs {
|
||||
val `goodMove` = new I18nKey("glyphs:goodMove")
|
||||
val `mistake` = new I18nKey("glyphs:mistake")
|
||||
val `brilliantMove` = new I18nKey("glyphs:brilliantMove")
|
||||
val `blunder` = new I18nKey("glyphs:blunder")
|
||||
val `interestingMove` = new I18nKey("glyphs:interestingMove")
|
||||
val `dubiousMove` = new I18nKey("glyphs:dubiousMove")
|
||||
val `onlyMove` = new I18nKey("glyphs:onlyMove")
|
||||
val `zugzwang` = new I18nKey("glyphs:zugzwang")
|
||||
val `equalPosition` = new I18nKey("glyphs:equalPosition")
|
||||
val `unclearPosition` = new I18nKey("glyphs:unclearPosition")
|
||||
val `whiteIsSlightlyBetter` = new I18nKey("glyphs:whiteIsSlightlyBetter")
|
||||
val `blackIsSlightlyBetter` = new I18nKey("glyphs:blackIsSlightlyBetter")
|
||||
val `whiteIsBetter` = new I18nKey("glyphs:whiteIsBetter")
|
||||
val `blackIsBetter` = new I18nKey("glyphs:blackIsBetter")
|
||||
val `whiteIsWinning` = new I18nKey("glyphs:whiteIsWinning")
|
||||
val `blackIsWinning` = new I18nKey("glyphs:blackIsWinning")
|
||||
val `novelty` = new I18nKey("glyphs:novelty")
|
||||
val `development` = new I18nKey("glyphs:development")
|
||||
val `initiative` = new I18nKey("glyphs:initiative")
|
||||
val `attack` = new I18nKey("glyphs:attack")
|
||||
val `counterplay` = new I18nKey("glyphs:counterplay")
|
||||
val `timeTrouble` = new I18nKey("glyphs:timeTrouble")
|
||||
val `withCompensation` = new I18nKey("glyphs:withCompensation")
|
||||
val `withTheIdea` = new I18nKey("glyphs:withTheIdea")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<string name="goodMove">Good move</string>
|
||||
<string name="mistake">Mistake</string>
|
||||
<string name="brilliantMove">Brilliant move</string>
|
||||
<string name="blunder">Blunder</string>
|
||||
<string name="interestingMove">Interesting move</string>
|
||||
<string name="dubiousMove">Dubious move</string>
|
||||
<string name="onlyMove">Only move</string>
|
||||
<string name="zugzwang">Zugzwang</string>
|
||||
<string name="equalPosition">Equal position</string>
|
||||
<string name="unclearPosition">Unclear position</string>
|
||||
<string name="whiteIsSlightlyBetter">White is slightly better</string>
|
||||
<string name="blackIsSlightlyBetter">Black is slightly better</string>
|
||||
<string name="whiteIsBetter">White is better</string>
|
||||
<string name="blackIsBetter">Black is better</string>
|
||||
<string name="whiteIsWinning">White is winning</string>
|
||||
<string name="blackIsWinning">Black is winning</string>
|
||||
<string name="novelty">Novelty</string>
|
||||
<string name="development">Development</string>
|
||||
<string name="initiative">Initiative</string>
|
||||
<string name="attack">Attack</string>
|
||||
<string name="counterplay">Counterplay</string>
|
||||
<string name="timeTrouble">Time trouble</string>
|
||||
<string name="withCompensation">With compensation</string>
|
||||
<string name="withTheIdea">With the idea</string>
|
||||
</resources>
|
|
@ -10,9 +10,8 @@ export const reload = (baseUrl: string, id: string, chapterId?: string): Promise
|
|||
export const variants = () => xhr.json('/variant', { cache: 'default' });
|
||||
|
||||
export const glyphs = () =>
|
||||
xhr.json(lichess.assetUrl('glyphs.json', { noVersion: true }), {
|
||||
xhr.json('/glyphs', {
|
||||
cache: 'default',
|
||||
headers: {},
|
||||
});
|
||||
|
||||
export const chapterConfig = (studyId: string, chapterId: string): Promise<StudyChapterConfig> =>
|
||||
|
|
Loading…
Reference in New Issue