fix missing translations

This commit is contained in:
Thibault Duplessis 2017-05-29 08:53:04 +02:00
parent e2039e2dab
commit 81fc0476da
7 changed files with 16 additions and 58 deletions

View file

@ -23,7 +23,6 @@ zen = true) {
<form action="@routes.Auth.signupPost" method="POST">
<ul>
@auth.formFields(form("username"), form("password"), form("email").some, register = true)
@errMsg(form)
<li data-icon="">&nbsp;
@trans.computersAreNotAllowedToPlay()<br />
<small>

View file

@ -5,58 +5,9 @@ import play.api.i18n.Lang
object I18nDb {
val all: Messages =
lila.common.Chronometer.syncEffect(
lila.i18n.db.Registry.load // .+("default.play" -> playDefaultMessages)
) { lap =>
lila.common.Chronometer.syncEffect(lila.i18n.db.Registry.load) { lap =>
logger.info(s"${lap.millis}ms MessageDb")
}
val langs = all.keySet
private def playDefaultMessages: Map[MessageKey, Translation] = Map(
"constraint.required" -> new Literal("Required"),
"constraint.min" -> new Literal("Minimum value: {0}"),
"constraint.max" -> new Literal("Maximum value: {0}"),
"constraint.minLength" -> new Literal("Minimum length: {0}"),
"constraint.maxLength" -> new Literal("Maximum length: {0}"),
"constraint.email" -> new Literal("Email"),
"format.date" -> new Literal("Date (''{0}'')"),
"format.numeric" -> new Literal("Numeric"),
"format.real" -> new Literal("Real"),
"format.uuid" -> new Literal("UUID"),
"error.invalid" -> new Literal("Invalid value"),
"error.invalid.java.util.Date" -> new Literal("Invalid date value"),
"error.required" -> new Literal("This field is required"),
"error.number" -> new Literal("Numeric value expected"),
"error.real" -> new Literal("Real number value expected"),
"error.real.precision" -> new Literal("Real number value with no more than {0} digit(s) including {1} decimal(s) expected"),
"error.min" -> new Literal("Must be greater or equal to {0}"),
"error.min.strict" -> new Literal("Must be strictly greater than {0}"),
"error.max" -> new Literal("Must be less or equal to {0}"),
"error.max.strict" -> new Literal("Must be strictly less than {0}"),
"error.minLength" -> new Literal("Minimum length is {0}"),
"error.maxLength" -> new Literal("Maximum length is {0}"),
"error.email" -> new Literal("Valid email required"),
"error.pattern" -> new Literal("Must satisfy {0}"),
"error.date" -> new Literal("Valid date required"),
"error.uuid" -> new Literal("Valid UUID required"),
"error.expected.date" -> new Literal("Date value expected"),
"error.expected.date.isoformat" -> new Literal("Iso date value expected"),
"error.expected.time" -> new Literal("Time value expected"),
"error.expected.jodadate.format" -> new Literal("Joda date value expected"),
"error.expected.jodatime.format" -> new Literal("Joda time value expected"),
"error.expected.jsarray" -> new Literal("Array value expected"),
"error.expected.jsboolean" -> new Literal("Boolean value expected"),
"error.expected.jsnumber" -> new Literal("Number value expected"),
"error.expected.jsobject" -> new Literal("Object value expected"),
"error.expected.jsstring" -> new Literal("String value expected"),
"error.expected.jsnumberorjsstring" -> new Literal("String or number expected"),
"error.expected.keypathnode" -> new Literal("Node value expected"),
"error.expected.uuid" -> new Literal("UUID value expected"),
"error.expected.validenumvalue" -> new Literal("Valid enumeration value expected"),
"error.expected.enumstring" -> new Literal("String value expected"),
"error.path.empty" -> new Literal("Empty path"),
"error.path.missing" -> new Literal("Missing path"),
"error.path.result.multiple" -> new Literal("Multiple results for the given path")
)
}

View file

@ -1,4 +1,4 @@
// Generated with bin/trans-dump.js Mon May 29 2017 00:09:35 GMT+0200 (CEST)
// Generated with bin/trans-dump.js Mon May 29 2017 08:38:41 GMT+0200 (CEST)
package lila.i18n
// format: OFF
@ -507,10 +507,14 @@ val `boardSize` = new Translated("boardSize")
val `pieceSet` = new Translated("pieceSet")
val `embedInYourWebsite` = new Translated("embedInYourWebsite")
val `usernameAlreadyUsed` = new Translated("usernameAlreadyUsed")
val `usernameInvalid` = new Translated("usernameInvalid")
val `usernameStartNoNumber` = new Translated("usernameStartNoNumber")
val `usernameUnacceptable` = new Translated("usernameUnacceptable")
val `directlySupportLichess` = new Translated("directlySupportLichess")
val `playChessInStyle` = new Translated("playChessInStyle")
val `chessBasics` = new Translated("chessBasics")
val `coaches` = new Translated("coaches")
val `invalidPgn` = new Translated("invalidPgn")
val `nbPlayers` = new Translated("nbPlayers")
val `nbGames` = new Translated("nbGames")
val `nbBookmarks` = new Translated("nbBookmarks")

View file

@ -12,7 +12,7 @@ import lila.game._
private[importer] final class DataForm {
lazy val importForm = Form(mapping(
"pgn" -> nonEmptyText.verifying("Invalid PGN", checkPgn _),
"pgn" -> nonEmptyText.verifying("invalidPgn", checkPgn _),
"analyse" -> optional(nonEmptyText)
)(ImportData.apply)(ImportData.unapply))

View file

@ -36,14 +36,14 @@ final class DataForm(
Constraints maxLength 20,
Constraints.pattern(
regex = User.usernameRegex,
error = "Invalid username. Please use only letters, numbers, underscore and dash"
error = "usernameInvalid"
),
Constraints.pattern(
regex = """^[^\d].+$""".r,
error = "The username must not start with a number"
error = "usernameStartNoNumber"
)
).verifying("This user already exists", u => !UserRepo.nameExists(u).awaitSeconds(4))
.verifying("This username is not acceptable", u => !LameName(u))
).verifying("", u => !UserRepo.nameExists(u).awaitSeconds(4))
.verifying("usernameUnacceptable", u => !LameName(u))
val website = Form(mapping(
"username" -> username,

View file

@ -59,7 +59,7 @@ final class EmailAddressValidator(disposable: DisposableEmailDomain) {
def uniqueConstraint(forUser: Option[User]) = Constraint[String]("constraint.email_unique") { e =>
if (isTakenBySomeoneElse(EmailAddress(e), forUser))
Invalid(ValidationError(s"Email address is already in use by another account"))
Invalid(ValidationError(s"error.email_unique"))
else Valid
}

View file

@ -593,8 +593,12 @@
<string name="pieceSet">Piece set</string>
<string name="embedInYourWebsite">Embed in your website</string>
<string name="usernameAlreadyUsed">This username is already in use, please try another one.</string>
<string name="usernameInvalid">Invalid username. Please use only letters, numbers, underscore and dash.</string>
<string name="usernameStartNoNumber">The username must not start with a number.</string>
<string name="usernameUnacceptable">This username is not acceptable.</string>
<string name="directlySupportLichess">Directly support Lichess</string>
<string name="playChessInStyle">Play chess in style</string>
<string name="chessBasics">Chess basics</string>
<string name="coaches">Coaches</string>
<string name="invalidPgn">Invalid PGN</string>
</resources>