eros: add translation for all missing buttons

This commit is contained in:
Bixilon 2021-12-17 15:17:50 +01:00
parent b85e610bbb
commit c84a859bd9
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
5 changed files with 62 additions and 13 deletions

View File

@ -25,6 +25,7 @@ object TranslatableComponents {
val GENERAL_DELETE = "minosoft:general.delete".toResourceLocation()
val GENERAL_IGNORE = "minosoft:general.ignore".toResourceLocation()
val GENERAL_EXIT = "minosoft:general.exit".toResourceLocation()
val GENERAL_REFRESH = "minosoft:general.refresh".toResourceLocation()
val EROS_DELETE_SERVER_CONFIRM_DESCRIPTION = { name: ChatComponent, address: String -> Minosoft.LANGUAGE_MANAGER.translate("minosoft:server_info.delete.dialog.description".toResourceLocation(), null, name, address) }
val ACCOUNT_CARD_CONNECTION_COUNT = { count: Int -> Minosoft.LANGUAGE_MANAGER.translate("minosoft:main.account.card.connection_count".toResourceLocation(), null, count) }

View File

@ -22,12 +22,14 @@ import de.bixilon.minosoft.data.accounts.types.MojangAccount
import de.bixilon.minosoft.data.accounts.types.OfflineAccount
import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.text.ChatComponent
import de.bixilon.minosoft.data.text.TranslatableComponents
import de.bixilon.minosoft.gui.eros.controller.EmbeddedJavaFXController
import de.bixilon.minosoft.gui.eros.dialog.SimpleErosConfirmationDialog
import de.bixilon.minosoft.gui.eros.main.account.add.MicrosoftAddController
import de.bixilon.minosoft.gui.eros.main.account.add.MojangAddController
import de.bixilon.minosoft.gui.eros.main.account.add.OfflineAddController
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil.ctext
import de.bixilon.minosoft.util.KUtil.decide
import de.bixilon.minosoft.util.KUtil.extend
import de.bixilon.minosoft.util.KUtil.toResourceLocation
@ -61,6 +63,7 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
refreshList()
addButtonFX.isDisable = new.addHandler == null
}
addButtonFX.ctext = ADD
accountListViewFX.selectionModel.selectedItemProperty().addListener { _, _, new ->
@ -142,16 +145,15 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
it.add(Button("Delete").apply {
setOnAction {
SimpleErosConfirmationDialog(
onConfirm = {
if (profile.selected == account) {
profile.selected = null
}
profile.entries -= account.id
JavaFXUtil.runLater { refreshList() }
SimpleErosConfirmationDialog(onConfirm = {
if (profile.selected == account) {
profile.selected = null
}
).show()
profile.entries -= account.id
JavaFXUtil.runLater { refreshList() }
}).show()
}
ctext = TranslatableComponents.GENERAL_DELETE
}, 1, 0)
it.add(Button("Verify").apply {
@ -162,6 +164,7 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
JavaFXUtil.runLater { refreshList() }
}
}
ctext = VERIFY
}, 3, 0)
it.add(Button("Use").apply {
setOnAction {
@ -174,6 +177,7 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
}
}
isDisable = profile.selected == account
ctext = USE
}, 4, 0)
@ -190,6 +194,10 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
companion object {
val LAYOUT = "minosoft:eros/main/account/account.fxml".toResourceLocation()
private val VERIFY = "minosoft:main.account.list.info.button.verify".toResourceLocation()
private val USE = "minosoft:main.account.list.info.button.use".toResourceLocation()
private val ADD = "minosoft:main.account.list.info.button.add".toResourceLocation()
private val ACCOUNT_INFO_PROPERTIES: List<Pair<ResourceLocation, (account: Account) -> Any?>> = listOf(
"minosoft:main.account.account_info.id".toResourceLocation() to { it.id },
)

View File

@ -34,6 +34,7 @@ import de.bixilon.minosoft.gui.eros.main.play.server.card.ServerCardController
import de.bixilon.minosoft.gui.eros.main.play.server.type.types.ServerType
import de.bixilon.minosoft.gui.eros.modding.invoker.JavaFXEventInvoker
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil.ctext
import de.bixilon.minosoft.modding.event.events.KickEvent
import de.bixilon.minosoft.modding.event.events.LoginKickEvent
import de.bixilon.minosoft.modding.event.events.connection.play.PlayConnectionStateChangeEvent
@ -84,10 +85,15 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
serverConfig::hideEmpty.profileWatchFX(this, true) { hideEmptyFX.isSelected = it;refreshList() }
hideOfflineFX.setOnAction { ErosProfileManager.selected.server.list.hideOffline = hideOfflineFX.isSelected }
hideOfflineFX.ctext = HIDE_OFFLINE
hideFullFX.setOnAction { ErosProfileManager.selected.server.list.hideFull = hideFullFX.isSelected }
hideFullFX.ctext = HIDE_FULL
hideEmptyFX.setOnAction { ErosProfileManager.selected.server.list.hideEmpty = hideEmptyFX.isSelected }
hideEmptyFX.ctext = HIDE_EMPTY
addServerButtonFX.ctext = ADD_SERVER
val accountProfile = erosProfile.general.accountProfile
serverListViewFX.setCellFactory {
val controller = ServerCardController.build()
@ -271,6 +277,7 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
serverType.servers -= serverCard.server
}).show()
}
ctext = TranslatableComponents.GENERAL_DELETE
}, 0, 0)
it.add(Button("Edit").apply {
setOnAction {
@ -295,6 +302,7 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
JavaFXUtil.runLater { refreshList() }
}).show()
}
ctext = EDIT
}, 1, 0)
}
@ -303,6 +311,7 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
serverCard.ping().ping()
}
isDisable = serverCard.ping != null && serverCard.ping?.state != StatusConnectionStates.PING_DONE && serverCard.ping?.state != StatusConnectionStates.ERROR
ctext = TranslatableComponents.GENERAL_REFRESH
}, 3, 0)
it.add(Button("Connect").apply {
setOnAction {
@ -312,6 +321,7 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
val selected = account.selected
isDisable = selected == null || !serverCard.canConnect(selected)
// ToDo: Also disable, if currently connecting
ctext = CONNECT
}, 4, 0)
@ -370,6 +380,15 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
companion object {
val LAYOUT = "minosoft:eros/main/play/server/server_list.fxml".toResourceLocation()
private val HIDE_OFFLINE = "minosoft:server_list.hide_offline".toResourceLocation()
private val HIDE_FULL = "minosoft:server_list.hide_full".toResourceLocation()
private val HIDE_EMPTY = "minosoft:server_list.hide_empty".toResourceLocation()
private val ADD_SERVER = "minosoft:server_list.add_server".toResourceLocation()
private val CONNECT = "minosoft:server_list.button.connect".toResourceLocation()
private val EDIT = "minosoft:server_list.button.edit".toResourceLocation()
private val SERVER_INFO_PROPERTIES: List<Pair<ResourceLocation, (ServerCard) -> Any?>> = listOf(
"minosoft:server_info.server_name".toResourceLocation() to { it.server.name },
"minosoft:server_info.server_address".toResourceLocation() to { it.server.address },

View File

@ -19,11 +19,13 @@ import de.bixilon.minosoft.config.profile.profiles.Profile
import de.bixilon.minosoft.data.registries.ResourceLocation
import de.bixilon.minosoft.data.text.ChatComponent
import de.bixilon.minosoft.data.text.TextComponent
import de.bixilon.minosoft.data.text.TranslatableComponents
import de.bixilon.minosoft.data.text.events.ClickEvent
import de.bixilon.minosoft.gui.eros.controller.EmbeddedJavaFXController
import de.bixilon.minosoft.gui.eros.dialog.SimpleErosConfirmationDialog
import de.bixilon.minosoft.gui.eros.dialog.profiles.ProfileCreateDialog
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil.ctext
import de.bixilon.minosoft.util.KUtil.decide
import de.bixilon.minosoft.util.KUtil.toResourceLocation
import de.bixilon.minosoft.util.delegate.watcher.entry.MapDelegateWatcher.Companion.watchMapFX
@ -36,10 +38,11 @@ import javafx.scene.layout.*
class ProfilesListController : EmbeddedJavaFXController<Pane>() {
@FXML private lateinit var createProfileButtonFX: Button
@FXML private lateinit var profilesListViewFX: ListView<Profile>
@FXML private lateinit var profileInfoFX: AnchorPane
@FXML private lateinit var createProfileButtonFX: Button
var profileManager: ProfileManager<Profile>? = null
set(value) {
check(value != null)
@ -63,6 +66,7 @@ class ProfilesListController : EmbeddedJavaFXController<Pane>() {
profilesListViewFX.selectionModel.selectedItemProperty().addListener { _, _, new ->
setProfileInfo(new)
}
createProfileButtonFX.ctext = CREATE
}
override fun postInit() {
@ -159,10 +163,12 @@ class ProfilesListController : EmbeddedJavaFXController<Pane>() {
}
}).show()
}
ctext = TranslatableComponents.GENERAL_DELETE
}, 0, 0)
it.add(Button("Edit").apply {
// ToDo: Profile editing
isDisable = true
ctext = EDIT
}, 1, 0)
it.add(Button("Set primary").apply {
@ -171,6 +177,7 @@ class ProfilesListController : EmbeddedJavaFXController<Pane>() {
profile.manager.selected = profile
isDisable = true
}
ctext = SET_PRIMARY
}, 3, 0)
@ -200,6 +207,10 @@ class ProfilesListController : EmbeddedJavaFXController<Pane>() {
companion object {
val LAYOUT = "minosoft:eros/main/profiles/profiles_list.fxml".toResourceLocation()
private val EDIT = "minosoft:profiles.profile.list.button.edit".toResourceLocation()
private val SET_PRIMARY = "minosoft:profiles.profile.list.button.set_primary".toResourceLocation()
private val CREATE = "minosoft:profiles.profile.list.button.create".toResourceLocation()
private val PROFILE_INFO_PROPERTIES: List<Pair<ResourceLocation, (Profile) -> Any?>> = listOf(
"minosoft:profiles.profile.name".toResourceLocation() to { it.name },
"minosoft:profiles.profile.description".toResourceLocation() to { it.description },

View File

@ -4,6 +4,7 @@ minosoft:general.confirm=Confirm
minosoft:general.delete=Delete
minosoft:general.ignore=Ignore
minosoft:general.exit=Exit
minosoft:general.refresh=Refresh
minosoft:eros_window_title=Minosoft
@ -65,23 +66,28 @@ minosoft:modify_server.forced_version.releases=Releases
minosoft:modify_server.forced_version.snapshots=Snapshots
minosoft:modify_server.profiles.label=Profiles
minosoft:modify_server.profiles.open_select_dialog=Open profile selector
minosoft:modify_server.add.title=Add server - Minosoft
minosoft:modify_server.add.description=Please enter the server name, their hostname or IP address and select the version in order to add the server
minosoft:modify_server.add.update_button=Add server
minosoft:modify_server.edit.title=Edit server - Minosoft
minosoft:modify_server.edit.description=Please change the server details and click on save
minosoft:modify_server.edit.update_button=Save server
minosoft:server_list.hide_offline=Hide offline
minosoft:server_list.hide_full=Hide full
minosoft:server_list.hide_empty=Hide empty
minosoft:server_list.add_server=Hide empty
minosoft:server_list.button.connect=Connect
minosoft:server_list.button.edit=Edit
minosoft:server_list.refresh.header=Refresh
minosoft:server_list.refresh.text1=Get the latest
minosoft:server_list.refresh.text2=information
minosoft:main.account.list.info.button.verify=Verify
minosoft:main.account.list.info.button.use=Use
minosoft:main.account.list.info.add=Add account
minosoft:main.account.no_account_selected=No account selected
minosoft:main.account.type.mojang=Mojang
minosoft:main.account.type.microsoft=Microsoft
minosoft:main.account.type.offline=Offline
@ -168,3 +174,7 @@ minosoft:profiles.profile.name=Name
minosoft:profiles.profile.description=Description
minosoft:profiles.profile.disk_path=Disk path
minosoft:profiles.profile.list.button.edit=Edit
minosoft:profiles.profile.list.button.set_primary=Set primary
minosoft:profiles.profile.list.button.create=Create profile