commit
407edff2df
@ -0,0 +1,61 @@
|
|||||||
|
package net.trivernis.chunkmaster.lib
|
||||||
|
import net.trivernis.chunkmaster.Chunkmaster
|
||||||
|
import java.io.BufferedReader
|
||||||
|
import java.io.File
|
||||||
|
import java.lang.Exception
|
||||||
|
import java.util.Properties
|
||||||
|
|
||||||
|
class LanguageManager(private val plugin: Chunkmaster) {
|
||||||
|
private val langProps = Properties()
|
||||||
|
private val languageFolder = "${plugin.dataFolder.absolutePath}/i18n"
|
||||||
|
private var langFileLoaded = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the default properties file and then the language specific ones.
|
||||||
|
* If no lang-specific file is found in the plugins directory under i18n an attempt is made to
|
||||||
|
* load the file from inside the jar in i18n.
|
||||||
|
*/
|
||||||
|
fun loadProperties() {
|
||||||
|
val language = plugin.config.getString("language")
|
||||||
|
val langFile = "$languageFolder/$language.i18n.properties"
|
||||||
|
val file = File(langFile)
|
||||||
|
val loader = Thread.currentThread().contextClassLoader
|
||||||
|
val defaultStream = this.javaClass.getResourceAsStream("/i18n/DEFAULT.i18n.properties")
|
||||||
|
if (defaultStream != null) {
|
||||||
|
langProps.load(defaultStream)
|
||||||
|
defaultStream.close()
|
||||||
|
} else {
|
||||||
|
plugin.logger.severe("Couldn't load default language properties.")
|
||||||
|
}
|
||||||
|
if (file.exists()) {
|
||||||
|
try {
|
||||||
|
val inputStream = loader.getResourceAsStream(langFile)
|
||||||
|
if (inputStream != null) {
|
||||||
|
langProps.load(inputStream)
|
||||||
|
langFileLoaded = true
|
||||||
|
inputStream.close()
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
plugin.logger.warning("Language file $langFile could not be loaded!")
|
||||||
|
plugin.logger.fine(e.toString())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val inputStream = this.javaClass.getResourceAsStream("/i18n/$language.i18n.properties")
|
||||||
|
if (inputStream != null) {
|
||||||
|
langProps.load(inputStream)
|
||||||
|
langFileLoaded = true
|
||||||
|
inputStream.close()
|
||||||
|
} else {
|
||||||
|
plugin.logger.warning("Language File $langFile could not be found!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a localized message with replacements
|
||||||
|
*/
|
||||||
|
fun getLocalized(key: String, vararg replacements: Any): String {
|
||||||
|
val localizedString = langProps.getProperty(key)
|
||||||
|
return String.format(localizedString, *replacements)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
RESUME_FOR_WORLD = Resuming chunk generation task for world '%s'...
|
||||||
|
TASK_FINISHED = Task #%d finished after %d chunks.
|
||||||
|
TASK_CANCELED = Canceled task #%s.
|
||||||
|
TASK_LOAD_FAILED = \u00A7cFailed to load task #%d.
|
||||||
|
TASK_LOAD_SUCCESS = %d saved tasks loaded.
|
||||||
|
TASK_NOT_FOUND = \u00A7cTask %s not found!
|
||||||
|
CREATE_DELAYED_LOAD = Creating task to load chunk generation Tasks later...
|
||||||
|
TASK_PERIODIC_REPORT = Task #%d running for '%s'. Progress: %d chunks %s %s, Speed: %.1f ch/s, Last Chunk: %d, %d
|
||||||
|
TASK_SAVE_FAILED = \u00A7cException when saving tasks: %s
|
||||||
|
|
||||||
|
WORLD_NAME_REQUIRED = \u00A7cYou need to provide a world name!
|
||||||
|
WORLD_NOT_FOUND = \u00A7cWorld \u00A72%s \u00A7cnot found!
|
||||||
|
TASK_ALREADY_EXISTS = \u00A7cA task for '%s' already exists!
|
||||||
|
TASK_CREATION_SUCCESS = \u00A79Generation Task for world \u00A72%s \u00A79 until \u00A72%s \u00A79successfully created!
|
||||||
|
TASK_ID_REQUIRED = \u00A7cYou need to provide a task id!
|
||||||
|
|
||||||
|
PAUSED_TASKS_HEADER = Currently Paused Generation Tasks
|
||||||
|
TASKS_ENTRY = - \u00A79#%d\u00A7r - \u00A72%s\u00A7r - \u00A72%d chunks %s\u00A7r
|
||||||
|
RUNNING_TASKS_HEADER = Currently Running Generation Tasks
|
||||||
|
NO_GENERATION_TASKS = There are no generation tasks.
|
||||||
|
|
||||||
|
PAUSE_SUCCESS = \u00A79Paused all generation tasks.
|
||||||
|
ALREADY_PAUSED = \u00A7cThe generation process is already paused!
|
||||||
|
|
||||||
|
RESUME_SUCCESS = \u00A79Resumed all generation Tasks.
|
||||||
|
NOT_PAUSED = \u00A7cThe generation process is not paused!
|
||||||
|
|
||||||
|
CONFIG_RELOADING = Reloading the config file...
|
||||||
|
CONFIG_RELOADED = \u00A72The config file has been reloaded!
|
||||||
|
|
||||||
|
TELEPORTED = \u00A79You have been teleported to chunk \u00A72%s, %s
|
||||||
|
TP_ONLY_PLAYER = \u00A7cThis command can only be executed by a player!
|
||||||
|
|
||||||
|
NO_PERMISSION = \u00A7cYou do not have the permission for this command!
|
||||||
|
SUBCOMMAND_NOT_FOUND = \u00A7cSubcommand \u00A72%s \u00A7cnot found!
|
||||||
|
|
||||||
|
STOPPING_ALL_TASKS = Stopping all generation tasks...
|
||||||
|
DB_INIT = Initializing database...
|
||||||
|
DB_INIT_FINISHED = Database fully initialized.
|
||||||
|
DB_INIT_EROR = Failed to init database: %s.
|
||||||
|
|
||||||
|
DATABASE_CONNECTION_ERROR = \u00A7cCould not get the database connection!
|
||||||
|
SQL_ERROR = \u00A7cAn eror occured on sql %s!
|
||||||
|
NO_DATABASE_CONNECTION = \u00A7cCould not execute sql: No database connection.
|
||||||
|
CREATE_TABLE_DEFINITION = Created table %s with definition %s.
|
||||||
|
TABLE_CREATE_ERROR = \u00A7cError when creation table %s.
|
||||||
|
UPDATE_TABLE_DEFINITION = Updated table %s with sql %s.
|
||||||
|
UPDATE_TABLE_FAILED = Failed to update table %s with sql %s.
|
@ -0,0 +1,48 @@
|
|||||||
|
RESUME_FOR_WORLD = Setze das Chunk-Generieren f\u00fcr Welt '%s' fort...
|
||||||
|
TASK_FINISHED = Aufgabe #%d wurde nach %d chunks beendet.
|
||||||
|
TASK_CANCELED = Aufgabe #%s wurde abgebrochen.
|
||||||
|
TASK_LOAD_FAILED = \u00A7cAufgabe #%d konnte nicht geladen werden.
|
||||||
|
TASK_LOAD_SUCCESS = %d gespeicherte Aufgaben wurden geladen.
|
||||||
|
TASK_NOT_FOUND = \u00A7cAufgabe %s konnte nicht gefunden werden!
|
||||||
|
CREATE_DELAYED_LOAD = Erstelle einen Bukkit-Task zum verz\u00f6gerten Laden von Aufgaben...
|
||||||
|
TASK_PERIODIC_REPORT = Aufgabe #%d f\u00fcr Welt '%s'. Fortschritt: %d chunks %s %s, Geschwindigkeit: %.1f ch/s, Letzer Chunk: %d, %d
|
||||||
|
TASK_SAVE_FAILED = \u00A7cFehler beim Speichern der Aufgaben: %s
|
||||||
|
|
||||||
|
WORLD_NAME_REQUIRED = \u00A7cDu musst einen Weltennamen angeben!
|
||||||
|
WORLD_NOT_FOUND = \u00A7c Die Welt \u00A72%s \u00A7cwurde nicht gefunden!
|
||||||
|
TASK_ALREADY_EXISTS = \u00A7cEs existiert bereits eine Aufgabe f\u00fcr \u00A72%s\u00A7c!
|
||||||
|
TASK_CREATION_SUCCESS = \u00A79Generierungs-Aufgabe \u00A72%s \u00A79 bis \u00A72%s \u00A79wurde erfolgreich erstellt!
|
||||||
|
TASK_ID_REQUIRED = \u00A7cDu musst eine Aufgaben-Id angeben!
|
||||||
|
|
||||||
|
PAUSED_TASKS_HEADER = \u00A7lPausierte Generierungsaufgaben\u00A7r
|
||||||
|
|
||||||
|
RUNNING_TASKS_HEADER = \u00A7lLaufende Generierungsaufgaben\u00A7r
|
||||||
|
NO_GENERATION_TASKS = Es gibt keine Aufgaben.
|
||||||
|
|
||||||
|
PAUSE_SUCCESS = \u00A79Alle Aufgaben wurden pausiert.
|
||||||
|
ALREADY_PAUSED = \u00A7cDas Generieren ist bereits pausiert.
|
||||||
|
|
||||||
|
RESUME_SUCCESS = \u00A79Alle Aufgaben wurden fortgesetzt.
|
||||||
|
NOT_PAUSED = \u00A7cEs gibt keine pausierten Aufgaben!
|
||||||
|
|
||||||
|
CONFIG_RELOADING = Die Konfigurationsdatei wird neu eingelesen...
|
||||||
|
CONFIG_RELOADED = \u00A72Die Konfigurationsdatei wurde neu geladen!
|
||||||
|
|
||||||
|
TELEPORTED = \u00A79Du wurdest zum Chunk \u00A72%s, %s \u00A79teleportiert
|
||||||
|
TP_ONLY_PLAYER = \u00A7cDieser Befehl kann nur von einem Spieler ausgef\u00fchrt werden.
|
||||||
|
|
||||||
|
NO_PERMISSION = \u00A7cDu hast nicht die Rechte für diesen Befehl!
|
||||||
|
SUBCOMMAND_NOT_FOUND = \u00A7cUnteraktion \u00A72%s \u00A7cwurde nicht gefunden!
|
||||||
|
|
||||||
|
STOPPING_ALL_TASKS = Stoppt alle Aufgaben...
|
||||||
|
DB_INIT = Initialisiere Datenbank...
|
||||||
|
DB_INIT_FINISHED = Die Datenbank wurde initialisiert.
|
||||||
|
DB_INIT_EROR = Fehler beim Initalisieren der Datenbank: %s.
|
||||||
|
|
||||||
|
DATABASE_CONNECTION_ERROR = \u00A7cDie Datenbankverbindung konnte nicht erzeugt werden.
|
||||||
|
SQL_ERROR = \u00A7cEin Fehler trat mit sql %s auf!
|
||||||
|
NO_DATABASE_CONNECTION = \u00A7cSql konnte nicht ausgef\u00fchrt werden: Keine Datenbankverbindung.
|
||||||
|
CREATE_TABLE_DEFINITION = Tabelle %s mit Definition %s wurde erstellt.
|
||||||
|
TABLE_CREATE_ERROR = \u00A7cFehler beim erstellen der Tabelle %s.
|
||||||
|
UPDATE_TABLE_DEFINITION = Tabelle %s wurde mit sql %s geupdated.
|
||||||
|
UPDATE_TABLE_FAILED = Fehler beim Updaten der Tabelle %s mit sql %s.
|
@ -0,0 +1,48 @@
|
|||||||
|
RESUME_FOR_WORLD = Resuming chunk generation task for world '%s'...
|
||||||
|
TASK_FINISHED = Task #%d finished after %d chunks.
|
||||||
|
TASK_CANCELED = Canceled task #%s.
|
||||||
|
TASK_LOAD_FAILED = \u00A7cFailed to load task #%d.
|
||||||
|
TASK_LOAD_SUCCESS = %d saved tasks loaded.
|
||||||
|
TASK_NOT_FOUND = \u00A7cTask %s not found!
|
||||||
|
CREATE_DELAYED_LOAD = Creating task to load chunk generation Tasks later...
|
||||||
|
TASK_PERIODIC_REPORT = Task #%d running for '%s'. Progress: %d chunks %s %s, Speed: %.1f ch/s, Last Chunk: %d, %d
|
||||||
|
TASK_SAVE_FAILED = \u00A7cException when saving tasks: %s
|
||||||
|
|
||||||
|
WORLD_NAME_REQUIRED = \u00A7cYou need to provide a world name!
|
||||||
|
WORLD_NOT_FOUND = \u00A7cWorld \u00A72%s \u00A7cnot found!
|
||||||
|
TASK_ALREADY_EXISTS = \u00A7cA task for '%s' already exists!
|
||||||
|
TASK_CREATION_SUCCESS = \u00A79Generation Task for world \u00A72%s \u00A79 until \u00A72%s \u00A79successfully created!
|
||||||
|
TASK_ID_REQUIRED = \u00A7cYou need to provide a task id!
|
||||||
|
|
||||||
|
PAUSED_TASKS_HEADER = Currently Paused Generation Tasks
|
||||||
|
TASKS_ENTRY = - \u00A79#%d\u00A7r - \u00A72%s\u00A7r - \u00A72%d chunks %s\u00A7r
|
||||||
|
RUNNING_TASKS_HEADER = Currently Running Generation Tasks
|
||||||
|
NO_GENERATION_TASKS = There are no generation tasks.
|
||||||
|
|
||||||
|
PAUSE_SUCCESS = \u00A79Paused all generation tasks.
|
||||||
|
ALREADY_PAUSED = \u00A7cThe generation process is already paused!
|
||||||
|
|
||||||
|
RESUME_SUCCESS = \u00A79Resumed all generation Tasks.
|
||||||
|
NOT_PAUSED = \u00A7cThe generation process is not paused!
|
||||||
|
|
||||||
|
CONFIG_RELOADING = Reloading the config file...
|
||||||
|
CONFIG_RELOADED = \u00A72The config file has been reloaded!
|
||||||
|
|
||||||
|
TELEPORTED = \u00A79You have been teleported to chunk \u00A72%s, %s
|
||||||
|
TP_ONLY_PLAYER = \u00A7cThis command can only be executed by a player!
|
||||||
|
|
||||||
|
NO_PERMISSION = \u00A7cYou do not have the permission for this command!
|
||||||
|
SUBCOMMAND_NOT_FOUND = \u00A7cSubcommand \u00A72%s \u00A7cnot found!
|
||||||
|
|
||||||
|
STOPPING_ALL_TASKS = Stopping all generation tasks...
|
||||||
|
DB_INIT = Initializing database...
|
||||||
|
DB_INIT_FINISHED = Database fully initialized.
|
||||||
|
DB_INIT_EROR = Failed to init database: %s.
|
||||||
|
|
||||||
|
DATABASE_CONNECTION_ERROR = \u00A7cCould not get the database connection!
|
||||||
|
SQL_ERROR = \u00A7cAn eror occured on sql %s!
|
||||||
|
NO_DATABASE_CONNECTION = \u00A7cCould not execute sql: No database connection.
|
||||||
|
CREATE_TABLE_DEFINITION = Created table %s with definition %s.
|
||||||
|
TABLE_CREATE_ERROR = \u00A7cError when creation table %s.
|
||||||
|
UPDATE_TABLE_DEFINITION = Updated table %s with sql %s.
|
||||||
|
UPDATE_TABLE_FAILED = Failed to update table %s with sql %s.
|
Loading…
Reference in New Issue