list of translatable languages with stats and contributors
This commit is contained in:
parent
1a0874e233
commit
ea17d15ec9
|
@ -3,7 +3,20 @@ package controllers
|
||||||
import lila._
|
import lila._
|
||||||
import views._
|
import views._
|
||||||
|
|
||||||
|
import i18n._
|
||||||
|
|
||||||
object I18n extends LilaController {
|
object I18n extends LilaController {
|
||||||
|
|
||||||
val contribute = todo
|
def transInfos = env.i18n.transInfos
|
||||||
|
def pool = env.i18n.pool
|
||||||
|
|
||||||
|
val contribute = Open { implicit ctx ⇒
|
||||||
|
val all = transInfos
|
||||||
|
val mines = (pool fixedReqAcceptLanguages ctx.req map { lang ⇒
|
||||||
|
all find (_.lang == lang)
|
||||||
|
}).toList.flatten
|
||||||
|
Ok(html.i18n.contribute(all, mines))
|
||||||
|
}
|
||||||
|
|
||||||
|
def contributeTrans(lang: String) = TODO //Open { implicit ctx =>
|
||||||
}
|
}
|
||||||
|
|
67
app/i18n/Contributors.scala
Normal file
67
app/i18n/Contributors.scala
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
package lila
|
||||||
|
package i18n
|
||||||
|
|
||||||
|
object Contributors {
|
||||||
|
|
||||||
|
val all = Map(
|
||||||
|
"fr" -> List("Thibault Duplessis"),
|
||||||
|
"ru" -> List("Nikita Milovanov"),
|
||||||
|
"de" -> List("Patrick Gawliczek"),
|
||||||
|
"tr" -> List("Yakup Ipek"),
|
||||||
|
"sr" -> List("Nenad Nikolić"),
|
||||||
|
"lv" -> List("Anonymous"),
|
||||||
|
"bs" -> List("Jacikka"),
|
||||||
|
"da" -> List("Henrik Bjornskov"),
|
||||||
|
"es" -> List("FennecFoxz"),
|
||||||
|
"ro" -> List("Cristian Niţă"),
|
||||||
|
"it" -> List("Marco Barberis"),
|
||||||
|
"fi" -> List("Juuso Vallius"),
|
||||||
|
"uk" -> List("alterionisto"),
|
||||||
|
"pt" -> List("Arthur Braz", "Eugênio Vázquez"),
|
||||||
|
"pl" -> List("M3n747"),
|
||||||
|
"nl" -> List("Kintaro"),
|
||||||
|
"vi" -> List("Xiblack"),
|
||||||
|
"sv" -> List("nizleib"),
|
||||||
|
"cs" -> List("Martin", "Claymes"),
|
||||||
|
"sk" -> List("taiga"),
|
||||||
|
"hu" -> List("LTBakemono"),
|
||||||
|
"ca" -> List("AI8"),
|
||||||
|
"sl" -> List("Klemen Grm"),
|
||||||
|
"az" -> List("elçin məmmədzadə", "amil isgəndərov"),
|
||||||
|
"nn" -> List("Peropaal"),
|
||||||
|
"eo" -> List("LaPingvino"),
|
||||||
|
"tp" -> List("jan Mimoku"),
|
||||||
|
"el" -> List("Tzortzakos Fivos", "Γιάννης Ανθυμίδης"),
|
||||||
|
"fp" -> List("Alex"),
|
||||||
|
"lt" -> List("Anonymous"),
|
||||||
|
"no" -> List("Anonymous"),
|
||||||
|
"et" -> List("Anonymous"),
|
||||||
|
"hy" -> List("Network.am"),
|
||||||
|
"af" -> List("secreteagle"),
|
||||||
|
"hi" -> List("Samarth Karia"),
|
||||||
|
"ar" -> List("Ziad Dabash"),
|
||||||
|
"zh" -> List("神爱"),
|
||||||
|
"gl" -> List("José Manuel Castroagudín Silva"),
|
||||||
|
"tk" -> List("Anonymous"),
|
||||||
|
"hr" -> List("Betyárcsimbók"),
|
||||||
|
"mk" -> List("Давид и Стефан Тимовски"),
|
||||||
|
"id" -> List("Night1301"),
|
||||||
|
"ja" -> List("ネイサン アイブス"),
|
||||||
|
"bg" -> List("Anonymous"),
|
||||||
|
"th" -> List("มาโนชญ์ สมศักดิ์"),
|
||||||
|
"fa" -> List("saeid monajiane"),
|
||||||
|
"he" -> List("Anonymous", " Tornado"),
|
||||||
|
"mr" -> List("Rahul"),
|
||||||
|
"mn" -> List("Tsbarsaa"),
|
||||||
|
"cy" -> List("cavejohnson"),
|
||||||
|
"gd" -> List("GunChleoc"),
|
||||||
|
"ga" -> List("Anonymous"),
|
||||||
|
"sq" -> List("Indrit Bleta"),
|
||||||
|
"be" -> List("Palenik Siarhei"),
|
||||||
|
"ka" -> List("Giorgi Javakhidze"),
|
||||||
|
"sw" -> List("Anonymous"),
|
||||||
|
"ps" -> List("Eimal Dorani"),
|
||||||
|
"is" -> List("Sir Gizmo Gunn Myr Basque"))
|
||||||
|
|
||||||
|
def apply(code: String): List[String] = ~(all get code)
|
||||||
|
}
|
|
@ -40,4 +40,8 @@ final class I18nEnv(
|
||||||
pool = pool,
|
pool = pool,
|
||||||
keys = keys,
|
keys = keys,
|
||||||
api = messagesApi)
|
api = messagesApi)
|
||||||
|
|
||||||
|
lazy val transInfos = TransInfo.all(
|
||||||
|
api = messagesApi,
|
||||||
|
keys = keys)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ object LangList {
|
||||||
|
|
||||||
def name(code: String) = all get code getOrElse code
|
def name(code: String) = all get code getOrElse code
|
||||||
|
|
||||||
|
lazy val sortedList = all.toList sortBy (_._1)
|
||||||
|
|
||||||
val all = Map(
|
val all = Map(
|
||||||
"ab" -> "аҧсуа",
|
"ab" -> "аҧсуа",
|
||||||
"aa" -> "Afaraf",
|
"aa" -> "Afaraf",
|
||||||
|
|
28
app/i18n/TransInfo.scala
Normal file
28
app/i18n/TransInfo.scala
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
package lila
|
||||||
|
package i18n
|
||||||
|
|
||||||
|
import play.api.i18n.{ MessagesApi, Lang }
|
||||||
|
|
||||||
|
case class TransInfo(
|
||||||
|
lang: Lang,
|
||||||
|
name: String,
|
||||||
|
contributors: List[String],
|
||||||
|
percent: Int) {
|
||||||
|
|
||||||
|
def code = lang.language
|
||||||
|
}
|
||||||
|
|
||||||
|
object TransInfo {
|
||||||
|
|
||||||
|
def all(api: MessagesApi, keys: I18nKeys): List[TransInfo] = {
|
||||||
|
val nbMessages = keys.keys.size
|
||||||
|
LangList.sortedList.filter(_._1 != "en") map {
|
||||||
|
case (code, name) ⇒ TransInfo(
|
||||||
|
lang = Lang(code),
|
||||||
|
name = name,
|
||||||
|
contributors = Contributors(code),
|
||||||
|
percent = (api.messages get code).fold(_.size, 0) * 100 / nbMessages
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import org.joda.time.DateTime
|
||||||
case class Translation(
|
case class Translation(
|
||||||
@Key("_id") id: Int,
|
@Key("_id") id: Int,
|
||||||
code: String, // 2-chars code
|
code: String, // 2-chars code
|
||||||
messages: String,
|
yaml: String,
|
||||||
author: Option[String],
|
author: Option[String],
|
||||||
comment: Option[String],
|
comment: Option[String],
|
||||||
createdAt: DateTime) {
|
createdAt: DateTime) {
|
||||||
|
|
|
@ -8,7 +8,13 @@ import com.mongodb.casbah.Imports._
|
||||||
import scalaz.effects._
|
import scalaz.effects._
|
||||||
|
|
||||||
class TranslationRepo(
|
class TranslationRepo(
|
||||||
collection: MongoCollection
|
collection: MongoCollection) extends SalatDAO[Translation, String](collection) {
|
||||||
) extends SalatDAO[Translation, String](collection) {
|
|
||||||
|
|
||||||
|
val maxId: IO[Int] = io {
|
||||||
|
collection.find(DBObject(), DBObject("_id" -> true))
|
||||||
|
.sort(DBObject("_id" -> -1))
|
||||||
|
.limit(1)
|
||||||
|
.toList
|
||||||
|
.headOption flatMap { _.getAs[Int]("_id") } getOrElse 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
@()(implicit ctx: Context)
|
@(all: List[lila.i18n.TransInfo], mines: List[lila.i18n.TransInfo])(implicit ctx: Context)
|
||||||
|
|
||||||
@i18n.layout(
|
@i18n.layout(
|
||||||
title = "Contribute to translations") {
|
title = "Contribute to translations") {
|
||||||
|
|
||||||
<div class="content_box small_box">
|
<div class="content_box">
|
||||||
This feature is temporarily disabled. Will be back soon, promise!
|
<h1 class="lichess_title">Help translate Lichess!</h1>
|
||||||
|
<br />
|
||||||
|
Lichess is OpenSource and needs contributors to get better.
|
||||||
|
<br />
|
||||||
|
@if(mines.nonEmpty) {
|
||||||
|
<h2>Do you speak @{ (mines.size > 1).fold("these languages", "this language") }?</h2>
|
||||||
|
@i18n.translations(mines)
|
||||||
|
}
|
||||||
|
<br />
|
||||||
|
<h2>What about these ones?</h2>
|
||||||
|
@i18n.translations(all)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,12 @@
|
||||||
@moreCss = {
|
@moreCss = {
|
||||||
@cssTag("translation.css")
|
@cssTag("translation.css")
|
||||||
}
|
}
|
||||||
|
@moreJs = {
|
||||||
|
@jsTag("translation.js")
|
||||||
|
}
|
||||||
|
|
||||||
@base.layout(
|
@base.layout(
|
||||||
title = title,
|
title = title,
|
||||||
moreCss = moreCss,
|
moreCss = moreCss,
|
||||||
|
moreJs = moreJs,
|
||||||
active = none)(body)
|
active = none)(body)
|
||||||
|
|
44
app/views/i18n/translations.scala.html
Normal file
44
app/views/i18n/translations.scala.html
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
@(transInfos: List[lila.i18n.TransInfo])(implicit ctx: Context)
|
||||||
|
|
||||||
|
<table class="translations">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Language</th>
|
||||||
|
<th>Progress</th>
|
||||||
|
<th>Contributors</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@transInfos.map { info =>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="@routes.I18n.contributeTrans(info.code)">
|
||||||
|
@info.code - @info.name
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td class="progress">
|
||||||
|
<div class="progressbar">
|
||||||
|
<div style="width: @info.percent%"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>@info.contributors.mkString(", ")</td>
|
||||||
|
<td>
|
||||||
|
<a href="@routes.I18n.contributeTrans(info.code)">
|
||||||
|
@info.percent match {
|
||||||
|
case 0 => {
|
||||||
|
Start it!
|
||||||
|
}
|
||||||
|
case 100 => {
|
||||||
|
Fix it!
|
||||||
|
}
|
||||||
|
case p => {
|
||||||
|
Complete it!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
|
@ -56,6 +56,7 @@ POST /api/game/new controllers.Setup.api
|
||||||
|
|
||||||
# I18n
|
# I18n
|
||||||
GET /translation/contribute controllers.I18n.contribute
|
GET /translation/contribute controllers.I18n.contribute
|
||||||
|
GET /translation/contributeTrans controllers.I18n.contributeTrans(lang: String)
|
||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
GET /login controllers.Auth.login
|
GET /login controllers.Auth.login
|
||||||
|
|
|
@ -1,5 +1,42 @@
|
||||||
#lichess div.lichess_box {
|
h2 {
|
||||||
width: auto;
|
margin-top: 1em;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.translations {
|
||||||
|
margin-top: 1em;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
table.translations th {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
table.translations td, table.translations th {
|
||||||
|
padding: 5px 5px 5px 5px;
|
||||||
|
}
|
||||||
|
table.translations tbody tr:nth-child(odd) {
|
||||||
|
background: #f4f4f4;
|
||||||
|
}
|
||||||
|
table.translations td.progress {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
table.translations div.progressbar {
|
||||||
|
background-color: #eaeaea;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 1px;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.translations div.progressbar div {
|
||||||
|
background: #d85000;
|
||||||
|
background: -moz-linear-gradient(center top , #f49c00, #d85000) repeat scroll 0 0 #d85000;
|
||||||
|
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f49c00), to(#d85000));
|
||||||
|
background: -webkit-linear-gradient(top , #f49c00, #d85000) repeat scroll 0 0 #d85000;
|
||||||
|
background: -ms-linear-gradient(top , #f49c00, #d85000) repeat scroll 0 0 #d85000;
|
||||||
|
background: -o-linear-gradient(top , #f49c00, #d85000) repeat scroll 0 0 #d85000;
|
||||||
|
background: linear-gradient(top , #f49c00, #d85000) repeat scroll 0 0 #d85000;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.field {
|
div.field {
|
||||||
|
|
6
todo
6
todo
|
@ -23,6 +23,12 @@ fix game list translations
|
||||||
temporary mod IP ban to help stopping cheaters
|
temporary mod IP ban to help stopping cheaters
|
||||||
more infos under realtime games
|
more infos under realtime games
|
||||||
cheater slash timeline
|
cheater slash timeline
|
||||||
|
board colorpicker
|
||||||
|
best game(s) to watch
|
||||||
|
copy spectator chat to rematch
|
||||||
|
prevent people giving their friend game await link
|
||||||
|
view pgn: overflow -> make it a textarea
|
||||||
|
reorder game_more links
|
||||||
|
|
||||||
new translations:
|
new translations:
|
||||||
-rematchOfferCanceled=Rematch offer canceled
|
-rematchOfferCanceled=Rematch offer canceled
|
||||||
|
|
Loading…
Reference in a new issue