From 95d6c0871a4942f1d253e6cd3ae121c07dc2cbc5 Mon Sep 17 00:00:00 2001 From: Unihedron Date: Sat, 15 Aug 2015 19:06:59 +0800 Subject: [PATCH 1/4] Reuse the same element in 6e4b28e Well, I kinda missed this part in the last PR, second time's the charm! --- app/views/base/layout.scala.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/base/layout.scala.html b/app/views/base/layout.scala.html index 92764429f4..242b00985a 100644 --- a/app/views/base/layout.scala.html +++ b/app/views/base/layout.scala.html @@ -39,7 +39,7 @@ withLangAnnotations: Boolean = true)(body: Html)(implicit ctx: Context) @if(withLangAnnotations){@langAnnotations} @ctx.transpBgImg.map { img => - + } "st" case 2 => "nd" case 3 => "rd" From 21f81c5543e6930b890ab673e41e2c2bc467b031 Mon Sep 17 00:00:00 2001 From: Unihedron Date: Sat, 15 Aug 2015 21:32:28 +0800 Subject: [PATCH 4/4] actually check the tenth digit instead --- app/templating/NumberHelper.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templating/NumberHelper.scala b/app/templating/NumberHelper.scala index 087dc17134..453381be17 100644 --- a/app/templating/NumberHelper.scala +++ b/app/templating/NumberHelper.scala @@ -22,7 +22,7 @@ trait NumberHelper { self: I18nHelper => def localize(implicit ctx: UserContext): String = formatter format number } - def nth(number: Int) = if ((11 to 13).contains(number)) + def nth(number: Int) = if ((11 to 13).contains(number % 100)) "th" else number % 10 match { case 1 => "st"