mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-12 22:56:06 +09:00
Former-commit-id: 7a98df93b4ef50b47283abcd99576d6fbefc9cc5 Former-commit-id: db6e34417ccf84e59ba68547f30459cb4b188eb7
43 lines
1.1 KiB
Kotlin
43 lines
1.1 KiB
Kotlin
package net.torvald.terrarum.console
|
|
|
|
import net.torvald.imagefont.GameFontBase
|
|
import net.torvald.terrarum.langpack.Lang
|
|
import net.torvald.terrarum.Terrarum
|
|
import org.apache.commons.csv.CSVRecord
|
|
import org.newdawn.slick.SlickException
|
|
|
|
import java.io.IOException
|
|
|
|
/**
|
|
* Created by minjaesong on 16-01-25.
|
|
*/
|
|
class SetLocale : ConsoleCommand {
|
|
override fun execute(args: Array<String>) {
|
|
if (args.size == 2) {
|
|
val prevLocale = Terrarum.gameLocale
|
|
Terrarum.gameLocale = args[1]
|
|
try {
|
|
Echo().execute("Set locale to '" + Terrarum.gameLocale + "'.")
|
|
}
|
|
catch (e: IOException) {
|
|
Echo().execute("could not read lang file.")
|
|
Terrarum.gameLocale = prevLocale
|
|
}
|
|
|
|
}
|
|
else if (args.size == 1) {
|
|
val echo = Echo()
|
|
echo.execute("Locales:")
|
|
|
|
Lang.languageList.forEach { echo.execute("--> $it") }
|
|
}
|
|
else {
|
|
printUsage()
|
|
}
|
|
}
|
|
|
|
override fun printUsage() {
|
|
Echo().execute("Usage: setlocale [locale]")
|
|
}
|
|
}
|