Skip to content

Commit

Permalink
chore: i18n-keys to allow translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Griefed committed Sep 18, 2023
1 parent 8dd84ca commit 21bd521
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 94 deletions.
58 changes: 58 additions & 0 deletions serverpackcreator-gui/src/main/i18n/Gui_en_GB.properties
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,64 @@ settings.check.java=Java executable/binary either does not exist, is not readabl
settings.check.serverpacks=Server packs directory either does not exist or is not writable.
settings.check.whitespace=Must not end with ','!
settings.check.fallbackurl=Invalid URL format!
settings.webservice=Webservice
settings.webservice.artemisdata.tooltip=Data directory for Artemis Queue System. The Artemis Queue System handles generation request and processes generation-requests one by one.
settings.webservice.artemisdata.label=Artemis Data Directory
settings.webservice.artemisdata.chooser=Artemis Data Directory Chooser
settings.webservice.artemisusage.tooltip=Max disk usage by Artemis, in absolute percentages. A setting of 10 would use up to 10% of the available disk space before storing new data.
settings.webservice.artemisusage.label=Artemis Max Disk Usage
settings.webservice.database.tooltip=Webservice database which stores all important information about server packs available for download, among other things.
settings.webservice.database.label=Database File
settings.webservice.database.chooser=Webservice Database Directory Chooser
settings.webservice.schedule.cleanup.tooltip=CRON schedule according to which filesystem cleanups are performed.
settings.webservice.schedule.cleanup.label=Cleanup Schedule
settings.webservice.tomcat.logs.tooltip=Directory which contains the Tomcat Access logs.
settings.webservice.tomcat.logs.label=Tomcat Access Log Directory
settings.webservice.tomcat.logs.chooser=Tomcat Log Directory Chooser
settings.webservice.tomcat.dir.tooltip=Tomcat base-directory holding all Tomcat-related files.
settings.webservice.tomcat.dir.label=Tomcat Base Directory
settings.webservice.tomcat.dir.chooser=Tomcat Base Directory Chooser
settings.webservice.schedule.versions.tooltip=CRON schedule according to which version updates are performed.
settings.webservice.schedule.versions.label=Version Schedule
settings.webservice.schedule.database.tooltip=CRON schedule according to which database cleanup-operations are performed.
settings.webservice.schedule.database.label=Database Cleanup Schedule
settings.webservice.artemisdata.error=Artemis Data directory either does not exist or is not writable.
settings.webservice.artemisusage.error=Artemis max disk usage must be a value from 10 to 90.
settings.webservice.database.error=Database directory does not exist or is not writable.
settings.webservice.schedule.cleanup.error=Invalid Cleanup Schedule CRON expression.
settings.webservice.tomcat.logs.error=Tomcat Log directory does not exist or is not writable.
settings.webservice.tomcat.dir.error=Tomcat base-directory does not exist or is not writable.
settings.webservice.schedule.versions.error=Invalid Version Update Schedule CRON expression.
settings.webservice.schedule.database.error=Invalid Database Cleanup Schedule CRON expression.
settings.webservice.errors=Your Webservice settings contain errors!
settings.gui=Gui
settings.gui.font.tooltip=Font size used in ServerPackCreators GUI
settings.gui.font.label=Font Size
settings.gui.focus.start.tooltip=Whether ServerPackCreator should be focused after starting.
settings.gui.focus.start.label=Focus On Start
settings.gui.focus.generation.tooltip=Whether ServerPackCreator should be focused after a server pack has been generated.
settings.gui.focus.generation.label=Focus After Generation
settings.gui.font.error=Font size must be a value from 8 to 76.
settings.gui.errors=Your GUI settings contain errors!
settings.handle.load.tooltip=Load settings from disk
settings.handle.load.label=Load Configuration
settings.handle.save.tooltip=Save settings to disk
settings.handle.save.label=Save Configuration
settings.handle.idle=Not saved or loaded yet...
settings.handle.home.changed.message=Home directory changed. Restart ServerPackCreator for this setting to take effect.
settings.handle.home.changed.title=Home directory changed!
settings.handle.home.canceled.message=Home directory setting not saved.
settings.handle.home.canceled.title=Canceled
settings.handle.home.admin.message=Storing of the new home-directory setting requires root/admin-privileges. Continue?
settings.handle.home.admin.title=Root/Admin privileges required
settings.handle.saved=Settings last saved {0} ...
settings.handle.loaded=Settings last loaded {0} ...
settings.handle.chooser=Properties Chooser
main.unsaved.message=You have unsaved settings. Would you like to save them before closing?
main.unsaved.title=Unsaved Settings!
main.tabs.config=Configs
main.tabs.logs=Logs
main.tabs.settings=Settings
# LOGS
## Error logs
configuration.title.error=This configuration has errors!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ class MainPanel(
val controlPanel = ControlPanel(guiProps, tabbedConfigsTab, larsonScanner, apiWrapper, mainFrame)

init {
tabs.addTab("Configs", tabbedConfigsTab.panel)
tabs.addTab(Gui.main_tabs_config.toString(), tabbedConfigsTab.panel)
tabs.setTabComponentAt(tabs.tabCount - 1, tabbedConfigsTab.title)
tabs.addTab("Logs", tabbedLogsTab.panel)
tabs.addTab("Settings (WIP, not fully implemented)", settingsEditorsTab.panel)
tabs.addTab(Gui.main_tabs_logs.toString(), tabbedLogsTab.panel)
tabs.addTab(Gui.main_tabs_settings.toString(), settingsEditorsTab.panel)
tabs.setTabComponentAt(tabs.tabCount - 1, settingsEditorsTab.title)
panel.add(larsonScanner, "height 40!,growx, south")
panel.add(controlPanel.panel, "height 160!,growx, south")
Expand Down Expand Up @@ -107,8 +107,8 @@ class MainPanel(
apiWrapper.apiProperties.saveProperties(apiWrapper.apiProperties.serverPackCreatorPropertiesFile)
if (settingsEditorsTab.allTabs.any { (it as Editor).hasUnsavedChanges() }) {
if (DialogUtilities.createShowGet(
"You have unsaved settings. Would you like to save them before closing?",
"Unsaved Settings!",
Gui.main_unsaved_message.toString(),
Gui.main_unsaved_title.toString(),
panel,
JOptionPane.WARNING_MESSAGE,
JOptionPane.YES_NO_OPTION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,35 @@ class GuiSettings(
private val guiProps: GuiProps,
actionListener: ActionListener,
changeListener: ChangeListener
) : Editor("Gui", guiProps) {
) : Editor(Gui.settings_gui.toString(), guiProps) {

val fontSizeIcon = StatusIcon(guiProps,"Size of fonts in ServerPackCreators GUI.")
val fontSizeLabel = ElementLabel("Font Size")
val fontSizeIcon = StatusIcon(guiProps,Gui.settings_gui_font_tooltip.toString())

Check notice on line 34 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'fontSizeIcon' could be private
val fontSizeLabel = ElementLabel(Gui.settings_gui_font_label.toString())

Check notice on line 35 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'fontSizeLabel' could be private
val fontSizeSetting = ActionSlider(8,76,guiProps.fontSize,changeListener)

Check notice on line 36 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'fontSizeSetting' could be private
val fontSizeRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes", guiProps) {
val fontSizeRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(), guiProps) {

Check notice on line 37 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'fontSizeRevert' could be private
fontSizeSetting.value = guiProps.fontSize
}
val fontSizeReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) {
val fontSizeReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) {

Check notice on line 40 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'fontSizeReset' could be private
fontSizeSetting.value = 12
}

val startFocusIcon = StatusIcon(guiProps,"Whether ServerPackCreator should be focused after starting.")
val startFocusLabel = ElementLabel("Focus On Start")
val startFocusIcon = StatusIcon(guiProps,Gui.settings_gui_focus_start_tooltip.toString())

Check notice on line 44 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'startFocusIcon' could be private
val startFocusLabel = ElementLabel(Gui.settings_gui_focus_start_label.toString())

Check notice on line 45 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'startFocusLabel' could be private
val startFocusSetting = ActionCheckBox(actionListener)

Check notice on line 46 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'startFocusSetting' could be private
val startFocusRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes",guiProps) {
val startFocusRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) {

Check notice on line 47 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'startFocusRevert' could be private
startFocusSetting.isSelected = guiProps.startFocusEnabled
}
val startFocusReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) {
val startFocusReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) {

Check notice on line 50 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'startFocusReset' could be private
startFocusSetting.isSelected = false
}

val generationFocusIcon = StatusIcon(guiProps,"Whether ServerPackCreator should be focused after a server pack has been generated.")
val generationFocusLabel = ElementLabel("Focus After Generation")
val generationFocusIcon = StatusIcon(guiProps,Gui.settings_gui_focus_generation_tooltip.toString())

Check notice on line 54 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'generationFocusIcon' could be private
val generationFocusLabel = ElementLabel(Gui.settings_gui_focus_generation_label.toString())

Check notice on line 55 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'generationFocusLabel' could be private
val generationFocusSetting = ActionCheckBox(actionListener)

Check notice on line 56 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'generationFocusSetting' could be private
val generationFocusRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes",guiProps) {
val generationFocusRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) {

Check notice on line 57 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'generationFocusRevert' could be private
generationFocusSetting.isSelected = guiProps.generationFocusEnabled
}
val generationFocusReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) {
val generationFocusReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) {

Check notice on line 60 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'generationFocusReset' could be private
generationFocusSetting.isSelected = false
}

Expand Down Expand Up @@ -105,13 +105,13 @@ class GuiSettings(
override fun validateSettings(): List<String> {
val errors = mutableListOf<String>()
if (fontSizeSetting.value < 8 || fontSizeSetting.value > 76) {
fontSizeIcon.error("Font size must be a value from 8 to 76.")
errors.add("Font size must be a value from 8 to 76.")
fontSizeIcon.error(Gui.settings_gui_font_error.toString())
errors.add(Gui.settings_gui_font_error.toString())
} else {
fontSizeIcon.info()
}
if (errors.isNotEmpty()) {
title.setAndShowErrorIcon("Your GUI settings contain errors!")
title.setAndShowErrorIcon(Gui.settings_gui_errors.toString())
} else {
title.hideErrorIcon()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class SettingsHandling(
) {
val panel = JPanel()
private val load =
BalloonTipButton("Load Configuration", guiProps.loadIcon, "Load settings from disk", guiProps) { load() }
BalloonTipButton(Gui.settings_handle_load_label.toString(), guiProps.loadIcon, Gui.settings_handle_load_tooltip.toString(), guiProps) { load() }
private val save =
BalloonTipButton("Save Configuration", guiProps.saveIcon, "Save your settings", guiProps) { save() }
private val lastActionLabel = JLabel("Not saved or loaded yet...")
BalloonTipButton(Gui.settings_handle_save_label.toString(), guiProps.saveIcon, Gui.settings_handle_save_tooltip.toString(), guiProps) { save() }
private val lastActionLabel = JLabel(Gui.settings_handle_idle.toString())
private val rootExecutor = RootExecutor()

var lastAction: String

Check notice on line 51 in serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsHandling.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'lastAction' could be private
Expand Down Expand Up @@ -75,26 +75,26 @@ class SettingsHandling(
private fun showHomeDirDialog() {
JOptionPane.showMessageDialog(
mainFrame.frame,
"Home directory changed. Restart ServerPackCreator for this setting to take effect.",
"Home directory changed!",
Gui.settings_handle_home_changed_message.toString(),
Gui.settings_handle_home_changed_title.toString(),
JOptionPane.WARNING_MESSAGE
)
}

private fun showCancelDialog() {
JOptionPane.showMessageDialog(
mainFrame.frame,
"Home directory setting not saved.",
"Canceled",
Gui.settings_handle_home_canceled_message.toString(),
Gui.settings_handle_home_canceled_title.toString(),
JOptionPane.WARNING_MESSAGE
)
}

private fun rootWarning(): Int {
return JOptionPane.showConfirmDialog(
mainFrame.frame,
"Storing of the new home-directory setting requires root/admin-privileges. Continue?",
"Root/Admin privileges required",
Gui.settings_handle_home_admin_message.toString(),
Gui.settings_handle_home_admin_title.toString(),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE
)
Expand Down Expand Up @@ -124,17 +124,17 @@ class SettingsHandling(
if (previousHome != settingsEditorsTab.global.homeSetting.file.absolutePath && saved) {
showHomeDirDialog()
}
lastAction = "Settings last saved ${currentTime()} ..."
lastAction = Gui.settings_handle_saved(currentTime())
}

fun load() {
val propertiesChooser = PropertiesChooser(apiProperties, "Properties Chooser")
val propertiesChooser = PropertiesChooser(apiProperties, Gui.settings_handle_chooser.toString())
if (propertiesChooser.showOpenDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) {
apiProperties.loadProperties(propertiesChooser.selectedFile)
settingsEditorsTab.global.loadSettings()
settingsEditorsTab.gui.loadSettings()
settingsEditorsTab.webservice.loadSettings()
lastAction = "Settings last loaded ${currentTime()} ..."
lastAction = Gui.settings_handle_loaded(currentTime())
}
}
}
Loading

0 comments on commit 21bd521

Please sign in to comment.