Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/views/ublog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package views.ublog
import scalalib.paginator.Paginator
import scalalib.model.Language

import lila.app.UiEnv.*
import lila.app.UiEnv.{ *, given }
import lila.i18n.LangList
import lila.ublog.UblogPost
import lila.core.i18n.toLanguage
Expand All @@ -23,7 +23,7 @@ lazy val form = lila.ublog.ui.UblogFormUi(helpers, ui)(
)

def community(language: Option[Language], posts: Paginator[UblogPost.PreviewPost])(using ctx: Context) =
val langSelections: List[(Language, String)] = (Language("all"), "All languages") ::
val langSelections: List[(Language, String)] = (Language("all"), trans.site.allLanguages.txt()) ::
lila.i18n.LangPicker
.sortFor(LangList.popularNoRegion, ctx.req)
.map: l =>
Expand Down
2 changes: 1 addition & 1 deletion modules/coach/src/main/CoachApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final class CoachApi(
$doc("roles" -> lila.core.perm.Permission.Coach.dbKey, "enabled" -> true)
)
.map: codes =>
("all", "All countries") :: flagApi.all
flagApi.all
.collect:
case f if codes.contains(f.code) && !flagApi.nonCountries.contains(f.code) => f.code -> f.name
.sortBy(_._2)
Expand Down
12 changes: 6 additions & 6 deletions modules/coach/src/main/CoachPager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import lila.coach.CoachPager.Order.{ Alphabetical, LichessRating, Login }
import lila.core.perf.UserWithPerfs
import lila.core.perm.Permission
import lila.core.user.{ Flag, UserMark }
import lila.core.i18n.I18nKey
import lila.db.dsl.{ *, given }

final class CoachPager(
Expand Down Expand Up @@ -59,9 +60,8 @@ final class CoachPager(
s"_user.${lila.core.user.BSONFields.enabled}" -> true,
s"_user.${lila.core.user.BSONFields.marks}"
.$nin(List(UserMark.engine, UserMark.boost, UserMark.troll))
) ++ country.so { c =>
) ++ country.so: c =>
$doc("_user.profile.country" -> c.code)
}
),
Skip(offset),
Limit(length),
Expand Down Expand Up @@ -89,10 +89,10 @@ final class CoachPager(

object CoachPager:

enum Order(val key: String, val name: String):
case Login extends Order("login", "Last login")
case LichessRating extends Order("rating", "Lichess rating")
case Alphabetical extends Order("alphabetical", "Alphabetical")
enum Order(val key: String, val i18nKey: I18nKey):
case Login extends Order("login", I18nKey.coach.lastLogin)
case LichessRating extends Order("rating", I18nKey.coach.lichessRating)
case Alphabetical extends Order("alphabetical", I18nKey.study.alphabetical)

object Order:
val default = Login
Expand Down
12 changes: 6 additions & 6 deletions modules/coach/src/main/ui/CoachUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ final class CoachUi(helpers: Helpers)(
.css("bits.coach")
.js(infiniteScrollEsmInit)
.hrefLangs(lila.ui.LangPath(routes.Coach.all(1))):
val langSelections = ("all", "All languages") :: languages(langCodes).map: l =>
val langSelections = ("all", trans.site.allLanguages.txt()) :: languages(langCodes).map: l =>
l.code -> langList.name(l)
main(cls := "coach-list coach-full-page")(
st.aside(cls := "coach-list__side coach-side")(
Expand All @@ -228,7 +228,7 @@ final class CoachUi(helpers: Helpers)(
div(cls := "box__top__actions")(
lila.ui.bits.mselect(
"coach-lang",
lang.fold("All languages")(langList.name),
lang.fold(trans.site.allLanguages.txt())(langList.name),
langSelections.map: (code, name) =>
a(
href := routes.Coach.search(code, order.key, country.fold("all")(_.code)),
Expand All @@ -237,22 +237,22 @@ final class CoachUi(helpers: Helpers)(
),
lila.ui.bits.mselect(
"coach-country",
country.fold("All countries")(flagApi.name),
countries.value.map: (code, name) =>
country.fold(trans.coach.allCountries.txt())(flagApi.name),
(("all", trans.coach.allCountries.txt()) :: countries.value).map: (code, name) =>
a(
href := routes.Coach.search(lang.fold("all")(_.code), order.key, code),
cls := (code == country.fold("all")(_.code)).option("current")
)(name)
),
lila.ui.bits.mselect(
"coach-sort",
order.name,
order.i18nKey(),
CoachPager.Order.list.map: o =>
a(
href := routes.Coach
.search(lang.fold("all")(_.code), o.key, country.fold("all")(_.code)),
cls := (order == o).option("current")
)(o.name)
)(o.i18nKey())
)
)
),
Expand Down
6 changes: 6 additions & 0 deletions modules/coreI18n/src/main/key.scala
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ object I18nKey:
val `teachingMethod`: I18nKey = "coach:teachingMethod"
val `publicStudies`: I18nKey = "coach:publicStudies"
val `youtubeVideos`: I18nKey = "coach:youtubeVideos"
val `allCountries`: I18nKey = "coach:allCountries"
val `lastLogin`: I18nKey = "coach:lastLogin"
val `lichessRating`: I18nKey = "coach:lichessRating"

object contact:
val `contact`: I18nKey = "contact:contact"
Expand Down Expand Up @@ -459,6 +462,7 @@ object I18nKey:
val `startTraining`: I18nKey = "coordinates:startTraining"
val `findSquare`: I18nKey = "coordinates:findSquare"
val `nameSquare`: I18nKey = "coordinates:nameSquare"
val `practiceOnlySomeFilesAndRanks`: I18nKey = "coordinates:practiceOnlySomeFilesAndRanks"

object dgt:
val `dgtBoard`: I18nKey = "dgt:dgtBoard"
Expand Down Expand Up @@ -1511,6 +1515,7 @@ object I18nKey:
val `flipBoard`: I18nKey = "flipBoard"
val `threefoldRepetition`: I18nKey = "threefoldRepetition"
val `claimADraw`: I18nKey = "claimADraw"
val `drawClaimed`: I18nKey = "drawClaimed"
val `offerDraw`: I18nKey = "offerDraw"
val `draw`: I18nKey = "draw"
val `drawByMutualAgreement`: I18nKey = "drawByMutualAgreement"
Expand Down Expand Up @@ -2007,6 +2012,7 @@ object I18nKey:
val `anonymous`: I18nKey = "anonymous"
val `yourScore`: I18nKey = "yourScore"
val `language`: I18nKey = "language"
val `allLanguages`: I18nKey = "allLanguages"
val `background`: I18nKey = "background"
val `light`: I18nKey = "light"
val `dark`: I18nKey = "dark"
Expand Down
2 changes: 1 addition & 1 deletion modules/ublog/src/main/ui/UblogUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ final class UblogUi(helpers: Helpers, atomUi: AtomUi)(picfitUrl: lila.core.misc.
div(cls := "box__top__actions")(
lila.ui.bits.mselect(
"ublog-lang",
language.fold("All languages")(langList.nameByLanguage),
language.fold(trans.site.allLanguages.txt())(langList.nameByLanguage),
langSelections
.map: (languageSel, name) =>
a(
Expand Down
3 changes: 3 additions & 0 deletions translation/source/coach.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@
<string name="teachingMethod">Teaching methodology</string>
<string name="publicStudies">Public studies</string>
<string name="youtubeVideos">YouTube videos</string>
<string name="allCountries">All countries</string>
<string name="lastLogin">Last login</string>
<string name="lichessRating">Lichess rating</string>
</resources>
1 change: 1 addition & 0 deletions translation/source/coordinates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
<string name="startTraining">Start training</string>
<string name="findSquare">Find square</string>
<string name="nameSquare">Name square</string>
<string name="practiceOnlySomeFilesAndRanks" comment="Label for a checkbox, keep it very short">Practice only some files &amp; ranks</string>
</resources>
1 change: 1 addition & 0 deletions translation/source/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@
<string name="anonymous">Anonymous</string>
<string name="yourScore">Your score: %s</string>
<string name="language">Language</string>
<string name="allLanguages">All languages</string>
<string name="background">Background</string>
<string name="light">Light</string>
<string name="dark">Dark</string>
Expand Down
10 changes: 10 additions & 0 deletions ui/@types/lichess/i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ interface I18n {
aboutMe: string;
/** Accepting students */
accepting: string;
/** All countries */
allCountries: string;
/** Are you a great chess coach with a %s? */
areYouCoach: I18nFormat;
/** Availability */
Expand All @@ -655,10 +657,14 @@ interface I18n {
hourlyRate: string;
/** Languages */
languages: string;
/** Last login */
lastLogin: string;
/** Lichess coach */
lichessCoach: string;
/** Lichess coaches */
lichessCoaches: string;
/** Lichess rating */
lichessRating: string;
/** Location */
location: string;
/** NM or FIDE title */
Expand Down Expand Up @@ -861,6 +867,8 @@ interface I18n {
mostChessCourses: string;
/** Name square */
nameSquare: string;
/** Practice only some files & ranks */
practiceOnlySomeFilesAndRanks: string;
/** Show coordinates */
showCoordinates: string;
/** Coordinates on every square */
Expand Down Expand Up @@ -2747,6 +2755,8 @@ interface I18n {
aiNameLevelAiLevel: I18nFormat;
/** All information is public and optional. */
allInformationIsPublicAndOptional: string;
/** All languages */
allLanguages: string;
/** All set! */
allSet: string;
/** All squares of the board */
Expand Down
2 changes: 1 addition & 1 deletion ui/coordinateTrainer/src/side.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const settings = (ctrl: CoordinateTrainerCtrl): VNode => {
ctrl.mode() === 'findSquare'
? toggle(
{
name: 'Practice only some files & ranks',
name: i18n.coordinates.practiceOnlySomeFilesAndRanks,
id: 'enableSelection',
checked: ctrl.selectionEnabled(),
change: ctrl.selectionEnabled,
Expand Down
Loading