1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Fix plurals.

This commit is contained in:
Cedric Beust 2016-04-11 10:01:12 -07:00
parent 9ff5b52a7d
commit 3dc039e956
4 changed files with 7 additions and 6 deletions

View file

@ -69,7 +69,7 @@ public class TaskManager @Inject constructor(val args: Args, val incrementalMana
log(2, "Marking project ${project.name} as skipped")
failedProjects.add(project.name)
kobaltError("Not building project ${project.name} since it depends on failed "
+ Strings.pluralize("project", fp.size)
+ Strings.pluralize(fp.size, "project")
+ " " + fp.joinToString(","))
} else {
val projectName = project.name

View file

@ -4,8 +4,8 @@ import com.google.common.base.CharMatcher
class Strings {
companion object {
fun pluralize(s: String, n: Int) = s + (if (n != 1) "s" else "")
fun pluralizeAll(s: String, n: Int) = "$n " + pluralize(s, n)
fun pluralize(n:Int, s: String, plural: String = s) = plural + (if (n != 1) "s" else "")
fun pluralizeAll(n:Int, s: String, plural: String = s) = "$n " + pluralize(n, s, plural)
}
}