diff --git a/src/main/java/core/HO.java b/src/main/java/core/HO.java index 4a83d7834..a7c46eab7 100644 --- a/src/main/java/core/HO.java +++ b/src/main/java/core/HO.java @@ -10,15 +10,17 @@ import core.gui.theme.ThemeManager; import core.jmx.StatementCacheMonitor; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.training.TrainingManager; import core.util.ExceptionHandler; import core.util.HOLogger; import core.util.OSUtils; -import java.io.File; + import javax.imageio.ImageIO; import javax.management.*; import javax.swing.*; +import java.io.File; import java.lang.management.ManagementFactory; import java.text.NumberFormat; import java.util.ArrayList; @@ -183,13 +185,13 @@ public static void main(String[] args) { // Check if language file available interruptionWindow.setInfoText(4, "Check Language files"); HOVerwaltung.checkLanguageFile(UserParameter.instance().sprachDatei); - HOVerwaltung.instance().setTranslator(UserParameter.instance().sprachDatei); + TranslationFacility.setLanguage(UserParameter.instance().sprachDatei); if (DBManager.instance().isFirstStart()) { interruptionWindow.setVisible(false); JOptionPane.showMessageDialog(null, - HOVerwaltung.instance().getLanguageString("firststartup.infowinmessage"), - HOVerwaltung.instance().getLanguageString("firststartup.infowinmessage.title"), JOptionPane.INFORMATION_MESSAGE); + TranslationFacility.tr("firststartup.infowinmessage"), + TranslationFacility.tr("firststartup.infowinmessage.title"), JOptionPane.INFORMATION_MESSAGE); interruptionWindow.setVisible(true); } diff --git a/src/main/java/core/constants/TeamConfidence.java b/src/main/java/core/constants/TeamConfidence.java index 3fa328cde..0924459e7 100644 --- a/src/main/java/core/constants/TeamConfidence.java +++ b/src/main/java/core/constants/TeamConfidence.java @@ -1,7 +1,7 @@ package core.constants; import core.datatype.CBItem; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; public class TeamConfidence { @@ -17,16 +17,16 @@ public class TeamConfidence { public static final int COMPLETELY_EXAGGERATED = 9; public static CBItem[] ITEMS = { - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.non-existent"), NON_EXISTENT), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.disastrous"), DISASTROUS), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.wretched"), WRETCHED), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.poor"), POOR), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.decent"), DECENT), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.strong"), STRONG), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.wonderful"), WONDERFUL), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.slightlyexaggerated"), SLIGHTLY_EXAGGERATED), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.exaggerated"), EXAGGERATED), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.confidence.completelyexaggerated"), COMPLETELY_EXAGGERATED) + new CBItem(TranslationFacility.tr("ls.team.confidence.non-existent"), NON_EXISTENT), + new CBItem(TranslationFacility.tr("ls.team.confidence.disastrous"), DISASTROUS), + new CBItem(TranslationFacility.tr("ls.team.confidence.wretched"), WRETCHED), + new CBItem(TranslationFacility.tr("ls.team.confidence.poor"), POOR), + new CBItem(TranslationFacility.tr("ls.team.confidence.decent"), DECENT), + new CBItem(TranslationFacility.tr("ls.team.confidence.strong"), STRONG), + new CBItem(TranslationFacility.tr("ls.team.confidence.wonderful"), WONDERFUL), + new CBItem(TranslationFacility.tr("ls.team.confidence.slightlyexaggerated"), SLIGHTLY_EXAGGERATED), + new CBItem(TranslationFacility.tr("ls.team.confidence.exaggerated"), EXAGGERATED), + new CBItem(TranslationFacility.tr("ls.team.confidence.completelyexaggerated"), COMPLETELY_EXAGGERATED) }; @@ -34,7 +34,7 @@ public static String toString(int teamConfidence){ if(teamConfidence >= NON_EXISTENT && teamConfidence <= COMPLETELY_EXAGGERATED) return ITEMS[teamConfidence].getText(); else - return HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr("Unbestimmt"); } } diff --git a/src/main/java/core/constants/TeamSpirit.java b/src/main/java/core/constants/TeamSpirit.java index 45ca20a37..ffc0ea7b2 100644 --- a/src/main/java/core/constants/TeamSpirit.java +++ b/src/main/java/core/constants/TeamSpirit.java @@ -1,7 +1,7 @@ package core.constants; import core.datatype.CBItem; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; public final class TeamSpirit { @@ -18,17 +18,17 @@ public final class TeamSpirit { public static final int PARADISE_ON_EARTH = 10; public static CBItem[] ITEMS = { - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.likethecoldwar"), LIKE_THE_COLD_WAR), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.murderous"), MURDEROUS), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.furious"), FURIOUS), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.irritated"), IRRITATED), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.composed"), COMPOSED), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.calm"), CALM), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.content"), CONTENT), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.satisfied"), SATISFIED), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.delirious"), DELIRIOUS), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.walkingonclouds"), WALKING_ON_CLOUDS), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit.paradiseonearth"), PARADISE_ON_EARTH) }; + new CBItem(TranslationFacility.tr("ls.team.teamspirit.likethecoldwar"), LIKE_THE_COLD_WAR), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.murderous"), MURDEROUS), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.furious"), FURIOUS), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.irritated"), IRRITATED), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.composed"), COMPOSED), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.calm"), CALM), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.content"), CONTENT), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.satisfied"), SATISFIED), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.delirious"), DELIRIOUS), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.walkingonclouds"), WALKING_ON_CLOUDS), + new CBItem(TranslationFacility.tr("ls.team.teamspirit.paradiseonearth"), PARADISE_ON_EARTH) }; private TeamSpirit() { } @@ -38,6 +38,6 @@ public static String toString(int teamSpirit){ if(teamSpirit >= LIKE_THE_COLD_WAR && teamSpirit <= PARADISE_ON_EARTH) return ITEMS[teamSpirit].getText(); else - return HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr("Unbestimmt"); } } diff --git a/src/main/java/core/constants/player/PlayerAbility.kt b/src/main/java/core/constants/player/PlayerAbility.kt index f0e501826..38dd4a51a 100644 --- a/src/main/java/core/constants/player/PlayerAbility.kt +++ b/src/main/java/core/constants/player/PlayerAbility.kt @@ -1,7 +1,7 @@ package core.constants.player import core.datatype.CBItem -import core.model.HOVerwaltung +import core.model.TranslationFacility import core.model.UserParameter import core.util.Helper @@ -79,10 +79,9 @@ object PlayerAbility { @JvmStatic fun toString(ability: Int): String { return if (ability in NON_EXISTENT..DIVINE) { - HOVerwaltung.instance().getLanguageString(languageKeys[ability]) + TranslationFacility.tr(languageKeys[ability]) } else { - var value = HOVerwaltung.instance() - .getLanguageString(if (ability > DIVINE) languageKeys[DIVINE] else "Unbestimmt") + var value = TranslationFacility.tr(if (ability > DIVINE) languageKeys[DIVINE] else "Unbestimmt") if (ability > 20) value += "(+${ability - 20})" value } @@ -165,10 +164,10 @@ object PlayerAbility { private fun getName4Sublevel(sub: Int): String { return when (sub) { - 0 -> " (${HOVerwaltung.instance().getLanguageString("verylow")})" - 1 -> " (${HOVerwaltung.instance().getLanguageString("low")})" - 2 -> " (${HOVerwaltung.instance().getLanguageString("high")})" - 3 -> " (${HOVerwaltung.instance().getLanguageString("veryhigh")})" + 0 -> " (${TranslationFacility.tr("verylow")})" + 1 -> " (${TranslationFacility.tr("low")})" + 2 -> " (${TranslationFacility.tr("high")})" + 3 -> " (${TranslationFacility.tr("veryhigh")})" else -> "" } } diff --git a/src/main/java/core/constants/player/PlayerAggressiveness.java b/src/main/java/core/constants/player/PlayerAggressiveness.java index 5103973b3..ab845a36c 100644 --- a/src/main/java/core/constants/player/PlayerAggressiveness.java +++ b/src/main/java/core/constants/player/PlayerAggressiveness.java @@ -1,6 +1,6 @@ package core.constants.player; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; public class PlayerAggressiveness { private static final String[] languageKeys = { @@ -24,7 +24,7 @@ private PlayerAggressiveness() { public static String toString(Integer aggressiveness) { if (aggressiveness != null && aggressiveness >= TRANQUIL && aggressiveness <= UNSTABLE) - return HOVerwaltung.instance().getLanguageString(languageKeys[aggressiveness]); - return HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr(languageKeys[aggressiveness]); + return TranslationFacility.tr("Unbestimmt"); } } diff --git a/src/main/java/core/constants/player/PlayerAgreeability.java b/src/main/java/core/constants/player/PlayerAgreeability.java index 4e76c9d66..974c92a46 100644 --- a/src/main/java/core/constants/player/PlayerAgreeability.java +++ b/src/main/java/core/constants/player/PlayerAgreeability.java @@ -1,6 +1,6 @@ package core.constants.player; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; public final class PlayerAgreeability { private static final String[] languageKeys = { @@ -22,8 +22,8 @@ private PlayerAgreeability(){} public static String toString(Integer agreeability){ if(agreeability!=null && agreeability >= NASTY_FELLOW && agreeability <= BELOVED_TEAM_MEMBER) - return HOVerwaltung.instance().getLanguageString(languageKeys[agreeability]); - return HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr(languageKeys[agreeability]); + return TranslationFacility.tr("Unbestimmt"); } diff --git a/src/main/java/core/constants/player/PlayerHonesty.java b/src/main/java/core/constants/player/PlayerHonesty.java index 29057c5d0..a00eec04e 100644 --- a/src/main/java/core/constants/player/PlayerHonesty.java +++ b/src/main/java/core/constants/player/PlayerHonesty.java @@ -1,6 +1,6 @@ package core.constants.player; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; public final class PlayerHonesty { private static final String[] languageKeys = { @@ -22,8 +22,8 @@ private PlayerHonesty(){} public static String toString(Integer honesty){ if(honesty != null && honesty >= INFAMOUS && honesty <= SAINTLY) - return HOVerwaltung.instance().getLanguageString(languageKeys[honesty]); - return HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr(languageKeys[honesty]); + return TranslationFacility.tr("Unbestimmt"); } } diff --git a/src/main/java/core/constants/player/PlayerSkill.java b/src/main/java/core/constants/player/PlayerSkill.java index 75d726f1c..1101b9a19 100644 --- a/src/main/java/core/constants/player/PlayerSkill.java +++ b/src/main/java/core/constants/player/PlayerSkill.java @@ -1,6 +1,6 @@ package core.constants.player; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; public enum PlayerSkill { @@ -34,7 +34,7 @@ public String getLanguageString() { case KEEPER, DEFENDING, WINGER, PLAYMAKING, SCORING, PASSING, STAMINA, SETPIECES -> b.append("skill."); } b.append(super.toString().toLowerCase()); - return HOVerwaltung.instance().getLanguageString(b.toString()); + return TranslationFacility.tr(b.toString()); } public static PlayerSkill fromInteger(Integer i) { diff --git a/src/main/java/core/constants/player/PlayerSpeciality.java b/src/main/java/core/constants/player/PlayerSpeciality.java index b896dda34..0a687ed88 100644 --- a/src/main/java/core/constants/player/PlayerSpeciality.java +++ b/src/main/java/core/constants/player/PlayerSpeciality.java @@ -1,8 +1,9 @@ package core.constants.player; import core.datatype.CBItem; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.Weather; + import java.util.LinkedHashMap; public final class PlayerSpeciality { @@ -24,13 +25,13 @@ public final class PlayerSpeciality { public static final CBItem[] ITEMS = { new CBItem("", NO_SPECIALITY), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.speciality.technical"), TECHNICAL), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.speciality.quick"), QUICK), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.speciality.powerful"), POWERFUL), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.speciality.unpredictable"), UNPREDICTABLE), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.speciality.head"), HEAD), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.speciality.regainer"), REGAINER), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.speciality.support"), SUPPORT) + new CBItem(TranslationFacility.tr("ls.player.speciality.technical"), TECHNICAL), + new CBItem(TranslationFacility.tr("ls.player.speciality.quick"), QUICK), + new CBItem(TranslationFacility.tr("ls.player.speciality.powerful"), POWERFUL), + new CBItem(TranslationFacility.tr("ls.player.speciality.unpredictable"), UNPREDICTABLE), + new CBItem(TranslationFacility.tr("ls.player.speciality.head"), HEAD), + new CBItem(TranslationFacility.tr("ls.player.speciality.regainer"), REGAINER), + new CBItem(TranslationFacility.tr("ls.player.speciality.support"), SUPPORT) }; @@ -39,13 +40,13 @@ public final class PlayerSpeciality { static { ITEMS2 = new LinkedHashMap<>(); ITEMS2.put(NO_SPECIALITY, ""); - ITEMS2.put(TECHNICAL, HOVerwaltung.instance().getLanguageString("ls.player.speciality.technical")); - ITEMS2.put(QUICK, HOVerwaltung.instance().getLanguageString("ls.player.speciality.quick")); - ITEMS2.put(POWERFUL, HOVerwaltung.instance().getLanguageString("ls.player.speciality.powerful")); - ITEMS2.put(UNPREDICTABLE, HOVerwaltung.instance().getLanguageString("ls.player.speciality.unpredictable")); - ITEMS2.put(HEAD, HOVerwaltung.instance().getLanguageString("ls.player.speciality.head")); - ITEMS2.put(REGAINER, HOVerwaltung.instance().getLanguageString("ls.player.speciality.regainer")); - ITEMS2.put(SUPPORT, HOVerwaltung.instance().getLanguageString("ls.player.speciality.support")); + ITEMS2.put(TECHNICAL, TranslationFacility.tr("ls.player.speciality.technical")); + ITEMS2.put(QUICK, TranslationFacility.tr("ls.player.speciality.quick")); + ITEMS2.put(POWERFUL, TranslationFacility.tr("ls.player.speciality.powerful")); + ITEMS2.put(UNPREDICTABLE, TranslationFacility.tr("ls.player.speciality.unpredictable")); + ITEMS2.put(HEAD, TranslationFacility.tr("ls.player.speciality.head")); + ITEMS2.put(REGAINER, TranslationFacility.tr("ls.player.speciality.regainer")); + ITEMS2.put(SUPPORT, TranslationFacility.tr("ls.player.speciality.support")); } @@ -54,9 +55,9 @@ private PlayerSpeciality() { public static String toString(Integer speciality) { if ( speciality != null) { - return ITEMS2.getOrDefault(speciality, HOVerwaltung.instance().getLanguageString("Unbestimmt")); + return ITEMS2.getOrDefault(speciality, TranslationFacility.tr("Unbestimmt")); } - return HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr("Unbestimmt"); } diff --git a/src/main/java/core/db/MatchesOverviewQuery.java b/src/main/java/core/db/MatchesOverviewQuery.java index 54a5246c7..4c572dcd6 100644 --- a/src/main/java/core/db/MatchesOverviewQuery.java +++ b/src/main/java/core/db/MatchesOverviewQuery.java @@ -1,6 +1,7 @@ package core.db; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.*; import core.util.HOLogger; import module.matches.MatchLocation; @@ -175,8 +176,8 @@ private static StringBuilder getMatchLocationWhereClause(MatchLocation matchLoca static MatchesOverviewRow[] getMatchesOverviewValues(int matchtype, MatchLocation matchLocation){ ArrayList rows = new ArrayList<>(20); - rows.add(new MatchesOverviewRow(HOVerwaltung.instance().getLanguageString("AlleSpiele"), MatchesOverviewRow.TYPE_ALL)); - rows.add(new MatchesOverviewRow(HOVerwaltung.instance().getLanguageString("ls.team.formation"), MatchesOverviewRow.TYPE_TITLE)); + rows.add(new MatchesOverviewRow(TranslationFacility.tr("AlleSpiele"), MatchesOverviewRow.TYPE_ALL)); + rows.add(new MatchesOverviewRow(TranslationFacility.tr("ls.team.formation"), MatchesOverviewRow.TYPE_TITLE)); rows.add(new MatchesOverviewRow("5-5-0", MatchesOverviewRow.TYPE_SYSTEM)); rows.add(new MatchesOverviewRow("5-4-1", MatchesOverviewRow.TYPE_SYSTEM)); rows.add(new MatchesOverviewRow("5-3-2", MatchesOverviewRow.TYPE_SYSTEM)); @@ -187,7 +188,7 @@ static MatchesOverviewRow[] getMatchesOverviewValues(int matchtype, MatchLocatio rows.add(new MatchesOverviewRow("3-5-2", MatchesOverviewRow.TYPE_SYSTEM)); rows.add(new MatchesOverviewRow("3-4-3", MatchesOverviewRow.TYPE_SYSTEM)); rows.add(new MatchesOverviewRow("2-5-3", MatchesOverviewRow.TYPE_SYSTEM)); - rows.add(new MatchesOverviewRow(HOVerwaltung.instance().getLanguageString("ls.team.tactic"), MatchesOverviewRow.TYPE_TITLE)); + rows.add(new MatchesOverviewRow(TranslationFacility.tr("ls.team.tactic"), MatchesOverviewRow.TYPE_TITLE)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForTaktik(IMatchDetails.TAKTIK_NORMAL), MatchesOverviewRow.TYPE_TACTICS, IMatchDetails.TAKTIK_NORMAL)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForTaktik(IMatchDetails.TAKTIK_PRESSING), MatchesOverviewRow.TYPE_TACTICS, IMatchDetails.TAKTIK_PRESSING)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForTaktik(IMatchDetails.TAKTIK_KONTER), MatchesOverviewRow.TYPE_TACTICS, IMatchDetails.TAKTIK_KONTER)); @@ -195,11 +196,11 @@ static MatchesOverviewRow[] getMatchesOverviewValues(int matchtype, MatchLocatio rows.add(new MatchesOverviewRow(Matchdetails.getNameForTaktik(IMatchDetails.TAKTIK_WINGS), MatchesOverviewRow.TYPE_TACTICS, IMatchDetails.TAKTIK_WINGS)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForTaktik(IMatchDetails.TAKTIK_CREATIVE), MatchesOverviewRow.TYPE_TACTICS, IMatchDetails.TAKTIK_CREATIVE)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForTaktik(IMatchDetails.TAKTIK_LONGSHOTS), MatchesOverviewRow.TYPE_TACTICS, IMatchDetails.TAKTIK_LONGSHOTS)); - rows.add(new MatchesOverviewRow(HOVerwaltung.instance().getLanguageString("ls.team.teamattitude"),MatchesOverviewRow.TYPE_TITLE)); + rows.add(new MatchesOverviewRow(TranslationFacility.tr("ls.team.teamattitude"),MatchesOverviewRow.TYPE_TITLE)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForEinstellung(IMatchDetails.EINSTELLUNG_PIC), MatchesOverviewRow.TYPE_MOT, IMatchDetails.EINSTELLUNG_PIC)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForEinstellung(IMatchDetails.EINSTELLUNG_NORMAL), MatchesOverviewRow.TYPE_MOT, IMatchDetails.EINSTELLUNG_NORMAL)); rows.add(new MatchesOverviewRow(Matchdetails.getNameForEinstellung(IMatchDetails.EINSTELLUNG_MOTS), MatchesOverviewRow.TYPE_MOT, IMatchDetails.EINSTELLUNG_MOTS)); - rows.add(new MatchesOverviewRow(HOVerwaltung.instance().getLanguageString("ls.match.weather"), MatchesOverviewRow.TYPE_TITLE)); + rows.add(new MatchesOverviewRow(TranslationFacility.tr("ls.match.weather"), MatchesOverviewRow.TYPE_TITLE)); rows.add(new MatchesOverviewRow("IMatchDetails.WETTER_SONNE", MatchesOverviewRow.TYPE_WEATHER, Weather.SUNNY.getId())); rows.add(new MatchesOverviewRow("IMatchDetails.WETTER_WOLKIG", MatchesOverviewRow.TYPE_WEATHER, Weather.PARTIALLY_CLOUDY.getId())); rows.add(new MatchesOverviewRow("IMatchDetails.WETTER_BEWOELKT", MatchesOverviewRow.TYPE_WEATHER, Weather.OVERCAST.getId())); diff --git a/src/main/java/core/file/hrf/HRFImport.java b/src/main/java/core/file/hrf/HRFImport.java index ae4c737fd..86f695884 100644 --- a/src/main/java/core/file/hrf/HRFImport.java +++ b/src/main/java/core/file/hrf/HRFImport.java @@ -7,6 +7,7 @@ import core.gui.RefreshManager; import core.model.HOModel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.util.HODateTime; import core.util.HOLogger; @@ -108,7 +109,7 @@ private File[] getHRFFiles(Frame parent) { ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("hrf"); - filter.setDescription(HOVerwaltung.instance().getLanguageString("filetypedescription.hrf")); + filter.setDescription(TranslationFacility.tr("filetypedescription.hrf")); fileChooser.setFileFilter(filter); if (fileChooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { @@ -118,7 +119,7 @@ private File[] getHRFFiles(Frame parent) { } private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } /** diff --git a/src/main/java/core/file/xml/TeamSelectionDialog.java b/src/main/java/core/file/xml/TeamSelectionDialog.java index d03482530..13c3e1aa9 100644 --- a/src/main/java/core/file/xml/TeamSelectionDialog.java +++ b/src/main/java/core/file/xml/TeamSelectionDialog.java @@ -3,17 +3,12 @@ import core.datatype.CBItem; import core.gui.HOMainFrame; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; -import core.model.match.IMatchDetails; +import core.model.TranslationFacility; +import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -import java.util.Objects; - -import javax.swing.*; public class TeamSelectionDialog extends JDialog{ @@ -30,7 +25,7 @@ public class TeamSelectionDialog extends JDialog{ private List infos; public TeamSelectionDialog(HOMainFrame mainFrame, List infos) { - super(mainFrame, HOVerwaltung.instance().getLanguageString("teamSelect.header"), true); + super(mainFrame, TranslationFacility.tr("teamSelect.header"), true); this.infos = infos; setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); init(mainFrame); @@ -67,17 +62,17 @@ private void init(HOMainFrame mainFrame) { gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); - selectedPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("teamSelect.teamName")), gbc); + selectedPanel.add(new JLabel(TranslationFacility.tr("teamSelect.teamName")), gbc); gbc.gridx = 1; selectedPanel.add(teamName, gbc); gbc.gridx=0; gbc.gridy++; - selectedPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("teamSelect.series")),gbc); + selectedPanel.add(new JLabel(TranslationFacility.tr("teamSelect.series")),gbc); gbc.gridx=1; selectedPanel.add(teamSeries, gbc); gbc.gridx=0; gbc.gridy++; - selectedPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("teamSelect.country")), gbc); + selectedPanel.add(new JLabel(TranslationFacility.tr("teamSelect.country")), gbc); gbc.gridx=1; selectedPanel.add(teamCountry, gbc); initTeam(0); @@ -85,9 +80,9 @@ private void init(HOMainFrame mainFrame) { mainPanel.add(selectedPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); - m_jbOK.setText(HOVerwaltung.instance().getLanguageString("ls.button.ok")); + m_jbOK.setText(TranslationFacility.tr("ls.button.ok")); buttonPanel.add(m_jbOK); - m_jbCancel.setText(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + m_jbCancel.setText(TranslationFacility.tr("ls.button.cancel")); buttonPanel.add(m_jbCancel); mainPanel.add(buttonPanel, BorderLayout.SOUTH); this.getContentPane().add(mainPanel); @@ -111,9 +106,9 @@ private void addListeners() { setVisible(false); } else { - JOptionPane.showMessageDialog(null, HOVerwaltung.instance() - .getLanguageString("teamSelect.doChoose"), HOVerwaltung - .instance().getLanguageString("teamSelect.doChooseHeader"), + JOptionPane.showMessageDialog(null, + TranslationFacility.tr("teamSelect.doChoose"), + TranslationFacility.tr("teamSelect.doChooseHeader"), JOptionPane.INFORMATION_MESSAGE); } }); diff --git a/src/main/java/core/file/xml/XMLCHPPPreParser.java b/src/main/java/core/file/xml/XMLCHPPPreParser.java index 649165d28..ef37d8cb7 100644 --- a/src/main/java/core/file/xml/XMLCHPPPreParser.java +++ b/src/main/java/core/file/xml/XMLCHPPPreParser.java @@ -1,9 +1,7 @@ package core.file.xml; - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HOLogger; - import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -15,7 +13,6 @@ private XMLCHPPPreParser() { public static String getError(String xmlIn) { String sReturnError = ""; - final HOVerwaltung hov = HOVerwaltung.instance(); if(!xmlIn.isEmpty()) { Document doc = XMLManager.parseString(xmlIn); if (doc != null) { @@ -24,7 +21,7 @@ public static String getError(String xmlIn) { try { // See if an error is found if (root.getElementsByTagName("ErrorCode").getLength() > 0) { - sReturnError = "CHPP " + hov.getLanguageString("Fehler"); + sReturnError = "CHPP " + TranslationFacility.tr("Fehler"); ele = (Element) root.getElementsByTagName("ErrorCode").item(0); if (ele != null) { sReturnError += " - " + XMLManager.getFirstChildNodeValue(ele); @@ -42,10 +39,10 @@ public static String getError(String xmlIn) { } } else { - sReturnError = hov.getLanguageString("XML_PARSE_ERRROR"); + sReturnError = TranslationFacility.tr("XML_PARSE_ERRROR"); } } else { - sReturnError = hov.getLanguageString("NO_HRF_ERROR"); + sReturnError = TranslationFacility.tr("NO_HRF_ERROR"); } return sReturnError; } diff --git a/src/main/java/core/file/xml/XMLMatchOrderParserNew.java b/src/main/java/core/file/xml/XMLMatchOrderParserNew.java index 2da38d2bf..bac51ebdd 100644 --- a/src/main/java/core/file/xml/XMLMatchOrderParserNew.java +++ b/src/main/java/core/file/xml/XMLMatchOrderParserNew.java @@ -1,6 +1,6 @@ package core.file.xml; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.MatchRoleID; import module.lineup.substitution.model.GoalDiffCriteria; @@ -83,7 +83,7 @@ private MatchRoleID getPosition(Node playerNode) { * @param args */ public static void main(String[] args) { - HOVerwaltung.instance().setTranslator(UserParameter.instance().sprachDatei); + TranslationFacility.setLanguage(UserParameter.instance().sprachDatei); File file = new File( "/home/chr/tmp/matchorders_version_1_8_matchID_353869167_isYouth_false.xml"); new XMLMatchOrderParserNew(XMLManager.parseFile(file)); diff --git a/src/main/java/core/gui/Credits.java b/src/main/java/core/gui/Credits.java index 0764587f6..1ffdae1aa 100644 --- a/src/main/java/core/gui/Credits.java +++ b/src/main/java/core/gui/Credits.java @@ -5,7 +5,7 @@ import core.gui.comp.HyperLinkLabel; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.BrowserLauncher; import core.util.HOLogger; @@ -28,7 +28,7 @@ public static void showCredits(Component parent) { creditsPanel.add(new JLabel(" "), gbc); gbc.gridy = 2; - String[] text = HOVerwaltung.instance().getLanguageString("window.about.text").split("\\n"); + String[] text = TranslationFacility.tr("window.about.text").split("\\n"); for (String line : text) { creditsPanel.add(new JLabel(line), gbc); gbc.gridy++; @@ -58,21 +58,21 @@ public static void showCredits(Component parent) { gbc.gridy = 4; gbc.gridx = 0; - hoPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("ls.about.database.folder") + ": "), gbc); + hoPanel.add(new JLabel(TranslationFacility.tr("ls.about.database.folder") + ": "), gbc); gbc.gridx = 1; hoPanel.add(new HyperLinkLabel(new File(UserManager.instance().getDbParentFolder() + "\\" + UserManager.instance().getCurrentUser().getDbName()).toURI().toString()), gbc); gbc.gridy++; gbc.gridx = 0; - hoPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("ls.about.logs.folder") + ": "), gbc); + hoPanel.add(new JLabel(TranslationFacility.tr("ls.about.logs.folder") + ": "), gbc); gbc.gridx = 1; hoPanel.add(new HyperLinkLabel(new File(HOLogger.getLogsFolderName()).toURI().toString()), gbc); creditsPanel.add(hoPanel, gbc); - Object[] options1 = {HOVerwaltung.instance().getLanguageString("window.about.licence"), HOVerwaltung.instance().getLanguageString("ls.button.ok")}; + Object[] options1 = {TranslationFacility.tr("window.about.licence"), TranslationFacility.tr("ls.button.ok")}; - int result = JOptionPane.showOptionDialog(parent, creditsPanel, HOVerwaltung.instance().getLanguageString("window.about.title"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options1, null); + int result = JOptionPane.showOptionDialog(parent, creditsPanel, TranslationFacility.tr("window.about.title"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options1, null); if (result == JOptionPane.YES_OPTION) { try { BrowserLauncher.openURL("https://raw.githubusercontent.com/ho-dev/HattrickOrganizer/master/LICENSE"); diff --git a/src/main/java/core/gui/HOMainFrame.java b/src/main/java/core/gui/HOMainFrame.java index 87abca84c..89672547d 100644 --- a/src/main/java/core/gui/HOMainFrame.java +++ b/src/main/java/core/gui/HOMainFrame.java @@ -10,6 +10,7 @@ import core.gui.theme.ThemeManager; import core.model.FormulaFactors; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.match.Weather; import core.model.player.Player; @@ -53,24 +54,24 @@ public final class HOMainFrame extends JFrame implements Refreshable, ActionList private InfoPanel m_jpInfoPanel; private final JMenuBar m_jmMenuBar = new JMenuBar(); // Top level Menu - private final JMenu m_jmFile = new JMenu(HOVerwaltung.instance().getLanguageString("ls.menu.file")); //File - private final JMenu m_jmFunctions = new JMenu(HOVerwaltung.instance().getLanguageString("ls.menu.functions")); //Functions - private final JMenu m_jmModules = new JMenu(HOVerwaltung.instance().getLanguageString("ls.menu.modules")); //Modules - private final JMenu m_jmHelp = new JMenu(HOVerwaltung.instance().getLanguageString("ls.menu.help")); //Help + private final JMenu m_jmFile = new JMenu(TranslationFacility.tr("ls.menu.file")); //File + private final JMenu m_jmFunctions = new JMenu(TranslationFacility.tr("ls.menu.functions")); //Functions + private final JMenu m_jmModules = new JMenu(TranslationFacility.tr("ls.menu.modules")); //Modules + private final JMenu m_jmHelp = new JMenu(TranslationFacility.tr("ls.menu.help")); //Help // Sub Level Menus // ----------- File - private final JMenuItem m_jmDownloadItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.download")); - private final JMenuItem m_jmImportItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.importfromhrf")); - private final JMenuItem m_jmSubksillFull = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.subskillrecalculation")); - private final JMenuItem m_jmSubksillRecalc7 = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.subskillrecalculation7weeks")); - private final JMenuItem m_jmOptionen = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.preferences")); - //private final JMenu databaseMenu = new JMenu(HOVerwaltung.instance().getLanguageString("ls.menu.file.database")); - private final JMenuItem userAdministrationOptionsMenu = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.database.dbuseradministration")); - private final JMenuItem m_jmiDbCleanupTool = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.database.databasecleanup")); - private final JMenuItem m_jmFullScreenItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.fullscreen")); - private final JMenuItem m_jmBeendenItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.quit")); + private final JMenuItem m_jmDownloadItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.download")); + private final JMenuItem m_jmImportItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.importfromhrf")); + private final JMenuItem m_jmSubksillFull = new JMenuItem(TranslationFacility.tr("ls.menu.file.subskillrecalculation")); + private final JMenuItem m_jmSubksillRecalc7 = new JMenuItem(TranslationFacility.tr("ls.menu.file.subskillrecalculation7weeks")); + private final JMenuItem m_jmOptionen = new JMenuItem(TranslationFacility.tr("ls.menu.file.preferences")); + //private final JMenu databaseMenu = new JMenu(TranslationFacility.tr("ls.menu.file.database")); + private final JMenuItem userAdministrationOptionsMenu = new JMenuItem(TranslationFacility.tr("ls.menu.file.database.dbuseradministration")); + private final JMenuItem m_jmiDbCleanupTool = new JMenuItem(TranslationFacility.tr("ls.menu.file.database.databasecleanup")); + private final JMenuItem m_jmFullScreenItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.fullscreen")); + private final JMenuItem m_jmBeendenItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.quit")); // ----------- Functions @@ -78,12 +79,12 @@ public final class HOMainFrame extends JFrame implements Refreshable, ActionList // ----------- Modules // ----------- Help - private final JMenuItem m_jmHomepageItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.help.projecthomepage")); - private final JMenuItem m_jmWikiItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.help.help")); - private final JMenuItem m_jmReportAbug = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.help.reportabug")); - private final JMenuItem m_jmAboutAbout = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.help.about")); - private final JMenuItem m_jmCheckUpdate = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.file.update.ho")); - private final JMenuItem m_jmChangelog = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.help.changelog")); + private final JMenuItem m_jmHomepageItem = new JMenuItem(TranslationFacility.tr("ls.menu.help.projecthomepage")); + private final JMenuItem m_jmWikiItem = new JMenuItem(TranslationFacility.tr("ls.menu.help.help")); + private final JMenuItem m_jmReportAbug = new JMenuItem(TranslationFacility.tr("ls.menu.help.reportabug")); + private final JMenuItem m_jmAboutAbout = new JMenuItem(TranslationFacility.tr("ls.menu.help.about")); + private final JMenuItem m_jmCheckUpdate = new JMenuItem(TranslationFacility.tr("ls.menu.file.update.ho")); + private final JMenuItem m_jmChangelog = new JMenuItem(TranslationFacility.tr("ls.menu.help.changelog")); public static AtomicBoolean launching = new AtomicBoolean(false); @@ -163,7 +164,7 @@ private void setFrameTitle() { String frameTitle = StringUtils.isEmpty(teamName) ? "" : teamName; if (!HO.isRelease()) { - frameTitle += " (" + HOVerwaltung.instance().getLanguageString("ls.java.version") + ": " + System.getProperty("java.version") + ")"; + frameTitle += " (" + TranslationFacility.tr("ls.java.version") + ": " + System.getProperty("java.version") + ")"; } setTitle(frameTitle); @@ -249,7 +250,7 @@ private InfoPanel getInfoPanel(){ } return m_jpInfoPanel; } - public void setWaitInformation(){setInformation(HOVerwaltung.instance().getLanguageString("BitteWarten"), 1);} + public void setWaitInformation(){setInformation(TranslationFacility.tr("BitteWarten"), 1);} public void resetInformation(){setInformation("",-100);} public void setInformation( String information) { setInformation(information,-100);} public void setInformationCompleted() { setInformation(Helper.getTranslation("ls.update_status.complete"), -100);} @@ -316,7 +317,7 @@ public void actionPerformed(ActionEvent actionEvent) { } else if (source.equals(m_jmSubksillFull)) { // recalc training (8 seasons = 128) var from = HODateTime.now().minus(128*7, ChronoUnit.DAYS); if (JOptionPane.showConfirmDialog(this, - HOVerwaltung.instance().getLanguageString("Subskill.Recalc.Full")+"\n"+HOVerwaltung.instance().getLanguageString("subskill.Recalc.Start"), + TranslationFacility.tr("Subskill.Recalc.Full")+"\n"+ TranslationFacility.tr("subskill.Recalc.Start"), Helper.getTranslation("ls.menu.file.subskillrecalculation"), JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) { HOVerwaltung.instance().recalcSubskills(true, from.toDbTimestamp()); } @@ -324,10 +325,10 @@ public void actionPerformed(ActionEvent actionEvent) { var nextTraining = HOVerwaltung.instance().getModel().getXtraDaten().getNextTrainingDate(); var from = nextTraining.minus(7*7, ChronoUnit.DAYS); if (JOptionPane.showConfirmDialog(this, - HOVerwaltung.instance().getLanguageString("subskill.Recalc.7w")+"\n"+ - HOVerwaltung.instance().getLanguageString("subskill.Recalc.1stTrainingweek") + ": " + + TranslationFacility.tr("subskill.Recalc.7w")+"\n"+ + TranslationFacility.tr("subskill.Recalc.1stTrainingweek") + ": " + from.toLocaleHTWeek().toString() + "\n" + - HOVerwaltung.instance().getLanguageString("subskill.Recalc.Start"), + TranslationFacility.tr("subskill.Recalc.Start"), Helper.getTranslation("ls.menu.file.subskillrecalculation7weeks"), JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) { HOVerwaltung.instance().recalcSubskills(true, from.toDbTimestamp()); } @@ -359,8 +360,8 @@ public void actionPerformed(ActionEvent actionEvent) { Desktop.getDesktop().browse(logFile); } catch (Exception e) { JOptionPane.showMessageDialog(this, - HOVerwaltung.instance().getLanguageString("Changelog.error"), - HOVerwaltung.instance().getLanguageString("Fehler"), + TranslationFacility.tr("Changelog.error"), + TranslationFacility.tr("Fehler"), JOptionPane.ERROR_MESSAGE ); e.printStackTrace(); diff --git a/src/main/java/core/gui/LookAndFeelDialog.java b/src/main/java/core/gui/LookAndFeelDialog.java index ff06f6702..030a5f75a 100644 --- a/src/main/java/core/gui/LookAndFeelDialog.java +++ b/src/main/java/core/gui/LookAndFeelDialog.java @@ -2,19 +2,20 @@ import core.gui.comp.icon.ColorIcon; +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableCellRenderer; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; import java.util.stream.Collectors; -import javax.swing.*; -import javax.swing.table.*; - public class LookAndFeelDialog extends JDialog { private static final long serialVersionUID = -5492754898221009950L; public LookAndFeelDialog() { + super(HOMainFrame.instance(), "Look and Feel"); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); initComponents(); pack(); diff --git a/src/main/java/core/gui/comp/tabbedPane/TabCloseIcon.java b/src/main/java/core/gui/comp/tabbedPane/TabCloseIcon.java index 792f0228f..d9cdc5854 100644 --- a/src/main/java/core/gui/comp/tabbedPane/TabCloseIcon.java +++ b/src/main/java/core/gui/comp/tabbedPane/TabCloseIcon.java @@ -2,18 +2,13 @@ import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; +import javax.swing.*; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import javax.swing.Icon; -import javax.swing.JOptionPane; -import javax.swing.JTabbedPane; - final class TabCloseIcon implements Icon { private final Icon mIcon = ThemeManager.getIcon(HOIconName.TABBEDPANE_CLOSE); private transient Rectangle mPosition = null; @@ -63,8 +58,8 @@ public int getIconHeight() { } private void closeTab() { - String title = HOVerwaltung.instance().getLanguageString("confirmation.title"); - String message = HOVerwaltung.instance().getLanguageString("tab.close.confirm.msg"); + String title = TranslationFacility.tr("confirmation.title"); + String message = TranslationFacility.tr("tab.close.confirm.msg"); if (JOptionPane.showConfirmDialog(mTabbedPane, message, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { int index = mTabbedPane.getSelectedIndex(); mTabbedPane.remove(index); diff --git a/src/main/java/core/gui/comp/table/HOTableModel.java b/src/main/java/core/gui/comp/table/HOTableModel.java index 6f83ffe99..33faba312 100644 --- a/src/main/java/core/gui/comp/table/HOTableModel.java +++ b/src/main/java/core/gui/comp/table/HOTableModel.java @@ -2,7 +2,8 @@ import core.db.DBManager; import core.gui.model.UserColumnController; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; + import javax.swing.*; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; @@ -75,7 +76,7 @@ public final int getId() { */ @Override public String toString() { - String tmp = HOVerwaltung.instance().getLanguageString(name); + String tmp = TranslationFacility.tr(name); return (instance == 0) ? tmp : (tmp + instance); } diff --git a/src/main/java/core/gui/comp/table/UserColumn.java b/src/main/java/core/gui/comp/table/UserColumn.java index 96b5bc252..a317db150 100644 --- a/src/main/java/core/gui/comp/table/UserColumn.java +++ b/src/main/java/core/gui/comp/table/UserColumn.java @@ -1,6 +1,7 @@ package core.gui.comp.table; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; + import javax.swing.table.TableColumn; public abstract class UserColumn { @@ -47,7 +48,7 @@ public UserColumn(){} * @return String */ public final String getColumnName() { - return (columnName.equals("TSI") || columnName.equals(" ")) ? columnName: HOVerwaltung.instance().getLanguageString(columnName); + return (columnName.equals("TSI") || columnName.equals(" ")) ? columnName: TranslationFacility.tr(columnName); } /** @@ -67,7 +68,7 @@ public void setId(int v){ * @return String */ public final String getTooltip() { - return (columnName.equals("TSI") || tooltip.equals(" "))?tooltip:HOVerwaltung.instance().getLanguageString(tooltip); + return (columnName.equals("TSI") || tooltip.equals(" "))?tooltip: TranslationFacility.tr(tooltip); } /** diff --git a/src/main/java/core/gui/model/ArenaStatistikTableModel.java b/src/main/java/core/gui/model/ArenaStatistikTableModel.java index 81e5ada4e..0eb848456 100644 --- a/src/main/java/core/gui/model/ArenaStatistikTableModel.java +++ b/src/main/java/core/gui/model/ArenaStatistikTableModel.java @@ -5,19 +5,17 @@ import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchKurzInfo; import core.model.misc.Economy; import core.util.HOLogger; import core.util.Helper; import core.util.StringUtils; -import java.awt.Color; -import java.text.DateFormat; -import java.time.Duration; - -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.table.AbstractTableModel; +import java.awt.*; +import java.time.Duration; public class ArenaStatistikTableModel extends AbstractTableModel { //~ Static fields/initializers ----------------------------------------------------------------- @@ -28,81 +26,81 @@ public class ArenaStatistikTableModel extends AbstractTableModel { //~ Instance fields ---------------------------------------------------------------------------- public String[] m_sToolTipStrings = { - HOVerwaltung.instance().getLanguageString("Datum"), + TranslationFacility.tr("Datum"), // Spielart - HOVerwaltung.instance().getLanguageString("Spielart"), + TranslationFacility.tr("Spielart"), // Gast - HOVerwaltung.instance().getLanguageString("Gast"), - HOVerwaltung.instance().getLanguageString("ls.match.result"), - HOVerwaltung.instance().getLanguageString("ls.match.weather"), - HOVerwaltung.instance().getLanguageString("ls.match.id"), - HOVerwaltung.instance().getLanguageString("Aktuell"), // Stadiongroesse - HOVerwaltung.instance().getLanguageString("Zuschauer"), // Zuschauer + TranslationFacility.tr("Gast"), + TranslationFacility.tr("ls.match.result"), + TranslationFacility.tr("ls.match.weather"), + TranslationFacility.tr("ls.match.id"), + TranslationFacility.tr("Aktuell"), // Stadiongroesse + TranslationFacility.tr("Zuschauer"), // Zuschauer "%", // Auslastung - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.total"), // Income Total + TranslationFacility.tr("ls.club.arena.income.total"), // Income Total - HOVerwaltung.instance().getLanguageString("ls.club.arena.terraces"), + TranslationFacility.tr("ls.club.arena.terraces"), "%", // Percentage of crowd on the terraces - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.terraces"), // Income Terraces + TranslationFacility.tr("ls.club.arena.income.terraces"), // Income Terraces - HOVerwaltung.instance().getLanguageString("ls.club.arena.basicseating"), + TranslationFacility.tr("ls.club.arena.basicseating"), "%", // Percentage of crowd in the basic seats - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.basicseating"), // Income Basic + TranslationFacility.tr("ls.club.arena.income.basicseating"), // Income Basic - HOVerwaltung.instance().getLanguageString("ls.club.arena.seatsunderroof"), + TranslationFacility.tr("ls.club.arena.seatsunderroof"), "%", // Percentage of crowd under the roof - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof + TranslationFacility.tr("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof - HOVerwaltung.instance().getLanguageString("ls.club.arena.seatsinvipboxes"), + TranslationFacility.tr("ls.club.arena.seatsinvipboxes"), "%", // Percentage of crowd in the VIP seats - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes - - HOVerwaltung.instance().getLanguageString("Fans"), // Fananzahl - HOVerwaltung.instance().getLanguageString("Fans") + " / " - + HOVerwaltung.instance().getLanguageString("Wochen"), - HOVerwaltung.instance().getLanguageString("Zuschauer") + " / " - + HOVerwaltung.instance().getLanguageString("Fans"), - HOVerwaltung.instance().getLanguageString("Fans"), // Stimmung - HOVerwaltung.instance().getLanguageString("Platzierung") // LigaPlatz + TranslationFacility.tr("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes + + TranslationFacility.tr("Fans"), // Fananzahl + TranslationFacility.tr("Fans") + " / " + + TranslationFacility.tr("Wochen"), + TranslationFacility.tr("Zuschauer") + " / " + + TranslationFacility.tr("Fans"), + TranslationFacility.tr("Fans"), // Stimmung + TranslationFacility.tr("Platzierung") // LigaPlatz }; protected Object[][] m_clData; protected String[] m_sColumnNames = { - HOVerwaltung.instance().getLanguageString("Datum"), + TranslationFacility.tr("Datum"), "", // Spielart - HOVerwaltung.instance().getLanguageString("Gast"), // Gast - HOVerwaltung.instance().getLanguageString("ls.match.result"), - HOVerwaltung.instance().getLanguageString("ls.match.weather"), - HOVerwaltung.instance().getLanguageString("ls.match.id"), - HOVerwaltung.instance().getLanguageString("Aktuell"), // Stadiongroesse - HOVerwaltung.instance().getLanguageString("Zuschauer"), // Zuschauer + TranslationFacility.tr("Gast"), // Gast + TranslationFacility.tr("ls.match.result"), + TranslationFacility.tr("ls.match.weather"), + TranslationFacility.tr("ls.match.id"), + TranslationFacility.tr("Aktuell"), // Stadiongroesse + TranslationFacility.tr("Zuschauer"), // Zuschauer "%", // Auslastung - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.total"), // Income Total + TranslationFacility.tr("ls.club.arena.income.total"), // Income Total - HOVerwaltung.instance().getLanguageString("ls.club.arena.terraces"), + TranslationFacility.tr("ls.club.arena.terraces"), "%", // Percentage of crowd on the terraces - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.terraces"), // Income Terraces + TranslationFacility.tr("ls.club.arena.income.terraces"), // Income Terraces - HOVerwaltung.instance().getLanguageString("ls.club.arena.basicseating"), + TranslationFacility.tr("ls.club.arena.basicseating"), "%", // Percentage of crowd in the basic seats - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.basicseating"), // Income Basic + TranslationFacility.tr("ls.club.arena.income.basicseating"), // Income Basic - HOVerwaltung.instance().getLanguageString("ls.club.arena.seatsunderroof"), + TranslationFacility.tr("ls.club.arena.seatsunderroof"), "%", // Percentage of crowd under the roof - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof + TranslationFacility.tr("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof - HOVerwaltung.instance().getLanguageString("ls.club.arena.seatsinvipboxes"), + TranslationFacility.tr("ls.club.arena.seatsinvipboxes"), "%", // Percentage of crowd in the VIP seats - HOVerwaltung.instance().getLanguageString("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes - - HOVerwaltung.instance().getLanguageString("Fans"), // Fananzahl - HOVerwaltung.instance().getLanguageString("Fans") + " / " - + HOVerwaltung.instance().getLanguageString("Wochen"), - HOVerwaltung.instance().getLanguageString("Zuschauer") + " / " - + HOVerwaltung.instance().getLanguageString("Fans"), - HOVerwaltung.instance().getLanguageString("Fans"), // Stimmung - HOVerwaltung.instance().getLanguageString("Platzierung") // LigaPlatz + TranslationFacility.tr("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes + + TranslationFacility.tr("Fans"), // Fananzahl + TranslationFacility.tr("Fans") + " / " + + TranslationFacility.tr("Wochen"), + TranslationFacility.tr("Zuschauer") + " / " + + TranslationFacility.tr("Fans"), + TranslationFacility.tr("Fans"), // Stimmung + TranslationFacility.tr("Platzierung") // LigaPlatz }; private ArenaStatistikModel[] m_clMatches; private int m_iMaxArenaGroesse; diff --git a/src/main/java/core/gui/model/SpielerPositionTableModel.java b/src/main/java/core/gui/model/SpielerPositionTableModel.java index cfc46d831..c288018b8 100644 --- a/src/main/java/core/gui/model/SpielerPositionTableModel.java +++ b/src/main/java/core/gui/model/SpielerPositionTableModel.java @@ -3,13 +3,12 @@ import core.gui.comp.entry.ColorLabelEntry; import core.gui.comp.entry.RatingTableEntry; import core.gui.theme.ImageUtilities; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.MatchRoleID; -import java.util.Vector; - -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.table.AbstractTableModel; +import java.util.Vector; public class SpielerPositionTableModel extends AbstractTableModel { //~ Instance fields ---------------------------------------------------------------------------- @@ -17,31 +16,31 @@ public class SpielerPositionTableModel extends AbstractTableModel { private static final long serialVersionUID = -4407511039452889638L; public String[] m_sToolTipStrings = { - HOVerwaltung.instance().getLanguageString("Position"), + TranslationFacility.tr("Position"), //Maximal - HOVerwaltung.instance().getLanguageString("Maximal"), + TranslationFacility.tr("Maximal"), //Minimal - HOVerwaltung.instance().getLanguageString("Minimal"), + TranslationFacility.tr("Minimal"), //Durchschnitt - HOVerwaltung.instance().getLanguageString("Durchschnitt"), + TranslationFacility.tr("Durchschnitt"), }; protected Object[][] m_clData; protected String[] m_sColumnNames = { - HOVerwaltung.instance().getLanguageString("Position"), + TranslationFacility.tr("Position"), //Maximal - HOVerwaltung.instance().getLanguageString("Maximal"), + TranslationFacility.tr("Maximal"), //Minimal - HOVerwaltung.instance().getLanguageString("Minimal"), + TranslationFacility.tr("Minimal"), //Durchschnitt - HOVerwaltung.instance().getLanguageString("Durchschnitt"), + TranslationFacility.tr("Durchschnitt"), }; private Vector m_playersEvaluation; diff --git a/src/main/java/core/gui/theme/HOColorName.java b/src/main/java/core/gui/theme/HOColorName.java index a04cf0925..7e964d574 100644 --- a/src/main/java/core/gui/theme/HOColorName.java +++ b/src/main/java/core/gui/theme/HOColorName.java @@ -1,6 +1,7 @@ package core.gui.theme; import core.model.HOVerwaltung; +import core.model.TranslationFacility; /** * Constants for Colors used in HO. @@ -184,6 +185,6 @@ public enum HOColorName { @Override public String toString(){ - return HOVerwaltung.instance().getLanguageString("ls.color." + super.toString().toLowerCase()); + return TranslationFacility.tr("ls.color." + super.toString().toLowerCase()); } } diff --git a/src/main/java/core/model/HOVerwaltung.java b/src/main/java/core/model/HOVerwaltung.java index 895c86e4f..8d3ba7b22 100644 --- a/src/main/java/core/model/HOVerwaltung.java +++ b/src/main/java/core/model/HOVerwaltung.java @@ -1,7 +1,6 @@ package core.model; import core.db.DBManager; -import core.file.FileLoader; import core.file.hrf.HRF; import core.gui.HOMainFrame; import core.gui.RefreshManager; @@ -10,7 +9,6 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -import java.io.InputStream; import java.sql.Timestamp; import java.time.temporal.ChronoUnit; import java.util.Date; @@ -26,8 +24,6 @@ public class HOVerwaltung { /** das Model */ protected HOModel m_clHoModel; - private Translator translator = null; - public static boolean isNewModel(HOModel homodel) { return (homodel != null && ((instance().getModel() == null) || (homodel.getBasics().getDatum().isAfter(instance().getModel().getBasics().getDatum())))); @@ -90,9 +86,13 @@ public void setResource(String pfad) { setTranslator(pfad); } + /** + * @deprecated Provided for compatibility. Please use {@link TranslationFacility#setLanguage(String)} instead. + */ + @Deprecated(since = "9.0", forRemoval = true) public void setTranslator(String language) { try { - translator = Translator.load(language); + TranslationFacility.setTranslator(Translator.load(language)); } catch (RuntimeException e) { HOLogger.instance().log(getClass(), e); } @@ -103,7 +103,7 @@ public void setTranslator(String language) { */ @Deprecated(since = "9.0", forRemoval = true) public ResourceBundle getResource() { - return Optional.ofNullable(translator).map(Translator::getResourceBundle).orElse(null); + return Optional.ofNullable(TranslationFacility.getTranslator()).map(Translator::getResourceBundle).orElse(null); } /** @@ -197,20 +197,25 @@ protected HOModel loadModel(int id) { /** * Returns the String connected to the active language file or connected to * the english language file. Returns !key! if the key can not be found. - * + * + * @deprecated Provided for compatibility. Please use {@link TranslationFacility#tr(String)} instead. + * * @param key * Key to be searched in language files * * @return String connected to the key or !key! if nothing can be found in * language files */ + @Deprecated(since = "9.0", forRemoval = true) public String getLanguageString(String key) { - return translator.translate(key); + return TranslationFacility.tr(key); } /** * Gets a parameterized message for the current language. - * + * + * @deprecated Provided for compatibility. Please use {@link TranslationFacility#tr(String, Object...)} instead. + * * @param key * the key for the message in the language file. * @param values @@ -218,8 +223,9 @@ public String getLanguageString(String key) { * @return the message for the specified key where the placeholders are * replaced by the given value(s). */ + @Deprecated(since = "9.0", forRemoval = true) public String getLanguageString(String key, Object... values) { - return translator.translate(key, values); + return TranslationFacility.tr(key, values); } /** @@ -242,14 +248,18 @@ public static void checkLanguageFile(String languageFilename) { } /** - * @deprecated Provided for compatibility. Please use {@link #clearTranslator()} instead. + * @deprecated Provided for compatibility. Will be removed without substitution! */ @Deprecated(since = "9.0", forRemoval = true) public void clearLanguageBundle() { clearTranslator(); } + /** + * @deprecated Provided for compatibility. Will be removed without substitution! + */ + @Deprecated(since = "9.0", forRemoval = true) public void clearTranslator() { - translator = null; + TranslationFacility.setTranslator(null); } } diff --git a/src/main/java/core/model/StaffMember.java b/src/main/java/core/model/StaffMember.java index ffaf0c84b..ebcc03b38 100644 --- a/src/main/java/core/model/StaffMember.java +++ b/src/main/java/core/model/StaffMember.java @@ -61,7 +61,7 @@ public int compareTo(StaffMember other) { @Override public String toString() { return getStaffType().getName() + " - " + getName() + - " - " + HOVerwaltung.instance().getLanguageString("ls.club.staff.level") + + " - " + TranslationFacility.tr("ls.club.staff.level") + ": " + getLevel(); } diff --git a/src/main/java/core/model/StaffType.java b/src/main/java/core/model/StaffType.java index fa2969db0..7a5d35658 100644 --- a/src/main/java/core/model/StaffType.java +++ b/src/main/java/core/model/StaffType.java @@ -34,25 +34,25 @@ public static StaffType getById(int id) { public String getName() { switch (this) { case ASSISTANTTRAINER: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.assistantcoach"); + return TranslationFacility.tr("ls.club.staff.assistantcoach"); case MEDIC: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.medic"); + return TranslationFacility.tr("ls.club.staff.medic"); case SPOKESPERSON: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.spokesperson"); + return TranslationFacility.tr("ls.club.staff.spokesperson"); case SPORTPSYCHOLOGIST: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.sportspsychologist"); + return TranslationFacility.tr("ls.club.staff.sportspsychologist"); case FORMCOACH: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.formcoach"); + return TranslationFacility.tr("ls.club.staff.formcoach"); case FINANCIALDIRECTOR: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.financialdirector"); + return TranslationFacility.tr("ls.club.staff.financialdirector"); case TACTICALASSISTANT: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.tacticalassistant"); + return TranslationFacility.tr("ls.club.staff.tacticalassistant"); //Error? default: diff --git a/src/main/java/core/model/TranslationFacility.java b/src/main/java/core/model/TranslationFacility.java new file mode 100644 index 000000000..8271132ff --- /dev/null +++ b/src/main/java/core/model/TranslationFacility.java @@ -0,0 +1,37 @@ +package core.model; + +import static java.util.Objects.requireNonNullElseGet; + +public class TranslationFacility { + + private static final String INITIAL_TRANSLATOR = Translator.LANGUAGE_NO_TRANSLATION; + + private static Translator translator; + static { + translator = Translator.load(INITIAL_TRANSLATOR); + } + + private TranslationFacility() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } + + public static Translator getTranslator() { + return translator; + } + + public static void setLanguage(String language) { + setTranslator(Translator.load(language)); + } + + public static void setTranslator(Translator newTranslator) { + translator = requireNonNullElseGet(newTranslator, () -> Translator.load(INITIAL_TRANSLATOR)); + } + + public static String tr(String key) { + return translator.translate(key); + } + + public static String tr(String key, Object... values) { + return translator.translate(key, values); + } +} diff --git a/src/main/java/core/model/enums/MatchType.java b/src/main/java/core/model/enums/MatchType.java index dbd08ec93..d2a181747 100644 --- a/src/main/java/core/model/enums/MatchType.java +++ b/src/main/java/core/model/enums/MatchType.java @@ -1,9 +1,12 @@ package core.model.enums; +import core.model.TranslationFacility; import core.model.match.IMatchType; import core.model.match.SourceSystem; + import java.util.List; import java.util.stream.Stream; + import static java.util.stream.Collectors.toList; public enum MatchType implements IMatchType { @@ -202,22 +205,22 @@ public int getIconArrayIndex() { @Override public String getName() { return switch (this) { - case LEAGUE -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.league"); - case CUP -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.cup"); - case QUALIFICATION -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.qualification"); - case NATIONALCOMPCUPRULES -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.nationalteamscompetition_cup"); - case MASTERS -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.hattrickmasters"); - case NATIONALCOMPNORMAL -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.nationalteamscompetition_normal"); - case INTSPIEL -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.internationalcompetition_normal"); - case INTFRIENDLYCUPRULES -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.internationalfriendly_cup"); - case INTFRIENDLYNORMAL -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.internationalfriendly_normal"); - case NATIONALFRIENDLY -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.nationalteamsfriendly"); - case FRIENDLYCUPRULES -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.friendly_cup"); - case FRIENDLYNORMAL -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.friendly_normal"); - case TOURNAMENTGROUP -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.tournament_group"); - case TOURNAMENTPLAYOFF -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.tournament_playoff"); - case SINGLE -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.single"); - case LADDER -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.ladder"); + case LEAGUE -> TranslationFacility.tr("ls.match.matchtype.league"); + case CUP -> TranslationFacility.tr("ls.match.matchtype.cup"); + case QUALIFICATION -> TranslationFacility.tr("ls.match.matchtype.qualification"); + case NATIONALCOMPCUPRULES -> TranslationFacility.tr("ls.match.matchtype.nationalteamscompetition_cup"); + case MASTERS -> TranslationFacility.tr("ls.match.matchtype.hattrickmasters"); + case NATIONALCOMPNORMAL -> TranslationFacility.tr("ls.match.matchtype.nationalteamscompetition_normal"); + case INTSPIEL -> TranslationFacility.tr("ls.match.matchtype.internationalcompetition_normal"); + case INTFRIENDLYCUPRULES -> TranslationFacility.tr("ls.match.matchtype.internationalfriendly_cup"); + case INTFRIENDLYNORMAL -> TranslationFacility.tr("ls.match.matchtype.internationalfriendly_normal"); + case NATIONALFRIENDLY -> TranslationFacility.tr("ls.match.matchtype.nationalteamsfriendly"); + case FRIENDLYCUPRULES -> TranslationFacility.tr("ls.match.matchtype.friendly_cup"); + case FRIENDLYNORMAL -> TranslationFacility.tr("ls.match.matchtype.friendly_normal"); + case TOURNAMENTGROUP -> TranslationFacility.tr("ls.match.matchtype.tournament_group"); + case TOURNAMENTPLAYOFF -> TranslationFacility.tr("ls.match.matchtype.tournament_playoff"); + case SINGLE -> TranslationFacility.tr("ls.match.matchtype.single"); + case LADDER -> TranslationFacility.tr("ls.match.matchtype.ladder"); default -> "unknown"; }; } diff --git a/src/main/java/core/model/enums/MatchTypeExtended.java b/src/main/java/core/model/enums/MatchTypeExtended.java index 505d0397c..7b05888f9 100644 --- a/src/main/java/core/model/enums/MatchTypeExtended.java +++ b/src/main/java/core/model/enums/MatchTypeExtended.java @@ -1,13 +1,10 @@ package core.model.enums; +import core.model.TranslationFacility; import core.model.match.IMatchType; -import core.model.match.SourceSystem; -import java.util.List; import java.util.stream.Stream; -import static java.util.stream.Collectors.toList; - public enum MatchTypeExtended implements IMatchType { EMERALDCUP(1001), // That match type is not part of HT CHPP API. It is created within HO for convenience with existing DB structure @@ -64,11 +61,11 @@ public int getIconArrayIndex() { @Override public String getName() { return switch (this) { - case EMERALDCUP -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.emerald_cup"); - case RUBYCUP -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.ruby_cup"); - case SAPPHIRECUP -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.sapphire_cup"); - case CONSOLANTECUP -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.consolante_cup"); - case DIVISIONBATTLE -> core.model.HOVerwaltung.instance().getLanguageString("ls.match.matchtype.division_battle"); + case EMERALDCUP -> TranslationFacility.tr("ls.match.matchtype.emerald_cup"); + case RUBYCUP -> TranslationFacility.tr("ls.match.matchtype.ruby_cup"); + case SAPPHIRECUP -> TranslationFacility.tr("ls.match.matchtype.sapphire_cup"); + case CONSOLANTECUP -> TranslationFacility.tr("ls.match.matchtype.consolante_cup"); + case DIVISIONBATTLE -> TranslationFacility.tr("ls.match.matchtype.division_battle"); default -> "unknown"; }; } diff --git a/src/main/java/core/model/match/MatchEvent.java b/src/main/java/core/model/match/MatchEvent.java index 189d889e7..391d2f41c 100644 --- a/src/main/java/core/model/match/MatchEvent.java +++ b/src/main/java/core/model/match/MatchEvent.java @@ -5,11 +5,12 @@ import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.enums.MatchType; import core.model.player.Specialty; import core.util.HODateTime; import core.util.HOLogger; + import javax.swing.*; import java.util.*; import java.util.stream.IntStream; @@ -776,7 +777,7 @@ public String getEventTextDescription() { } public static String getEventTextDescription(int iMatchEventID) { - return iMatchEventID + ": " + HOVerwaltung.instance().getLanguageString("MatchEvent_" + iMatchEventID); + return iMatchEventID + ": " + TranslationFacility.tr("MatchEvent_" + iMatchEventID); } public List getIcons() { diff --git a/src/main/java/core/model/match/MatchLineupTeam.java b/src/main/java/core/model/match/MatchLineupTeam.java index f95defe0a..521ac698a 100644 --- a/src/main/java/core/model/match/MatchLineupTeam.java +++ b/src/main/java/core/model/match/MatchLineupTeam.java @@ -2,7 +2,7 @@ import core.db.AbstractTable; import core.db.DBManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.enums.MatchType; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; @@ -12,7 +12,9 @@ import module.lineup.substitution.model.MatchOrderType; import module.lineup.substitution.model.Substitution; import org.jetbrains.annotations.NotNull; + import java.util.*; + import static core.model.player.MatchRoleID.Sector.None; import static java.lang.Math.max; import static java.lang.Math.min; @@ -232,14 +234,13 @@ public final StyleOfPlay getStyleOfPlay() { // returns offensive, defensive or neutral depending on styleOfPlay // e.g. -3 is 30% defensive, 10 is 100% offensive public static String getStyleOfPlayName(StyleOfPlay styleOfPlay) { - HOVerwaltung hov = HOVerwaltung.instance(); String s; var style = StyleOfPlay.toInt(styleOfPlay); if (style == 0) { - return hov.getLanguageString("ls.team.styleofplay.neutral"); + return TranslationFacility.tr("ls.team.styleofplay.neutral"); } else { - s = (style > 0) ? hov.getLanguageString("ls.team.styleofplay.offensive") : - hov.getLanguageString("ls.team.styleofplay.defensive"); + s = (style > 0) ? TranslationFacility.tr("ls.team.styleofplay.offensive") : + TranslationFacility.tr("ls.team.styleofplay.defensive"); } return Math.abs(style * 10) + "% " + s; } diff --git a/src/main/java/core/model/match/Matchdetails.java b/src/main/java/core/model/match/Matchdetails.java index 43b933dc8..8be9ade29 100644 --- a/src/main/java/core/model/match/Matchdetails.java +++ b/src/main/java/core/model/match/Matchdetails.java @@ -4,6 +4,7 @@ import core.db.DBManager; import core.gui.HOMainFrame; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.cup.CupLevel; import core.model.cup.CupLevelIndex; import core.model.enums.MatchType; @@ -185,8 +186,8 @@ private int getLastMinuteFromPartInfo() { return getLastMinute(); } - static String afterPenalties = HOVerwaltung.instance().getLanguageString("ls.match.after.penalties.abbreviation"); - static String afterExtension = HOVerwaltung.instance().getLanguageString("ls.match.after.extension.abbreviation"); + static String afterPenalties = TranslationFacility.tr("ls.match.after.penalties.abbreviation"); + static String afterExtension = TranslationFacility.tr("ls.match.after.extension.abbreviation"); public static String getResultExtensionAbbreviation(Integer duration) { if (duration != null) { @@ -474,10 +475,10 @@ public Matchdetails() { */ public static String getNameForEinstellung(int einstellung) { return switch (einstellung) { - case EINSTELLUNG_PIC -> HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.playitcool"); - case EINSTELLUNG_NORMAL -> HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.normal"); - case EINSTELLUNG_MOTS -> HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.matchoftheseason"); - default -> HOVerwaltung.instance().getLanguageString("Unbestimmt"); + case EINSTELLUNG_PIC -> TranslationFacility.tr("ls.team.teamattitude.playitcool"); + case EINSTELLUNG_NORMAL -> TranslationFacility.tr("ls.team.teamattitude.normal"); + case EINSTELLUNG_MOTS -> TranslationFacility.tr("ls.team.teamattitude.matchoftheseason"); + default -> TranslationFacility.tr("Unbestimmt"); }; } @@ -491,30 +492,28 @@ public static String getNameForEinstellung(int einstellung) { public static String getNameForTaktik(int taktikTyp) { return switch (taktikTyp) { - case TAKTIK_NORMAL -> HOVerwaltung.instance().getLanguageString("ls.team.tactic.normal"); - case TAKTIK_PRESSING -> HOVerwaltung.instance().getLanguageString("ls.team.tactic.pressing"); - case TAKTIK_KONTER -> HOVerwaltung.instance().getLanguageString("ls.team.tactic.counter-attacks"); - case TAKTIK_MIDDLE -> HOVerwaltung.instance().getLanguageString("ls.team.tactic.attackinthemiddle"); - case TAKTIK_WINGS -> HOVerwaltung.instance().getLanguageString("ls.team.tactic.attackonwings"); - case TAKTIK_CREATIVE -> HOVerwaltung.instance().getLanguageString("ls.team.tactic.playcreatively"); - case TAKTIK_LONGSHOTS -> HOVerwaltung.instance().getLanguageString("ls.team.tactic.longshots"); - default -> HOVerwaltung.instance().getLanguageString("Unbestimmt"); + case TAKTIK_NORMAL -> TranslationFacility.tr("ls.team.tactic.normal"); + case TAKTIK_PRESSING -> TranslationFacility.tr("ls.team.tactic.pressing"); + case TAKTIK_KONTER -> TranslationFacility.tr("ls.team.tactic.counter-attacks"); + case TAKTIK_MIDDLE -> TranslationFacility.tr("ls.team.tactic.attackinthemiddle"); + case TAKTIK_WINGS -> TranslationFacility.tr("ls.team.tactic.attackonwings"); + case TAKTIK_CREATIVE -> TranslationFacility.tr("ls.team.tactic.playcreatively"); + case TAKTIK_LONGSHOTS -> TranslationFacility.tr("ls.team.tactic.longshots"); + default -> TranslationFacility.tr("Unbestimmt"); }; } // get the used tactic name in short form public static String getShortTacticName(int type) { - HOVerwaltung hov = HOVerwaltung.instance(); - return switch (type) { - case IMatchDetails.TAKTIK_NORMAL -> hov.getLanguageString("ls.team.tactic_short.normal"); - case IMatchDetails.TAKTIK_PRESSING -> hov.getLanguageString("ls.team.tactic_short.pressing"); - case IMatchDetails.TAKTIK_KONTER -> hov.getLanguageString("ls.team.tactic_short.counter-attacks"); - case IMatchDetails.TAKTIK_MIDDLE -> hov.getLanguageString("ls.team.tactic_short.attackinthemiddle"); - case IMatchDetails.TAKTIK_WINGS -> hov.getLanguageString("ls.team.tactic_short.attackonwings"); - case IMatchDetails.TAKTIK_LONGSHOTS -> hov.getLanguageString("ls.team.tactic_short.longshots"); - case IMatchDetails.TAKTIK_CREATIVE -> hov.getLanguageString("ls.team.tactic_short.playcreatively"); - default -> HOVerwaltung.instance().getLanguageString("Unbestimmt"); + case IMatchDetails.TAKTIK_NORMAL -> TranslationFacility.tr("ls.team.tactic_short.normal"); + case IMatchDetails.TAKTIK_PRESSING -> TranslationFacility.tr("ls.team.tactic_short.pressing"); + case IMatchDetails.TAKTIK_KONTER -> TranslationFacility.tr("ls.team.tactic_short.counter-attacks"); + case IMatchDetails.TAKTIK_MIDDLE -> TranslationFacility.tr("ls.team.tactic_short.attackinthemiddle"); + case IMatchDetails.TAKTIK_WINGS -> TranslationFacility.tr("ls.team.tactic_short.attackonwings"); + case IMatchDetails.TAKTIK_LONGSHOTS -> TranslationFacility.tr("ls.team.tactic_short.longshots"); + case IMatchDetails.TAKTIK_CREATIVE -> TranslationFacility.tr("ls.team.tactic_short.playcreatively"); + default -> TranslationFacility.tr("Unbestimmt"); }; } diff --git a/src/main/java/core/model/match/MatchesHighlightsStat.java b/src/main/java/core/model/match/MatchesHighlightsStat.java index ecb1cefa2..95aed2ec8 100644 --- a/src/main/java/core/model/match/MatchesHighlightsStat.java +++ b/src/main/java/core/model/match/MatchesHighlightsStat.java @@ -1,6 +1,6 @@ package core.model.match; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import java.util.List; @@ -12,7 +12,7 @@ public class MatchesHighlightsStat { private final List subtypes; public MatchesHighlightsStat(String key,List subtypes){ - description = HOVerwaltung.instance().getLanguageString(key); + description = TranslationFacility.tr(key); this.subtypes = subtypes; goals=-1; } diff --git a/src/main/java/core/model/misc/Economy.java b/src/main/java/core/model/misc/Economy.java index 24392372a..3ddec847b 100644 --- a/src/main/java/core/model/misc/Economy.java +++ b/src/main/java/core/model/misc/Economy.java @@ -1,6 +1,7 @@ package core.model.misc; import core.db.AbstractTable; +import core.model.TranslationFacility; import core.util.HODateTime; /** @@ -206,47 +207,47 @@ public static String getNameForLevelFans(int level, HODateTime date) { } switch (level) { case LV_FANS_SENDING_LOVE_POEMS_TO_YOU: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.sendinglovepoemstoyou"); + return TranslationFacility.tr("ls.club.sponsors_fans.sendinglovepoemstoyou"); case LV_FANS_DANCING_IN_THE_STREETS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.dancinginthestreets"); + return TranslationFacility.tr("ls.club.sponsors_fans.dancinginthestreets"); case LV_FANS_HIGH_ON_LIFE: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.highonlife"); + return TranslationFacility.tr("ls.club.sponsors_fans.highonlife"); case LV_FANS_DELIRIOUS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.delirious"); + return TranslationFacility.tr("ls.club.sponsors_fans.delirious"); case LV_FANS_SATISFIED: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.satisfied"); + return TranslationFacility.tr("ls.club.sponsors_fans.satisfied"); case LV_FANS_CONTENT: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.content"); + return TranslationFacility.tr("ls.club.sponsors_fans.content"); case LV_FANS_CALM: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.calm"); + return TranslationFacility.tr("ls.club.sponsors_fans.calm"); case LV_FANS_DISAPPOINTED: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.fans.disappointed"); + return TranslationFacility.tr("ls.club.fans.disappointed"); case LV_FANS_IRRITATED: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.irritated"); + return TranslationFacility.tr("ls.club.sponsors_fans.irritated"); case LV_FANS_ANGRY: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.fans.angry"); + return TranslationFacility.tr("ls.club.fans.angry"); case LV_FANS_FURIOUS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.furious"); + return TranslationFacility.tr("ls.club.sponsors_fans.furious"); case LV_FANS_MURDEROUS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.murderous"); + return TranslationFacility.tr("ls.club.sponsors_fans.murderous"); default: { if (level > LV_FANS_SENDING_LOVE_POEMS_TO_YOU) { - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.sendinglovepoemstoyou"); + return TranslationFacility.tr("ls.club.sponsors_fans.sendinglovepoemstoyou"); } - return core.model.HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr("Unbestimmt"); } } } @@ -260,41 +261,41 @@ public static String getNameForLevelFans(int level, HODateTime date) { public static String getNameForLevelSponsors(int level) { switch (level) { case LV_SPONSORS_SENDING_LOVE_POEMS_TO_YOU: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.sendinglovepoemstoyou"); + return TranslationFacility.tr("ls.club.sponsors_fans.sendinglovepoemstoyou"); case LV_SPONSORS_DANCING_IN_THE_STREETS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.dancinginthestreets"); + return TranslationFacility.tr("ls.club.sponsors_fans.dancinginthestreets"); case LV_SPONSORS_HIGH_ON_LIFE: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.highonlife"); + return TranslationFacility.tr("ls.club.sponsors_fans.highonlife"); case LV_SPONSORS_DELIRIOUS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.delirious"); + return TranslationFacility.tr("ls.club.sponsors_fans.delirious"); case LV_SPONSORS_SATISFIED: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.satisfied"); + return TranslationFacility.tr("ls.club.sponsors_fans.satisfied"); case LV_SPONSORS_CONTENT: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.content"); + return TranslationFacility.tr("ls.club.sponsors_fans.content"); case LV_SPONSORS_CALM: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.calm"); + return TranslationFacility.tr("ls.club.sponsors_fans.calm"); case LV_SPONSORS_IRRITATED: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.irritated"); + return TranslationFacility.tr("ls.club.sponsors_fans.irritated"); case LV_SPONSORS_FURIOUS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.furious"); + return TranslationFacility.tr("ls.club.sponsors_fans.furious"); case LV_SPONSORS_MURDEROUS: - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.murderous"); + return TranslationFacility.tr("ls.club.sponsors_fans.murderous"); default: { if (level > LV_SPONSORS_SENDING_LOVE_POEMS_TO_YOU) { - return core.model.HOVerwaltung.instance().getLanguageString("ls.club.sponsors_fans.sendinglovepoemstoyou"); + return TranslationFacility.tr("ls.club.sponsors_fans.sendinglovepoemstoyou"); } - return core.model.HOVerwaltung.instance().getLanguageString("Unbestimmt"); + return TranslationFacility.tr("Unbestimmt"); } } } diff --git a/src/main/java/core/model/player/MatchRoleID.java b/src/main/java/core/model/player/MatchRoleID.java index 9e1e867d4..befe45961 100644 --- a/src/main/java/core/model/player/MatchRoleID.java +++ b/src/main/java/core/model/player/MatchRoleID.java @@ -6,6 +6,7 @@ import core.datatype.CBItem; import core.db.AbstractTable; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HOLogger; import module.lineup.Lineup; import org.jetbrains.annotations.NotNull; @@ -193,27 +194,27 @@ public static String getShortNameForPosition(byte posId) { // HOLogger.instance().log(getClass(), "Unbestimmte Position: " + // posId ); return switch (posId) { - case KEEPER -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper"); - case CENTRAL_DEFENDER -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender"); - case CENTRAL_DEFENDER_TOWING -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefendertowardswing"); - case CENTRAL_DEFENDER_OFF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefenderoffensive"); - case BACK -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback"); - case BACK_TOMID -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbacktowardsmiddle"); - case BACK_OFF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackoffensive"); - case BACK_DEF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackdefensive"); - case MIDFIELDER -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder"); - case MIDFIELDER_OFF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderoffensive"); - case MIDFIELDER_DEF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderdefensive"); - case MIDFIELDER_TOWING -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfieldertowardswing"); - case WINGER -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger"); - case WINGER_TOMID -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingertowardsmiddle"); - case WINGER_OFF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingeroffensive"); - case WINGER_DEF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingerdefensive"); - case FORWARD -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward"); - case FORWARD_TOWING -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwardtowardswing"); - case FORWARD_DEF -> HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwarddefensive"); - case SUBSTITUTED1, SUBSTITUTED2, SUBSTITUTED3 -> HOVerwaltung.instance().getLanguageString("Ausgewechselt"); - default -> HOVerwaltung.instance().getLanguageString("Unbestimmt"); + case KEEPER -> TranslationFacility.tr("ls.player.position_short.keeper"); + case CENTRAL_DEFENDER -> TranslationFacility.tr("ls.player.position_short.centraldefender"); + case CENTRAL_DEFENDER_TOWING -> TranslationFacility.tr("ls.player.position_short.centraldefendertowardswing"); + case CENTRAL_DEFENDER_OFF -> TranslationFacility.tr("ls.player.position_short.centraldefenderoffensive"); + case BACK -> TranslationFacility.tr("ls.player.position_short.wingback"); + case BACK_TOMID -> TranslationFacility.tr("ls.player.position_short.wingbacktowardsmiddle"); + case BACK_OFF -> TranslationFacility.tr("ls.player.position_short.wingbackoffensive"); + case BACK_DEF -> TranslationFacility.tr("ls.player.position_short.wingbackdefensive"); + case MIDFIELDER -> TranslationFacility.tr("ls.player.position_short.innermidfielder"); + case MIDFIELDER_OFF -> TranslationFacility.tr("ls.player.position_short.innermidfielderoffensive"); + case MIDFIELDER_DEF -> TranslationFacility.tr("ls.player.position_short.innermidfielderdefensive"); + case MIDFIELDER_TOWING -> TranslationFacility.tr("ls.player.position_short.innermidfieldertowardswing"); + case WINGER -> TranslationFacility.tr("ls.player.position_short.winger"); + case WINGER_TOMID -> TranslationFacility.tr("ls.player.position_short.wingertowardsmiddle"); + case WINGER_OFF -> TranslationFacility.tr("ls.player.position_short.wingeroffensive"); + case WINGER_DEF -> TranslationFacility.tr("ls.player.position_short.wingerdefensive"); + case FORWARD -> TranslationFacility.tr("ls.player.position_short.forward"); + case FORWARD_TOWING -> TranslationFacility.tr("ls.player.position_short.forwardtowardswing"); + case FORWARD_DEF -> TranslationFacility.tr("ls.player.position_short.forwarddefensive"); + case SUBSTITUTED1, SUBSTITUTED2, SUBSTITUTED3 -> TranslationFacility.tr("Ausgewechselt"); + default -> TranslationFacility.tr("Unbestimmt"); }; } @@ -223,46 +224,46 @@ public static String getShortNameForPosition(byte posId) { public static String getNameForPosition(byte posId) { return switch (posId) { - case KEEPER -> getLangStr("ls.player.position.keeper"); - case CENTRAL_DEFENDER -> getLangStr("ls.player.position.centraldefender"); - case CENTRAL_DEFENDER_TOWING -> getLangStr("ls.player.position.centraldefendertowardswing"); - case CENTRAL_DEFENDER_OFF -> getLangStr("ls.player.position.centraldefenderoffensive"); - case BACK -> getLangStr("ls.player.position.wingback"); - case BACK_TOMID -> getLangStr("ls.player.position.wingbacktowardsmiddle"); - case BACK_OFF -> getLangStr("ls.player.position.wingbackoffensive"); - case BACK_DEF -> getLangStr("ls.player.position.wingbackdefensive"); - case MIDFIELDER -> getLangStr("ls.player.position.innermidfielder"); - case MIDFIELDER_OFF -> getLangStr("ls.player.position.innermidfielderoffensive"); - case MIDFIELDER_DEF -> getLangStr("ls.player.position.innermidfielderdefensive"); - case MIDFIELDER_TOWING -> getLangStr("ls.player.position.innermidfieldertowardswing"); - case WINGER -> getLangStr("ls.player.position.winger"); - case WINGER_TOMID -> getLangStr("ls.player.position.wingertowardsmiddle"); - case WINGER_OFF -> getLangStr("ls.player.position.wingeroffensive"); - case WINGER_DEF -> getLangStr("ls.player.position.wingerdefensive"); - case FORWARD -> getLangStr("ls.player.position.forward"); - case FORWARD_DEF -> getLangStr("ls.player.position.forwarddefensive"); - case FORWARD_DEF_TECH -> getLangStr("ls.player.position.forwarddefensivetechnical"); - case FORWARD_TOWING -> getLangStr("ls.player.position.forwardtowardswing"); - case EXTRA -> getLangStr("ls.player.position.extra_substitute"); - case SUBSTITUTED1, SUBSTITUTED2, SUBSTITUTED3 -> getLangStr("Ausgewechselt"); - case UNSELECTABLE -> getLangStr("Unselectable"); - default -> getLangStr("ls.player.position.no_override"); + case KEEPER -> TranslationFacility.tr("ls.player.position.keeper"); + case CENTRAL_DEFENDER -> TranslationFacility.tr("ls.player.position.centraldefender"); + case CENTRAL_DEFENDER_TOWING -> TranslationFacility.tr("ls.player.position.centraldefendertowardswing"); + case CENTRAL_DEFENDER_OFF -> TranslationFacility.tr("ls.player.position.centraldefenderoffensive"); + case BACK -> TranslationFacility.tr("ls.player.position.wingback"); + case BACK_TOMID -> TranslationFacility.tr("ls.player.position.wingbacktowardsmiddle"); + case BACK_OFF -> TranslationFacility.tr("ls.player.position.wingbackoffensive"); + case BACK_DEF -> TranslationFacility.tr("ls.player.position.wingbackdefensive"); + case MIDFIELDER -> TranslationFacility.tr("ls.player.position.innermidfielder"); + case MIDFIELDER_OFF -> TranslationFacility.tr("ls.player.position.innermidfielderoffensive"); + case MIDFIELDER_DEF -> TranslationFacility.tr("ls.player.position.innermidfielderdefensive"); + case MIDFIELDER_TOWING -> TranslationFacility.tr("ls.player.position.innermidfieldertowardswing"); + case WINGER -> TranslationFacility.tr("ls.player.position.winger"); + case WINGER_TOMID -> TranslationFacility.tr("ls.player.position.wingertowardsmiddle"); + case WINGER_OFF -> TranslationFacility.tr("ls.player.position.wingeroffensive"); + case WINGER_DEF -> TranslationFacility.tr("ls.player.position.wingerdefensive"); + case FORWARD -> TranslationFacility.tr("ls.player.position.forward"); + case FORWARD_DEF -> TranslationFacility.tr("ls.player.position.forwarddefensive"); + case FORWARD_DEF_TECH -> TranslationFacility.tr("ls.player.position.forwarddefensivetechnical"); + case FORWARD_TOWING -> TranslationFacility.tr("ls.player.position.forwardtowardswing"); + case EXTRA -> TranslationFacility.tr("ls.player.position.extra_substitute"); + case SUBSTITUTED1, SUBSTITUTED2, SUBSTITUTED3 -> TranslationFacility.tr("Ausgewechselt"); + case UNSELECTABLE -> TranslationFacility.tr("Unselectable"); + default -> TranslationFacility.tr("ls.player.position.no_override"); }; } public static String getNameForPositionWithoutTactic(byte posId) { return switch (posId) { - case KEEPER -> getLangStr("ls.player.position.keeper"); - case CENTRAL_DEFENDER, CENTRAL_DEFENDER_TOWING, CENTRAL_DEFENDER_OFF -> getLangStr("ls.player.position.centraldefender"); - case BACK, BACK_TOMID, BACK_OFF, BACK_DEF -> getLangStr("ls.player.position.wingback"); - case MIDFIELDER, MIDFIELDER_OFF, MIDFIELDER_DEF, MIDFIELDER_TOWING -> getLangStr("ls.player.position.innermidfielder"); - case WINGER, WINGER_TOMID, WINGER_OFF, WINGER_DEF -> getLangStr("ls.player.position.winger"); - case FORWARD, FORWARD_DEF, FORWARD_DEF_TECH, FORWARD_TOWING -> getLangStr("ls.player.position.forward"); - case EXTRA -> getLangStr("ls.player.position.extra_substitute"); - case SUBSTITUTED1, SUBSTITUTED2, SUBSTITUTED3 -> getLangStr("Ausgewechselt"); - case UNSELECTABLE -> getLangStr("Unselectable"); - default -> getLangStr("Unbestimmt"); + case KEEPER -> TranslationFacility.tr("ls.player.position.keeper"); + case CENTRAL_DEFENDER, CENTRAL_DEFENDER_TOWING, CENTRAL_DEFENDER_OFF -> TranslationFacility.tr("ls.player.position.centraldefender"); + case BACK, BACK_TOMID, BACK_OFF, BACK_DEF -> TranslationFacility.tr("ls.player.position.wingback"); + case MIDFIELDER, MIDFIELDER_OFF, MIDFIELDER_DEF, MIDFIELDER_TOWING -> TranslationFacility.tr("ls.player.position.innermidfielder"); + case WINGER, WINGER_TOMID, WINGER_OFF, WINGER_DEF -> TranslationFacility.tr("ls.player.position.winger"); + case FORWARD, FORWARD_DEF, FORWARD_DEF_TECH, FORWARD_TOWING -> TranslationFacility.tr("ls.player.position.forward"); + case EXTRA -> TranslationFacility.tr("ls.player.position.extra_substitute"); + case SUBSTITUTED1, SUBSTITUTED2, SUBSTITUTED3 -> TranslationFacility.tr("Ausgewechselt"); + case UNSELECTABLE -> TranslationFacility.tr("Unselectable"); + default -> TranslationFacility.tr("Unbestimmt"); }; } @@ -703,8 +704,6 @@ public static Properties convertOldRoleToNew(Properties oldLineupProperties) { } - private static String getLangStr(String key) {return HOVerwaltung.instance().getLanguageString(key);} - public Sector getSector(){ return getSector(this.m_iId); } diff --git a/src/main/java/core/model/player/Player.java b/src/main/java/core/model/player/Player.java index 1d3b05565..2636a4f8a 100644 --- a/src/main/java/core/model/player/Player.java +++ b/src/main/java/core/model/player/Player.java @@ -6,24 +6,30 @@ import core.db.AbstractTable; import core.db.DBManager; import core.model.*; +import core.model.enums.MatchType; import core.model.match.MatchLineupPosition; import core.model.match.MatchLineupTeam; -import core.model.enums.MatchType; import core.net.MyConnector; import core.net.OnlineWorker; import core.rating.RatingPredictionModel; import core.training.*; -import core.util.*; +import core.util.HODateTime; +import core.util.HOLogger; +import core.util.HelperWrapper; +import core.util.Htms; + import java.time.Duration; import java.util.*; -import static core.constants.player.PlayerSkill.KEEPER; -import static core.constants.player.PlayerSkill.WINGER; -import static core.model.player.MatchRoleID.*; +import static core.constants.player.PlayerSkill.*; +import static core.model.player.MatchRoleID.getPosition; +import static core.model.player.MatchRoleID.isFieldMatchRoleId; import static java.lang.Integer.MAX_VALUE; import static java.lang.Integer.min; -import static core.constants.player.PlayerSkill.*; -import static java.lang.Math.*; +import static java.lang.Math.max; +import static java.lang.Math.pow; +import static java.lang.Math.round; +import static java.lang.Math.sqrt; public class Player extends AbstractTable.Storable { @@ -602,14 +608,14 @@ public String getAgeStringFull() { StringBuilder ret = new StringBuilder(); ret.append(age.seasons); ret.append(" "); - ret.append(HOVerwaltung.instance().getLanguageString("ls.player.age.years")); + ret.append(TranslationFacility.tr("ls.player.age.years")); ret.append(" "); ret.append(age.days); ret.append(" "); - ret.append(HOVerwaltung.instance().getLanguageString("ls.player.age.days")); + ret.append(TranslationFacility.tr("ls.player.age.days")); if (birthday) { ret.append(" ("); - ret.append(HOVerwaltung.instance().getLanguageString("ls.player.age.birthday")); + ret.append(TranslationFacility.tr("ls.player.age.birthday")); ret.append(")"); } return ret.toString(); @@ -1172,7 +1178,7 @@ public String getSpecialtyName() { if (s.equals(Specialty.NO_SPECIALITY)) { return EMPTY; } else { - return HOVerwaltung.instance().getLanguageString("ls.player.speciality." + s.toString().toLowerCase(Locale.ROOT)); + return TranslationFacility.tr("ls.player.speciality." + s.toString().toLowerCase(Locale.ROOT)); } } @@ -1996,7 +2002,7 @@ public String getTrainingPriorityInformation(HODateTime nextWeek) { // if (!t.endsBefore(nextWeek)) { if (ret != null) { - ret = HOVerwaltung.instance().getLanguageString("trainpre.individual.prios"); + ret = TranslationFacility.tr("trainpre.individual.prios"); break; } ret = t.getPriority().toString(); diff --git a/src/main/java/core/model/player/PlayerCategory.java b/src/main/java/core/model/player/PlayerCategory.java index 5dc51d07a..e71a70c07 100644 --- a/src/main/java/core/model/player/PlayerCategory.java +++ b/src/main/java/core/model/player/PlayerCategory.java @@ -1,6 +1,6 @@ package core.model.player; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; public enum PlayerCategory { @@ -37,9 +37,8 @@ public enum PlayerCategory { } public static String StringValueOf(PlayerCategory value) { - var hov = HOVerwaltung.instance(); - if (value == null || value == NoCategorySet) return hov.getLanguageString("ls.player.category.undefined"); - return hov.getLanguageString("ls.player.category." + value._toString()); + if (value == null || value == NoCategorySet) return TranslationFacility.tr("ls.player.category.undefined"); + return TranslationFacility.tr("ls.player.category." + value._toString()); } private String _toString() { diff --git a/src/main/java/core/module/ModuleConfigPanelTable.java b/src/main/java/core/module/ModuleConfigPanelTable.java index 9530c7629..833b640ef 100644 --- a/src/main/java/core/module/ModuleConfigPanelTable.java +++ b/src/main/java/core/module/ModuleConfigPanelTable.java @@ -4,30 +4,26 @@ import core.gui.comp.renderer.HODefaultTableCellRenderer; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.config.ModuleConfigDialog; import core.option.OptionManager; import tool.updater.TableEditor; import tool.updater.TableModel; +import javax.swing.*; +import javax.swing.table.TableColumn; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serial; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JTable; -import javax.swing.table.TableColumn; - import static core.gui.theme.HOColorName.DARK_GRAY; class ModuleConfigPanelTable extends JTable implements ActionListener{ @Serial private static final long serialVersionUID = 1L; - private static final String[] stateDescriptions = {HOVerwaltung.instance().getLanguageString("Deactivated"),HOVerwaltung.instance().getLanguageString("Activated"),HOVerwaltung.instance().getLanguageString("Autostart")}; - protected String[] columnNames = {HOVerwaltung.instance().getLanguageString("Status"),HOVerwaltung.instance().getLanguageString("Name"),HOVerwaltung.instance().getLanguageString("Optionen")}; + private static final String[] stateDescriptions = {TranslationFacility.tr("Deactivated"),TranslationFacility.tr("Activated"),TranslationFacility.tr("Autostart")}; + protected String[] columnNames = {TranslationFacility.tr("Status"),TranslationFacility.tr("Name"),TranslationFacility.tr("Optionen")}; private final TableEditor editor = new TableEditor(); diff --git a/src/main/java/core/module/config/ModuleConfigDialog.java b/src/main/java/core/module/config/ModuleConfigDialog.java index bece77ab5..0305da44d 100644 --- a/src/main/java/core/module/config/ModuleConfigDialog.java +++ b/src/main/java/core/module/config/ModuleConfigDialog.java @@ -1,27 +1,20 @@ package core.module.config; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.IModule; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JScrollPane; - public class ModuleConfigDialog extends JDialog implements ActionListener{ private static final long serialVersionUID = -6012059855852713150L; private IModule module; JButton okButton; -// JButton cancelButton; public ModuleConfigDialog(JDialog owner, IModule module){ super(owner,module.getDescription()); @@ -55,14 +48,10 @@ private JPanel createButtons() { JPanel buttonPanel = new ImagePanel(); ((FlowLayout) buttonPanel.getLayout()).setAlignment(FlowLayout.CENTER); - okButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.save")); + okButton = new JButton(TranslationFacility.tr("ls.button.save")); okButton.addActionListener(this); -// cancelButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); -// cancelButton.addActionListener(this); - buttonPanel.add(okButton); - // buttonPanel.add(cancelButton); return buttonPanel; } diff --git a/src/main/java/core/net/DownloadDialog.java b/src/main/java/core/net/DownloadDialog.java index 8b2980945..a18c4690e 100644 --- a/src/main/java/core/net/DownloadDialog.java +++ b/src/main/java/core/net/DownloadDialog.java @@ -10,6 +10,7 @@ import core.gui.comp.panel.ImagePanel; import core.model.HOModel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.enums.MatchType; import core.model.match.MatchKurzInfo; @@ -23,16 +24,14 @@ import module.nthrf.NthrfUtil; import module.series.Spielplan; import tool.updater.UpdateController; -import java.awt.*; -import java.awt.event.*; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Comparator; -import java.util.List; -import java.util.Map; + import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; +import java.awt.*; +import java.awt.event.*; +import java.util.List; +import java.util.*; /** * User dialog to download different hattrick data @@ -42,16 +41,16 @@ public class DownloadDialog extends JDialog implements ActionListener { // ~ Instance fields--/ private static DownloadDialog m_clDownloadDialog; private static final HOVerwaltung hov = HOVerwaltung.instance(); - private final JButton m_jbAbort = new JButton(hov.getLanguageString("ls.button.cancel")); - final private JButton m_jbDownload = new JButton(hov.getLanguageString("ls.button.download")); - private final JButton m_jbProxy = new JButton(hov.getLanguageString("ConfigureProxy")); + private final JButton m_jbAbort = new JButton(TranslationFacility.tr("ls.button.cancel")); + final private JButton m_jbDownload = new JButton(TranslationFacility.tr("ls.button.download")); + private final JButton m_jbProxy = new JButton(TranslationFacility.tr("ConfigureProxy")); private final DownloadFilter filterRoot = new DownloadFilter(); private final CheckBoxTree downloadFilter = new CheckBoxTree(); - private final JCheckBox m_jchMatchArchive = new JCheckBox(hov.getLanguageString("download.oldmatches"), false); + private final JCheckBox m_jchMatchArchive = new JCheckBox(TranslationFacility.tr("download.oldmatches"), false); private final SpinnerDateModel m_clSpinnerModel = new SpinnerDateModel(); private final JSpinner m_jsSpinner = new JSpinner(m_clSpinnerModel); - private final JCheckBox m_jchShowSaveDialog = new JCheckBox(hov.getLanguageString("Show_SaveHRF_Dialog"), core.model.UserParameter.instance().showHRFSaveDialog); + private final JCheckBox m_jchShowSaveDialog = new JCheckBox(TranslationFacility.tr("Show_SaveHRF_Dialog"), core.model.UserParameter.instance().showHRFSaveDialog); private final boolean isNtTeam; /** @@ -73,9 +72,9 @@ private static void clearInstance() { * Singleton */ private DownloadDialog() { - super(HOMainFrame.instance(), hov.getLanguageString("ls.menu.file.download"), ModalityType.MODELESS); + super(HOMainFrame.instance(), TranslationFacility.tr("ls.menu.file.download"), ModalityType.MODELESS); this.isNtTeam = UserManager.instance().getCurrentUser().isNtTeam(); - setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); initComponents(); } @@ -121,7 +120,7 @@ private void initComponents() { if (!isNtTeam) { final JPanel normalDownloadPanel = new ImagePanel(new BorderLayout()); - normalDownloadPanel.setBorder(BorderFactory.createTitledBorder(hov.getLanguageString("ls.button.download"))); + normalDownloadPanel.setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr("ls.button.download"))); // Download Filter final DefaultTreeModel newModel = new DefaultTreeModel(filterRoot); @@ -160,7 +159,7 @@ private void initComponents() { getContentPane().add(normalDownloadPanel, c); final JPanel specialDownload = new ImagePanel(new BorderLayout()); - specialDownload.setBorder(BorderFactory.createTitledBorder(hov.getLanguageString("Verschiedenes"))); + specialDownload.setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr("Verschiedenes"))); // Alte Spielpläne final JPanel oldFixturePanel = new ImagePanel(new BorderLayout()); @@ -169,7 +168,7 @@ private void initComponents() { final JPanel matchArchivePanel = new JPanel(new BorderLayout(1, 2)); matchArchivePanel.setOpaque(false); - m_jchMatchArchive.setToolTipText(hov.getLanguageString("download.oldmatches.tt")); + m_jchMatchArchive.setToolTipText(TranslationFacility.tr("download.oldmatches.tt")); m_jchMatchArchive.addActionListener(this); m_jchMatchArchive.setOpaque(false); matchArchivePanel.add(m_jchMatchArchive, BorderLayout.WEST); @@ -179,7 +178,7 @@ private void initComponents() { matchArchivePanel.add(m_jsSpinner, BorderLayout.EAST); // Show HRF FileDialog - m_jchShowSaveDialog.setToolTipText(hov.getLanguageString("tt_Optionen_Show_SaveHRF_Dialog")); + m_jchShowSaveDialog.setToolTipText(TranslationFacility.tr("tt_Optionen_Show_SaveHRF_Dialog")); m_jchShowSaveDialog.setOpaque(false); m_jchShowSaveDialog.addActionListener(this); @@ -195,14 +194,14 @@ private void initComponents() { } else { // isNtTeam final JPanel normalDownloadPanel = new ImagePanel(new GridLayout(3, 1, 4, 4)); - normalDownloadPanel.setBorder(BorderFactory.createTitledBorder(hov.getLanguageString("ls.button.download"))); + normalDownloadPanel.setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr("ls.button.download"))); JTextArea ta = new JTextArea(); - ta.append(hov.getLanguageString("nthrf.hint1") + "\n"); - ta.append(hov.getLanguageString("nthrf.hint2") + "\n"); - ta.append(hov.getLanguageString("nthrf.hint3") + "\n"); - ta.append(hov.getLanguageString("nthrf.hint4") + " '"); - ta.append(hov.getLanguageString("Start") + "' "); - ta.append(hov.getLanguageString("nthrf.hint5")); + ta.append(TranslationFacility.tr("nthrf.hint1") + "\n"); + ta.append(TranslationFacility.tr("nthrf.hint2") + "\n"); + ta.append(TranslationFacility.tr("nthrf.hint3") + "\n"); + ta.append(TranslationFacility.tr("nthrf.hint4") + " '"); + ta.append(TranslationFacility.tr("Start") + "' "); + ta.append(TranslationFacility.tr("nthrf.hint5")); ta.setEditable(false); normalDownloadPanel.setLayout(new BorderLayout()); @@ -214,7 +213,7 @@ private void initComponents() { } var buttonRowPanel = new JPanel(new GridLayout(1, 3, 10, 10)); - m_jbDownload.setToolTipText(hov.getLanguageString("tt_Download_Start")); + m_jbDownload.setToolTipText(TranslationFacility.tr("tt_Download_Start")); m_jbDownload.addActionListener(this); m_jbDownload.setFont(m_jbDownload.getFont().deriveFont(Font.BOLD)); InputMap buttonKeys = m_jbDownload.getInputMap(JButton.WHEN_FOCUSED); @@ -222,12 +221,12 @@ private void initComponents() { buttonKeys.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), "released"); buttonRowPanel.add(m_jbDownload); - m_jbProxy.setToolTipText(hov.getLanguageString("tt_ConfigureProxy")); + m_jbProxy.setToolTipText(TranslationFacility.tr("tt_ConfigureProxy")); m_jbProxy.addActionListener(this); m_jbProxy.setFont(m_jbProxy.getFont().deriveFont(Font.BOLD)); buttonRowPanel.add(m_jbProxy); - m_jbAbort.setToolTipText(hov.getLanguageString("tt_Download_Abbrechen")); + m_jbAbort.setToolTipText(TranslationFacility.tr("tt_Download_Abbrechen")); m_jbAbort.addActionListener(this); buttonRowPanel.add(m_jbAbort); diff --git a/src/main/java/core/net/DownloadFilter.java b/src/main/java/core/net/DownloadFilter.java index 5c84fe415..f24a1c642 100644 --- a/src/main/java/core/net/DownloadFilter.java +++ b/src/main/java/core/net/DownloadFilter.java @@ -2,6 +2,7 @@ import core.db.DBManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import org.apache.commons.lang3.tuple.Pair; import javax.swing.tree.DefaultMutableTreeNode; @@ -9,27 +10,27 @@ public class DownloadFilter extends DefaultMutableTreeNode { private static final HOVerwaltung hov = HOVerwaltung.instance(); - private final DefaultMutableTreeNode currentMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.currentmatches")); - private final DefaultMutableTreeNode currentSeriesData = new DefaultMutableTreeNode(hov.getLanguageString("download.currentseriesdata")); - private final DefaultMutableTreeNode previousSeriesData = new DefaultMutableTreeNode(hov.getLanguageString("download.oldseriesdata")); - private final DefaultMutableTreeNode teamData = new DefaultMutableTreeNode(hov.getLanguageString("download.teamdata")); - private final DefaultMutableTreeNode officialMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.OfficialMatches")); - private final DefaultMutableTreeNode singleMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.SingleMatches")); - private final DefaultMutableTreeNode ladderMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.LadderMatches")); - private final DefaultMutableTreeNode tournamentGroupMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.TournamentGroupMatches")); - private final DefaultMutableTreeNode tournamentPlayoffMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.TournamentPlayoffMatches")); - private final DefaultMutableTreeNode divisionBattleMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.DivisionBattleMatches")); + private final DefaultMutableTreeNode currentMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.currentmatches")); + private final DefaultMutableTreeNode currentSeriesData = new DefaultMutableTreeNode(TranslationFacility.tr("download.currentseriesdata")); + private final DefaultMutableTreeNode previousSeriesData = new DefaultMutableTreeNode(TranslationFacility.tr("download.oldseriesdata")); + private final DefaultMutableTreeNode teamData = new DefaultMutableTreeNode(TranslationFacility.tr("download.teamdata")); + private final DefaultMutableTreeNode officialMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.OfficialMatches")); + private final DefaultMutableTreeNode singleMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.SingleMatches")); + private final DefaultMutableTreeNode ladderMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.LadderMatches")); + private final DefaultMutableTreeNode tournamentGroupMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.TournamentGroupMatches")); + private final DefaultMutableTreeNode tournamentPlayoffMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.TournamentPlayoffMatches")); + private final DefaultMutableTreeNode divisionBattleMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.DivisionBattleMatches")); public DownloadFilter() { - super(hov.getLanguageString("download.Filter")); + super(TranslationFacility.tr("download.Filter")); this.add(currentMatches); - DefaultMutableTreeNode seriesData = new DefaultMutableTreeNode(hov.getLanguageString("download.seriesdata")); + DefaultMutableTreeNode seriesData = new DefaultMutableTreeNode(TranslationFacility.tr("download.seriesdata")); this.add(seriesData); this.add(teamData); currentMatches.add(officialMatches); - DefaultMutableTreeNode integratedMatches = new DefaultMutableTreeNode(hov.getLanguageString("download.IntegratedMatches")); + DefaultMutableTreeNode integratedMatches = new DefaultMutableTreeNode(TranslationFacility.tr("download.IntegratedMatches")); currentMatches.add(integratedMatches); integratedMatches.add(singleMatches); @@ -52,7 +53,7 @@ private void fillOldFixturesList(DefaultMutableTreeNode previousSeriesData) { for (int i = currentSeason; i >= htWeek.season; i--) { int finalI = i; var season = seasons.stream().filter(f -> f.getSaison() == finalI).findFirst(); - var itemText = new StringBuilder(hov.getLanguageString("Season")).append(" ").append(i); + var itemText = new StringBuilder(TranslationFacility.tr("Season")).append(" ").append(i); if (season.isPresent()) { itemText.append(" / ").append(season.get().getLigaName()); } diff --git a/src/main/java/core/net/LigaAuswahlDialog.java b/src/main/java/core/net/LigaAuswahlDialog.java index a9e62c6f9..83c873b43 100644 --- a/src/main/java/core/net/LigaAuswahlDialog.java +++ b/src/main/java/core/net/LigaAuswahlDialog.java @@ -3,16 +3,13 @@ import core.db.DBManager; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Window; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.*; - /** * Auswahl der Liga zu einer Season, um den richtigen Spielplan zu ziehen @@ -23,12 +20,12 @@ public class LigaAuswahlDialog extends JDialog implements ActionListener { //~ Instance fields ---------------------------------------------------------------------------- - private JButton m_jbAbbrechen = new JButton(core.model.HOVerwaltung.instance().getLanguageString("ls.button.cancel")); - private JButton m_jbOk = new JButton(core.model.HOVerwaltung.instance().getLanguageString("ls.button.download")); + private JButton m_jbAbbrechen = new JButton(TranslationFacility.tr("ls.button.cancel")); + private JButton m_jbOk = new JButton(TranslationFacility.tr("ls.button.download")); private JComboBox m_jcbLiga; - private JRadioButton m_jrbLigaAktuell = new JRadioButton(core.model.HOVerwaltung.instance().getLanguageString("AktuelleLiga"),true); - private JRadioButton m_jrbLigaAndere = new JRadioButton(core.model.HOVerwaltung.instance().getLanguageString("AndereLiga"),false); - private JCheckBox m_jcbReuseSelection = new JCheckBox(HOVerwaltung.instance().getLanguageString("ls.selection.reuse")); + private JRadioButton m_jrbLigaAktuell = new JRadioButton(TranslationFacility.tr("AktuelleLiga"),true); + private JRadioButton m_jrbLigaAndere = new JRadioButton(TranslationFacility.tr("AndereLiga"),false); + private JCheckBox m_jcbReuseSelection = new JCheckBox(TranslationFacility.tr("ls.selection.reuse")); private int m_iLigaId = -2; private int ownLeagueId; private boolean reuseEnabled; @@ -39,7 +36,7 @@ public class LigaAuswahlDialog extends JDialog implements ActionListener { * Creates a new LigaAuswahlDialog object. */ public LigaAuswahlDialog(JDialog owner, int seasonid, int leagueId, boolean reuseEnabled) { - super(owner, HOVerwaltung.instance().getLanguageString("Liga"),true); + super(owner, TranslationFacility.tr("Liga"),true); this.reuseEnabled = reuseEnabled; ownLeagueId = leagueId; setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); @@ -81,7 +78,7 @@ private Integer[] fillCB() { private void initComponents( int seasonid) { setContentPane(new ImagePanel(new GridLayout(5, 2, 4, 4))); - JLabel label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Season")); + JLabel label = new JLabel(TranslationFacility.tr("Season")); getContentPane().add(label); final JTextField textfield = new JTextField(seasonid + ""); @@ -90,7 +87,7 @@ private void initComponents( int seasonid) { final ButtonGroup bg = new ButtonGroup(); - m_jrbLigaAktuell.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_LigaDownload_Aktuell")); + m_jrbLigaAktuell.setToolTipText(TranslationFacility.tr("tt_LigaDownload_Aktuell")); m_jrbLigaAktuell.setOpaque(false); m_jrbLigaAktuell.addActionListener(this); bg.add(m_jrbLigaAktuell); @@ -99,29 +96,29 @@ private void initComponents( int seasonid) { label = new JLabel(""+ ownLeagueId); getContentPane().add(label); - m_jrbLigaAndere.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_LigaDownload_Andere")); + m_jrbLigaAndere.setToolTipText(TranslationFacility.tr("tt_LigaDownload_Andere")); m_jrbLigaAndere.setOpaque(false); m_jrbLigaAndere.addActionListener(this); bg.add(m_jrbLigaAndere); getContentPane().add(m_jrbLigaAndere); m_jcbLiga = new JComboBox(fillCB()); - m_jcbLiga.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_LigaDownload_LigaID")); + m_jcbLiga.setToolTipText(TranslationFacility.tr("tt_LigaDownload_LigaID")); m_jcbLiga.setEnabled(false); m_jcbLiga.setSelectedItem(DBManager.instance().getLigaID4SaisonID(seasonid)); m_jcbLiga.setEditable(true); getContentPane().add(m_jcbLiga); - m_jcbReuseSelection.setToolTipText(HOVerwaltung.instance().getLanguageString("ls.tt.selection.reuse")); + m_jcbReuseSelection.setToolTipText(TranslationFacility.tr("ls.tt.selection.reuse")); m_jcbReuseSelection.setEnabled(this.reuseEnabled); getContentPane().add(m_jcbReuseSelection); getContentPane().add(new JLabel("")); // placeholder - m_jbOk.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Download_Start")); + m_jbOk.setToolTipText(TranslationFacility.tr("tt_Download_Start")); m_jbOk.addActionListener(this); getContentPane().add(m_jbOk); - m_jbAbbrechen.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Download_Abbrechen")); + m_jbAbbrechen.setToolTipText(TranslationFacility.tr("tt_Download_Abbrechen")); m_jbAbbrechen.addActionListener(this); getContentPane().add(m_jbAbbrechen); @@ -147,18 +144,18 @@ private int parseInt(Window parent, String text, boolean negativErlaubt) { final int temp = Integer.parseInt(text); if (!negativErlaubt && (temp < 0)) { - message = core.model.HOVerwaltung.instance().getLanguageString("negativVerboten"); + message = TranslationFacility.tr("negativVerboten"); throw new NumberFormatException(); } return temp; } catch (NumberFormatException nfe) { if (message.equals("")) { - message = core.model.HOVerwaltung.instance().getLanguageString("keineZahl"); + message = TranslationFacility.tr("keineZahl"); } core.util.Helper.showMessage(parent, message, - core.model.HOVerwaltung.instance().getLanguageString("Fehler"), + TranslationFacility.tr("Fehler"), javax.swing.JOptionPane.ERROR_MESSAGE); return -1; } diff --git a/src/main/java/core/net/MyConnector.java b/src/main/java/core/net/MyConnector.java index a11e2cf7b..90b7cf2c3 100644 --- a/src/main/java/core/net/MyConnector.java +++ b/src/main/java/core/net/MyConnector.java @@ -1,11 +1,18 @@ package core.net; -import com.github.scribejava.core.model.*; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth1AccessToken; +import com.github.scribejava.core.model.OAuthRequest; +import com.github.scribejava.core.model.Response; +import com.github.scribejava.core.model.Verb; +import com.github.scribejava.core.oauth.OAuth10aService; +import core.HO; import core.file.xml.XMLCHPPPreParser; import core.gui.CursorToolkit; import core.gui.HOMainFrame; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.enums.MatchType; import core.model.match.SourceSystem; @@ -14,13 +21,11 @@ import core.net.login.ProxySettings; import core.util.*; import org.jetbrains.annotations.Nullable; +import org.w3c.dom.Document; import tool.updater.VersionInfo; -import core.HO; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; + +import javax.swing.*; +import java.io.*; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; @@ -29,10 +34,6 @@ import java.util.zip.GZIPInputStream; import java.util.zip.Inflater; import java.util.zip.InflaterInputStream; -import javax.swing.JOptionPane; -import com.github.scribejava.core.builder.ServiceBuilder; -import com.github.scribejava.core.oauth.OAuth10aService; -import org.w3c.dom.Document; public class MyConnector { @@ -660,7 +661,7 @@ private String getCHPPWebFile(String surl) { HOLogger.instance().error(getClass(), sox); JOptionPane.showMessageDialog(null, sox.getMessage() + "\n\n" + "URL:" + surl + "\n", - HOVerwaltung.instance().getLanguageString("Fehler"), + TranslationFacility.tr("Fehler"), JOptionPane.ERROR_MESSAGE); } returnString = ""; @@ -679,7 +680,7 @@ private String getCHPPWebFile(String surl) { HOLogger.instance().error(getClass(), sox); if (showErrorMessage) JOptionPane.showMessageDialog(null, sox.getMessage() + "\nURL: " + url, - HOVerwaltung.instance().getLanguageString("Fehler"), + TranslationFacility.tr("Fehler"), JOptionPane.ERROR_MESSAGE); } return null; @@ -703,7 +704,7 @@ private String getCHPPWebFile(String surl) { HOLogger.instance().error(getClass(), sox); if (showErrorMessage) JOptionPane.showMessageDialog(null, sox.getMessage() + "\nURL: " + surl, - HOVerwaltung.instance().getLanguageString("Fehler"), + TranslationFacility.tr("Fehler"), JOptionPane.ERROR_MESSAGE); } return returnStream; @@ -777,7 +778,7 @@ public InputStream postWebFileWithBodyParameters(String surl, Map getMatchArchive(int teamId, HODateTime firstDa } try { - HOMainFrame.instance().setInformation(HOVerwaltung.instance().getLanguageString("ls.update_status.match_info"), 20); + HOMainFrame.instance().setInformation(TranslationFacility.tr("ls.update_status.match_info"), 20); matchesString = MyConnector.instance().getMatchesArchive(teamId, firstDate, lastDate); - HOMainFrame.instance().setInformation(HOVerwaltung.instance().getLanguageString("ls.update_status.match_info"), 20); + HOMainFrame.instance().setInformation(TranslationFacility.tr("ls.update_status.match_info"), 20); } catch (Exception e) { // Info String msg = getLangString("Downloadfehler") @@ -170,7 +162,7 @@ public static List getMatchArchive(int teamId, HODateTime firstDa return null; } - HOMainFrame.instance().setInformation(HOVerwaltung.instance().getLanguageString("ls.update_status.match_info"), 20); + HOMainFrame.instance().setInformation(TranslationFacility.tr("ls.update_status.match_info"), 20); List matches = XMLMatchArchivParser .parseMatchesFromString(matchesString); @@ -184,7 +176,7 @@ public static List getMatchArchive(int teamId, HODateTime firstDa // Store in the db if store is true if (store && (!allMatches.isEmpty())) { - HOMainFrame.instance().setInformation(HOVerwaltung.instance().getLanguageString("ls.update_status.match_info"), 20); + HOMainFrame.instance().setInformation(TranslationFacility.tr("ls.update_status.match_info"), 20); DBManager.instance().storeMatchKurzInfos(allMatches); // Store full info for all matches @@ -974,7 +966,7 @@ private static void saveHRFToFile(JDialog parent, String hrfData) { int value = JOptionPane.OK_OPTION; if (file.exists()) { value = JOptionPane.showConfirmDialog(HOMainFrame.instance(), - getLangString("overwrite"), HOVerwaltung.instance().getLanguageString("confirmation.title"), JOptionPane.YES_NO_OPTION); + getLangString("overwrite"), TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); } // Save @@ -983,7 +975,7 @@ private static void saveHRFToFile(JDialog parent, String hrfData) { saveFile(file.getPath(), hrfData); } catch (IOException e) { Helper.showMessage(HOMainFrame.instance(), - HOVerwaltung.instance().getLanguageString("Show_SaveHRF_Failed") + " " + file.getParentFile() + ".\nError: " + e.getMessage(), + TranslationFacility.tr("Show_SaveHRF_Failed") + " " + file.getParentFile() + ".\nError: " + e.getMessage(), getLangString("Fehler"), JOptionPane.ERROR_MESSAGE); } } else { @@ -1038,7 +1030,7 @@ private static File askForHRFPath(JDialog parent, File file) { fileChooser.setDialogTitle(getLangString("FileExport")); ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("hrf"); - filter.setDescription(HOVerwaltung.instance().getLanguageString("filetypedescription.hrf")); + filter.setDescription(TranslationFacility.tr("filetypedescription.hrf")); fileChooser.setFileFilter(filter); File path = file.getParentFile(); if (path.exists() && path.isDirectory()) { @@ -1082,14 +1074,14 @@ private static void setInfoMsg(String msg, Color color) { } /** - * Convenience method for HOVerwaltung.instance().getLanguageString(key) + * Convenience method for TranslationFacility.tr(key) * * @param key * the key for the language string * @return the string for the current language */ private static String getLangString(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } /** diff --git a/src/main/java/core/net/login/OAuthDialog.java b/src/main/java/core/net/login/OAuthDialog.java index 77153d561..e8e116556 100644 --- a/src/main/java/core/net/login/OAuthDialog.java +++ b/src/main/java/core/net/login/OAuthDialog.java @@ -5,7 +5,7 @@ import com.github.scribejava.core.oauth.OAuth10aService; import core.gui.HOMainFrame; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.util.BrowserLauncher; import core.util.HOLogger; @@ -42,7 +42,7 @@ public class OAuthDialog extends JDialog { private String scopes; public OAuthDialog(HOMainFrame mainFrame, OAuth10aService service, String scope) { - super(mainFrame, HOVerwaltung.instance().getLanguageString( + super(mainFrame, TranslationFacility.tr( "oauth.Title"), true); this.m_clMainFrame = mainFrame; @@ -96,9 +96,9 @@ public OAuth1AccessToken getAccessToken() { @Override public void setVisible(boolean b) { if (!m_bFirstTry) { - JOptionPane.showMessageDialog(null, HOVerwaltung.instance() - .getLanguageString("oauth.FailedTry"), HOVerwaltung - .instance().getLanguageString("oauth.FailedTryHeader"), + JOptionPane.showMessageDialog(null, + TranslationFacility.tr("oauth.FailedTry"), + TranslationFacility.tr("oauth.FailedTryHeader"), JOptionPane.INFORMATION_MESSAGE); m_jtfAuthString.setText(""); } @@ -154,7 +154,7 @@ private void initComponents() { constraints.insets = new Insets(2, 2, 2, 2); JLabel infoLabel = new JLabel(); - infoLabel.setText(HOVerwaltung.instance().getLanguageString( + infoLabel.setText(TranslationFacility.tr( "oauth.Intro")); constraints.gridx = 0; constraints.gridy = 0; @@ -170,7 +170,7 @@ private void initComponents() { panel.add(spacer, constraints); JLabel authLink = new JLabel(); - authLink.setText(HOVerwaltung.instance().getLanguageString( + authLink.setText(TranslationFacility.tr( "oauth.URLOrButton")); constraints.gridx = 0; @@ -178,7 +178,7 @@ private void initComponents() { constraints.gridwidth = 2; panel.add(authLink, constraints); - m_jbBrowse.setText(HOVerwaltung.instance().getLanguageString( + m_jbBrowse.setText(TranslationFacility.tr( "oauth.OpenUrl")); m_jbBrowse.setSize(170, 35); m_jbBrowse.setEnabled(true); @@ -196,7 +196,7 @@ private void initComponents() { panel.add(m_jtfAuthURL, constraints); JLabel authInput = new JLabel(); - authInput.setText(HOVerwaltung.instance().getLanguageString( + authInput.setText(TranslationFacility.tr( "oauth.EnterCode")); constraints.gridx = 0; constraints.gridy = 5; @@ -208,7 +208,7 @@ private void initComponents() { constraints.gridwidth = 2; panel.add(m_jtfAuthString, constraints); - m_jbOK.setText(HOVerwaltung.instance().getLanguageString("ls.button.ok")); + m_jbOK.setText(TranslationFacility.tr("ls.button.ok")); m_jbOK.setSize(170, 35); constraints.gridx = 0; constraints.gridy = 7; @@ -216,7 +216,7 @@ private void initComponents() { constraints.fill = GridBagConstraints.NONE; panel.add(m_jbOK, constraints); - m_jbCancel.setText(HOVerwaltung.instance().getLanguageString( + m_jbCancel.setText(TranslationFacility.tr( "ls.button.cancel")); m_jbCancel.setEnabled(true); constraints.gridx = 1; diff --git a/src/main/java/core/net/login/ProxyDialog.java b/src/main/java/core/net/login/ProxyDialog.java index 2ba943f56..97f84b73d 100644 --- a/src/main/java/core/net/login/ProxyDialog.java +++ b/src/main/java/core/net/login/ProxyDialog.java @@ -4,34 +4,16 @@ import core.gui.HOMainFrame; import core.gui.comp.NumericDocument; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.net.MyConnector; import core.util.GUIUtils; import core.util.StringUtils; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JPasswordField; -import javax.swing.JTextField; +import javax.swing.*; import javax.swing.border.TitledBorder; +import java.awt.*; +import java.awt.event.*; /** * ProxyDialog @@ -81,8 +63,6 @@ public ProxyDialog(HOMainFrame mainFrame) { * Komponenten des Panels initial setzen */ private void initComponents() { - HOVerwaltung hov = HOVerwaltung.instance(); - setContentPane(new ImagePanel()); getContentPane().setLayout(new BorderLayout()); @@ -97,8 +77,8 @@ private void initComponents() { JPanel panel = new ImagePanel(new GridBagLayout()); useProxyCheckBox - .setToolTipText(hov.getLanguageString("tt_Login_Proxy")); - useProxyCheckBox.setText(hov.getLanguageString("ProxyAktiv")); + .setToolTipText(TranslationFacility.tr("tt_Login_Proxy")); + useProxyCheckBox.setText(TranslationFacility.tr("ProxyAktiv")); useProxyCheckBox.setOpaque(false); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; @@ -108,8 +88,8 @@ private void initComponents() { gbc.insets = new Insets(8, 8, 4, 8); panel.add(useProxyCheckBox, gbc); - JLabel label = new JLabel(hov.getLanguageString("ProxyHost")); - label.setToolTipText(hov.getLanguageString("tt_Login_ProxyHost")); + JLabel label = new JLabel(TranslationFacility.tr("ProxyHost")); + label.setToolTipText(TranslationFacility.tr("tt_Login_ProxyHost")); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 1; @@ -121,8 +101,8 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 4, 8); panel.add(proxyHostTextField, gbc); - label = new JLabel(hov.getLanguageString("ProxyPort")); - label.setToolTipText(hov.getLanguageString("tt_Login_ProxyPort")); + label = new JLabel(TranslationFacility.tr("ProxyPort")); + label.setToolTipText(TranslationFacility.tr("tt_Login_ProxyPort")); gbc.gridx = 0; gbc.gridy = 2; gbc.insets = new Insets(4, 8, 4, 2); @@ -135,9 +115,8 @@ private void initComponents() { panel.add(proxyPortTextField, gbc); // Auth - useProxyAuthCheckBox.setToolTipText(hov - .getLanguageString("tt_Login_ProxyAuth")); - useProxyAuthCheckBox.setText(hov.getLanguageString("ProxyAuthAktiv")); + useProxyAuthCheckBox.setToolTipText(TranslationFacility.tr("tt_Login_ProxyAuth")); + useProxyAuthCheckBox.setText(TranslationFacility.tr("ProxyAuthAktiv")); useProxyAuthCheckBox.setOpaque(false); gbc.gridx = 0; gbc.gridy = 3; @@ -145,8 +124,8 @@ private void initComponents() { gbc.insets = new Insets(8, 8, 4, 8); panel.add(useProxyAuthCheckBox, gbc); - label = new JLabel(hov.getLanguageString("ProxyAuthName")); - label.setToolTipText(hov.getLanguageString("tt_Login_ProxyAuthName")); + label = new JLabel(TranslationFacility.tr("ProxyAuthName")); + label.setToolTipText(TranslationFacility.tr("tt_Login_ProxyAuthName")); label.setLocation(10, 155); label.setSize(185, 25); gbc.gridx = 0; @@ -160,9 +139,8 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 4, 8); panel.add(proxyAuthNameTextField, gbc); - label = new JLabel(hov.getLanguageString("ProxyAuthPassword")); - label.setToolTipText(hov - .getLanguageString("tt_Login_ProxyAuthPassword")); + label = new JLabel(TranslationFacility.tr("ProxyAuthPassword")); + label.setToolTipText(TranslationFacility.tr("tt_Login_ProxyAuthPassword")); gbc.gridx = 0; gbc.gridy = 5; gbc.weighty = 1.0; @@ -174,13 +152,13 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 4, 8); panel.add(proxyPasswordField, gbc); - panel.setBorder(new TitledBorder(hov.getLanguageString("Proxydaten"))); + panel.setBorder(new TitledBorder(TranslationFacility.tr("Proxydaten"))); getContentPane().add(panel, BorderLayout.CENTER); // Buttons JPanel buttonPanel = new ImagePanel(new GridBagLayout()); - okButton.setToolTipText(hov.getLanguageString("tt_Login_Anmelden")); - okButton.setText(hov.getLanguageString("ls.button.save")); + okButton.setToolTipText(TranslationFacility.tr("tt_Login_Anmelden")); + okButton.setText(TranslationFacility.tr("ls.button.save")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.anchor = GridBagConstraints.NORTHEAST; @@ -189,8 +167,8 @@ private void initComponents() { buttonPanel.add(okButton, gbc); cancelButton - .setToolTipText(hov.getLanguageString("tt_Login_Abbrechen")); - cancelButton.setText(hov.getLanguageString("ls.button.cancel")); + .setToolTipText(TranslationFacility.tr("tt_Login_Abbrechen")); + cancelButton.setText(TranslationFacility.tr("ls.button.cancel")); gbc.gridx = 1; gbc.weightx = 0.0; gbc.insets = new Insets(6, 4, 6, 6); diff --git a/src/main/java/core/option/DownloadPanel.java b/src/main/java/core/option/DownloadPanel.java index 657bbc94a..a351fae6f 100644 --- a/src/main/java/core/option/DownloadPanel.java +++ b/src/main/java/core/option/DownloadPanel.java @@ -1,17 +1,12 @@ package core.option; - import core.gui.comp.panel.ImagePanel; +import core.model.TranslationFacility; -import java.awt.Insets; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; - -import javax.swing.JSeparator; -import javax.swing.JCheckBox; -import javax.swing.JLabel; +import javax.swing.*; import javax.swing.event.ChangeEvent; +import java.awt.*; /** @@ -61,16 +56,16 @@ private void initComponents() { placement.insets = new Insets(20, 4, 20, 4); placement.gridx = 0; - m_jchXMLDownload = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("download.teamdata")); - m_jchXMLDownload.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("download.teamdata.tt")); + m_jchXMLDownload = new JCheckBox(TranslationFacility.tr("download.teamdata")); + m_jchXMLDownload.setToolTipText(TranslationFacility.tr("download.teamdata.tt")); m_jchXMLDownload.setOpaque(false); m_jchXMLDownload.setSelected(core.model.UserParameter.temp().xmlDownload); m_jchXMLDownload.addItemListener(this); placement.gridy = 0; add(m_jchXMLDownload, placement); - m_jchCurrentMatchlist = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("download.currentmatches")); - m_jchCurrentMatchlist.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("download.currentmatches.tt")); + m_jchCurrentMatchlist = new JCheckBox(TranslationFacility.tr("download.currentmatches")); + m_jchCurrentMatchlist.setToolTipText(TranslationFacility.tr("download.currentmatches.tt")); m_jchCurrentMatchlist.setOpaque(false); m_jchCurrentMatchlist.setSelected(core.model.UserParameter.temp().downloadCurrentMatchlist); m_jchCurrentMatchlist.addItemListener(this); @@ -78,8 +73,8 @@ private void initComponents() { add(m_jchCurrentMatchlist, placement); - m_jchFixtures = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("download.seriesdata")); - m_jchFixtures.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("download.seriesdata.tt")); + m_jchFixtures = new JCheckBox(TranslationFacility.tr("download.seriesdata")); + m_jchFixtures.setToolTipText(TranslationFacility.tr("download.seriesdata.tt")); m_jchFixtures.setOpaque(false); m_jchFixtures.setSelected(core.model.UserParameter.temp().fixtures); m_jchFixtures.addItemListener(this); @@ -89,8 +84,8 @@ private void initComponents() { placement.gridy = 3; add(new JSeparator(), placement); - m_jchShowSaveDialog = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("Show_SaveHRF_Dialog")); - m_jchShowSaveDialog.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_Show_SaveHRF_Dialog")); + m_jchShowSaveDialog = new JCheckBox(TranslationFacility.tr("Show_SaveHRF_Dialog")); + m_jchShowSaveDialog.setToolTipText(TranslationFacility.tr("tt_Optionen_Show_SaveHRF_Dialog")); m_jchShowSaveDialog.setOpaque(false); m_jchShowSaveDialog.setSelected(core.model.UserParameter.temp().showHRFSaveDialog); m_jchShowSaveDialog.addItemListener(this); diff --git a/src/main/java/core/option/FormelPanel.java b/src/main/java/core/option/FormelPanel.java index b36ddf743..3d6cb3672 100644 --- a/src/main/java/core/option/FormelPanel.java +++ b/src/main/java/core/option/FormelPanel.java @@ -7,24 +7,15 @@ import core.gui.theme.ThemeManager; import core.model.FactorObject; import core.model.FormulaFactors; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; +import javax.swing.*; +import javax.swing.event.ChangeListener; +import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ItemListener; import java.util.Objects; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.event.ChangeListener; - /** @@ -62,8 +53,8 @@ final class FormelPanel extends ImagePanel implements ActionListener, ItemListen public void actionPerformed(java.awt.event.ActionEvent actionEvent) { if (actionEvent.getSource().equals(m_jbResetToDefaults)) { final int value = JOptionPane.showConfirmDialog(this, - HOVerwaltung.instance().getLanguageString("FrageFormelwertReset"), - HOVerwaltung.instance().getLanguageString("confirmation.title"), + TranslationFacility.tr("FrageFormelwertReset"), + TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); if (value == JOptionPane.YES_OPTION) { @@ -79,7 +70,7 @@ public void actionPerformed(java.awt.event.ActionEvent actionEvent) { //Filechooser final javax.swing.JFileChooser fileChooser = new javax.swing.JFileChooser(); fileChooser.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG); - fileChooser.setDialogTitle(HOVerwaltung.instance().getLanguageString("FormelwertImport")); + fileChooser.setDialogTitle(TranslationFacility.tr("FormelwertImport")); final java.io.File pfad = new java.io.File(core.model.UserParameter.temp().hrfImport_HRFPath); @@ -89,7 +80,7 @@ public void actionPerformed(java.awt.event.ActionEvent actionEvent) { final core.file.ExampleFileFilter filter = new core.file.ExampleFileFilter(); filter.addExtension("xml"); - filter.setDescription(HOVerwaltung.instance().getLanguageString("filetypedescription.xml")); + filter.setDescription(TranslationFacility.tr("filetypedescription.xml")); fileChooser.setFileFilter(filter); final int returnVal = fileChooser.showOpenDialog(this); @@ -103,7 +94,7 @@ public void actionPerformed(java.awt.event.ActionEvent actionEvent) { //Filechooser final javax.swing.JFileChooser fileChooser = new javax.swing.JFileChooser(); fileChooser.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG); - fileChooser.setDialogTitle(HOVerwaltung.instance().getLanguageString("FormelwertExport")); + fileChooser.setDialogTitle(TranslationFacility.tr("FormelwertExport")); final java.io.File pfad = new java.io.File(core.model.UserParameter.temp().hrfImport_HRFPath); @@ -113,7 +104,7 @@ public void actionPerformed(java.awt.event.ActionEvent actionEvent) { final core.file.ExampleFileFilter filter = new core.file.ExampleFileFilter(); filter.addExtension("xml"); - filter.setDescription(HOVerwaltung.instance().getLanguageString("filetypedescription.xml")); + filter.setDescription(TranslationFacility.tr("filetypedescription.xml")); fileChooser.setFileFilter(filter); final int returnVal = fileChooser.showSaveDialog(this); @@ -204,7 +195,7 @@ private void initComponents() { setLayout(layout); - final JLabel label = new JLabel(HOVerwaltung.instance().getLanguageString("Position")); + final JLabel label = new JLabel(TranslationFacility.tr("Position")); constraints.anchor = GridBagConstraints.WEST; constraints.gridx = 0; constraints.gridy = 0; @@ -262,9 +253,9 @@ private void initComponents() { panel.add(m_jpStandard); short NORM_FAKTOR = 52; - m_jpNORMALISATIONFACTOR = new SliderPanel(HOVerwaltung.instance().getLanguageString("Preference.Panel.Formula.NormalisationFactor.Short"), + m_jpNORMALISATIONFACTOR = new SliderPanel(TranslationFacility.tr("Preference.Panel.Formula.NormalisationFactor.Short"), 100, 0, NORM_FAKTOR, 1.0f, 80); - m_jpNORMALISATIONFACTOR.setToolTipText(HOVerwaltung.instance().getLanguageString("Preference.Panel.Formula.NormalisationFactor")); + m_jpNORMALISATIONFACTOR.setToolTipText(TranslationFacility.tr("Preference.Panel.Formula.NormalisationFactor")); m_jpNORMALISATIONFACTOR.addChangeListener(this); panel.add(m_jpNORMALISATIONFACTOR); @@ -277,7 +268,7 @@ private void initComponents() { layout.setConstraints(panel, constraints); add(panel); - m_jbResetToDefaults = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.reset")); + m_jbResetToDefaults = new JButton(TranslationFacility.tr("ls.button.reset")); m_jbResetToDefaults.addActionListener(this); constraints.anchor = GridBagConstraints.WEST; @@ -287,7 +278,7 @@ private void initComponents() { layout.setConstraints(m_jbResetToDefaults, constraints); add(m_jbResetToDefaults); - m_jbImport = new JButton(HOVerwaltung.instance().getLanguageString("FormelwertImport")); + m_jbImport = new JButton(TranslationFacility.tr("FormelwertImport")); m_jbImport.addActionListener(this); constraints.anchor = GridBagConstraints.WEST; @@ -297,7 +288,7 @@ private void initComponents() { layout.setConstraints(m_jbImport, constraints); add(m_jbImport); - m_jbExport = new JButton(HOVerwaltung.instance().getLanguageString("FormelwertExport")); + m_jbExport = new JButton(TranslationFacility.tr("FormelwertExport")); m_jbExport.addActionListener(this); constraints.anchor = GridBagConstraints.WEST; diff --git a/src/main/java/core/option/GeneralSettingsPanel.java b/src/main/java/core/option/GeneralSettingsPanel.java index ad8d0fe5d..b3d0d6329 100644 --- a/src/main/java/core/option/GeneralSettingsPanel.java +++ b/src/main/java/core/option/GeneralSettingsPanel.java @@ -4,33 +4,34 @@ import core.gui.comp.panel.ImagePanel; import core.gui.theme.Theme; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.Translator; import core.model.UserParameter; import core.util.DateTimeUtils; import core.util.HOLogger; +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.time.ZoneId; -import java.util.*; +import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; public final class GeneralSettingsPanel extends ImagePanel implements ChangeListener, ItemListener { public static CBItem[] NB_DECIMALS = {new CBItem("1 (1.2)", 1), new CBItem("2 (1.23)", 2)}; - public CBItem[] DEFAULT_SORTING = {new CBItem(HOVerwaltung.instance().getLanguageString("ls.player.name"), core.model.UserParameter.SORT_NAME), - new CBItem(HOVerwaltung.instance().getLanguageString("BestePosition"), core.model.UserParameter.SORT_BESTPOS), - new CBItem(HOVerwaltung.instance().getLanguageString("Aufgestellt"), core.model.UserParameter.SORT_AUFGESTELLT), - new CBItem(HOVerwaltung.instance().getLanguageString("Gruppe"), core.model.UserParameter.SORT_GRUPPE), - new CBItem(HOVerwaltung.instance().getLanguageString("Rating"), core.model.UserParameter.SORT_BEWERTUNG),}; + public CBItem[] DEFAULT_SORTING = {new CBItem(TranslationFacility.tr("ls.player.name"), core.model.UserParameter.SORT_NAME), + new CBItem(TranslationFacility.tr("BestePosition"), core.model.UserParameter.SORT_BESTPOS), + new CBItem(TranslationFacility.tr("Aufgestellt"), core.model.UserParameter.SORT_AUFGESTELLT), + new CBItem(TranslationFacility.tr("Gruppe"), core.model.UserParameter.SORT_GRUPPE), + new CBItem(TranslationFacility.tr("Rating"), core.model.UserParameter.SORT_BEWERTUNG),}; private ComboBoxPanel m_jcbNbDecimals; @@ -97,15 +98,15 @@ private void initComponents() { var width = UserParameter.instance().fontSize * 10; - m_jslFontSize = new SliderPanel(HOVerwaltung.instance().getLanguageString("Schriftgroesse"), 16, 8, 1, 1.0f, width); - m_jslFontSize.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Optionen_Schriftgroesse")); + m_jslFontSize = new SliderPanel(TranslationFacility.tr("Schriftgroesse"), 16, 8, 1, 1.0f, width); + m_jslFontSize.setToolTipText(TranslationFacility.tr("tt_Optionen_Schriftgroesse")); m_jslFontSize.setValue(core.model.UserParameter.temp().fontSize); m_jslFontSize.addChangeListener(this); add(m_jslFontSize); List registeredThemes = ThemeManager.instance().getRegisteredThemes(); m_jcbSkin = new ComboBoxPanel( - HOVerwaltung.instance().getLanguageString("options.misc.skin"), + TranslationFacility.tr("options.misc.skin"), registeredThemes.stream().map(Theme::getName).toArray(), width ); @@ -118,15 +119,15 @@ private void initComponents() { java.util.Arrays.sort(sprachdateien); } catch (Exception ignored) { } - m_jcbLanguage = new ComboBoxPanel(HOVerwaltung.instance().getLanguageString("ls.core.preferences.misc.language"), sprachdateien, width); - m_jcbLanguage.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Optionen_Sprachdatei")); + m_jcbLanguage = new ComboBoxPanel(TranslationFacility.tr("ls.core.preferences.misc.language"), sprachdateien, width); + m_jcbLanguage.setToolTipText(TranslationFacility.tr("tt_Optionen_Sprachdatei")); m_jcbLanguage.setSelectedItem(core.model.UserParameter.temp().sprachDatei); m_jcbLanguage.addItemListener(this); add(m_jcbLanguage); // TimeZone selection ========================================================= CBItem[] allZoneIdsAndItsOffSet = getAllZoneIdsAndItsOffSet(); - m_jcbTimeZone = new ComboBoxPanel(HOVerwaltung.instance().getLanguageString("ls.core.preferences.misc.timezone"), allZoneIdsAndItsOffSet, width); + m_jcbTimeZone = new ComboBoxPanel(TranslationFacility.tr("ls.core.preferences.misc.timezone"), allZoneIdsAndItsOffSet, width); var sZoneIDs = ZoneId.getAvailableZoneIds(); var sZoneIDCodes = sZoneIDs.stream().map(String::hashCode).collect(Collectors.toSet()); if (sZoneIDs.size() != sZoneIDCodes.size()){ @@ -150,33 +151,33 @@ private void initComponents() { m_jcbTimeZone.addItemListener(this); add(m_jcbTimeZone); - m_jcbDefaultSorting = new ComboBoxPanel(HOVerwaltung.instance().getLanguageString("Defaultsortierung"), DEFAULT_SORTING, width); - m_jcbDefaultSorting.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Optionen_Defaultsortierung")); + m_jcbDefaultSorting = new ComboBoxPanel(TranslationFacility.tr("Defaultsortierung"), DEFAULT_SORTING, width); + m_jcbDefaultSorting.setToolTipText(TranslationFacility.tr("tt_Optionen_Defaultsortierung")); m_jcbDefaultSorting.setSelectedId(core.model.UserParameter.temp().standardsortierung); m_jcbDefaultSorting.addItemListener(this); add(m_jcbDefaultSorting); - m_jcbNbDecimals = new ComboBoxPanel(HOVerwaltung.instance().getLanguageString("ls.core.preferences.misc.nb_decimals"), NB_DECIMALS, width); - m_jcbNbDecimals.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Optionen_Nachkommastellen")); + m_jcbNbDecimals = new ComboBoxPanel(TranslationFacility.tr("ls.core.preferences.misc.nb_decimals"), NB_DECIMALS, width); + m_jcbNbDecimals.setToolTipText(TranslationFacility.tr("tt_Optionen_Nachkommastellen")); m_jcbNbDecimals.setSelectedId(core.model.UserParameter.temp().nbDecimals); m_jcbNbDecimals.addItemListener(this); add(m_jcbNbDecimals); - m_jchShowSkillNumericalValue = new JCheckBox(HOVerwaltung.instance().getLanguageString("SkillZahlen") + " : " - + HOVerwaltung.instance().getLanguageString("ls.player.skill.value.passable") + " (6)"); - m_jchShowSkillNumericalValue.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Optionen_SkillZahlen")); + m_jchShowSkillNumericalValue = new JCheckBox(TranslationFacility.tr("SkillZahlen") + " : " + + TranslationFacility.tr("ls.player.skill.value.passable") + " (6)"); + m_jchShowSkillNumericalValue.setToolTipText(TranslationFacility.tr("tt_Optionen_SkillZahlen")); m_jchShowSkillNumericalValue.setOpaque(false); m_jchShowSkillNumericalValue.setSelected(core.model.UserParameter.temp().zahlenFuerSkill); m_jchShowSkillNumericalValue.addItemListener(this); add(m_jchShowSkillNumericalValue); - m_jslAlternativePositionsTolerance = new SliderPanel(HOVerwaltung.instance().getLanguageString("options.Alternative_Position_Tolerance"), 100, -1, 100, 1f, width); - m_jslAlternativePositionsTolerance.setToolTipText(HOVerwaltung.instance().getLanguageString("options.tt_Alternative_Position_Tolerance")); + m_jslAlternativePositionsTolerance = new SliderPanel(TranslationFacility.tr("options.Alternative_Position_Tolerance"), 100, -1, 100, 1f, width); + m_jslAlternativePositionsTolerance.setToolTipText(TranslationFacility.tr("options.tt_Alternative_Position_Tolerance")); m_jslAlternativePositionsTolerance.setValue(UserParameter.temp().alternativePositionsTolerance); m_jslAlternativePositionsTolerance.addChangeListener(this); add(m_jslAlternativePositionsTolerance); - m_jcbPromotionStatusTest = new JCheckBox(HOVerwaltung.instance().getLanguageString("PMStatusTest")); + m_jcbPromotionStatusTest = new JCheckBox(TranslationFacility.tr("PMStatusTest")); m_jcbPromotionStatusTest.setOpaque(false); m_jcbPromotionStatusTest.setSelected(UserParameter.temp().promotionManagerTest); m_jcbPromotionStatusTest.addItemListener(this); diff --git a/src/main/java/core/option/LineupSettingsPanel.java b/src/main/java/core/option/LineupSettingsPanel.java index 09beb45c8..c5dccdca6 100644 --- a/src/main/java/core/option/LineupSettingsPanel.java +++ b/src/main/java/core/option/LineupSettingsPanel.java @@ -2,8 +2,9 @@ import core.datatype.CBItem; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; + import javax.swing.*; import java.awt.*; import java.awt.event.ItemEvent; @@ -12,20 +13,20 @@ public final class LineupSettingsPanel extends ImagePanel implements ItemListener { private static CBItem[] orientationSetting = { - new CBItem(HOVerwaltung.instance().getLanguageString("ls.lineupsettings.goalkeeperattop"), UserParameter.GOALKEEPER_AT_TOP), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.lineupsettings.goalkeeperatbottom"), UserParameter.GOALKEEPER_AT_BOTTOM) + new CBItem(TranslationFacility.tr("ls.lineupsettings.goalkeeperattop"), UserParameter.GOALKEEPER_AT_TOP), + new CBItem(TranslationFacility.tr("ls.lineupsettings.goalkeeperatbottom"), UserParameter.GOALKEEPER_AT_BOTTOM) }; private static CBItem[] positionNameSetting = { - new CBItem(HOVerwaltung.instance().getLanguageString("ls.lineupsettings.positionnames.short"), UserParameter.POSITIONNAMES_SHORT), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.lineupsettings.positionnames.long"), UserParameter.POSITIONNAMES_LONG) + new CBItem(TranslationFacility.tr("ls.lineupsettings.positionnames.short"), UserParameter.POSITIONNAMES_SHORT), + new CBItem(TranslationFacility.tr("ls.lineupsettings.positionnames.long"), UserParameter.POSITIONNAMES_LONG) }; /* TODO: check usability (option settings versus toggle box in lineup rating panel prediction list needs to be dynamic (loaded from prediction/predictionTypes.conf) private static CBItem[] ratingPredictionModelSetting = { - new CBItem(HOVerwaltung.instance().getLanguageString("ls.lineupsettings.ratingpredictionmodel.new"), UserParameter.RATINGPREDICTIONMODEL_NEW), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.lineupsettings.ratingpredictionmodel.old"), UserParameter.RATINGPREDICTIONMODEL_OLD) + new CBItem(TranslationFacility.tr("ls.lineupsettings.ratingpredictionmodel.new"), UserParameter.RATINGPREDICTIONMODEL_NEW), + new CBItem(TranslationFacility.tr("ls.lineupsettings.ratingpredictionmodel.old"), UserParameter.RATINGPREDICTIONMODEL_OLD) }; */ @@ -80,8 +81,8 @@ private void initComponents() { } private ComboBoxPanel addLineupSettingComboBox( String languageKey, CBItem[] cbItems, int settingValue) { - var comboBoxPanel = new ComboBoxPanel(HOVerwaltung.instance().getLanguageString("ls.lineupsettings."+ languageKey), cbItems, 120 ); - comboBoxPanel.setToolTipText(HOVerwaltung.instance().getLanguageString("ls.lineupsettings."+ languageKey + ".tooltip")); + var comboBoxPanel = new ComboBoxPanel(TranslationFacility.tr("ls.lineupsettings."+ languageKey), cbItems, 120 ); + comboBoxPanel.setToolTipText(TranslationFacility.tr("ls.lineupsettings."+ languageKey + ".tooltip")); comboBoxPanel.setSelectedId(settingValue); comboBoxPanel.addItemListener(this); add(comboBoxPanel); diff --git a/src/main/java/core/option/OptionenDialog.java b/src/main/java/core/option/OptionenDialog.java index d0a34d1f0..c6944f064 100644 --- a/src/main/java/core/option/OptionenDialog.java +++ b/src/main/java/core/option/OptionenDialog.java @@ -3,19 +3,18 @@ import core.gui.HOMainFrame; import core.gui.RefreshManager; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.module.ModuleConfigPanel; import core.module.ModuleManager; import core.module.config.ModuleConfig; import core.util.Helper; import core.util.Updater; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Font; + +import javax.swing.*; +import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.swing.*; /** * A dialog for all HO options/preferences @@ -28,10 +27,11 @@ public class OptionenDialog extends JDialog { private UserColorsPanel userColorsPanel; public OptionenDialog(JFrame owner) { - super(owner, HOVerwaltung.instance().getLanguageString("ls.menu.file.preferences"), true); + super(owner, TranslationFacility.tr("ls.menu.file.preferences"), true); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); initComponents(); addListeners(); + setLocationByPlatform(true); } private void addListeners() { @@ -56,8 +56,8 @@ public void windowClosing(WindowEvent e) { if (OptionManager.instance().isOptionsChanged()){ // Warning user var choice = JOptionPane.showConfirmDialog(null, - HOVerwaltung.instance().getLanguageString("ls.options.changed.save.question"), - HOVerwaltung.instance().getLanguageString("ls.options.warning"), + TranslationFacility.tr("ls.options.changed.save.question"), + TranslationFacility.tr("ls.options.warning"), JOptionPane.YES_NO_CANCEL_OPTION); if (choice == JOptionPane.YES_OPTION){ save(); @@ -79,34 +79,34 @@ private void initComponents() { // Misc GeneralSettingsPanel m_jpSonstigeOptionen = new GeneralSettingsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Verschiedenes"), new JScrollPane(m_jpSonstigeOptionen)); + tabbedPane.addTab(TranslationFacility.tr("Verschiedenes"), new JScrollPane(m_jpSonstigeOptionen)); // Lineup settings LineupSettingsPanel m_jpLineupSettings = new LineupSettingsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Aufstellung"), new JScrollPane(m_jpLineupSettings)); + tabbedPane.addTab(TranslationFacility.tr("Aufstellung"), new JScrollPane(m_jpLineupSettings)); // Modules - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Module"), new JScrollPane(new ModuleConfigPanel())); + tabbedPane.addTab(TranslationFacility.tr("Module"), new JScrollPane(new ModuleConfigPanel())); // Formula FormelPanel m_jpFormeln = new FormelPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Formeln"), new JScrollPane(m_jpFormeln)); + tabbedPane.addTab(TranslationFacility.tr("Formeln"), new JScrollPane(m_jpFormeln)); // Training TrainingPreferencesPanel m_jpTrainingsOptionen = new TrainingPreferencesPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Training"), new JScrollPane(m_jpTrainingsOptionen)); + tabbedPane.addTab(TranslationFacility.tr("Training"), new JScrollPane(m_jpTrainingsOptionen)); // Release Channels m_jpReleaseChannelsPanel = new ReleaseChannelPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("options.tabtitle.release_channels"), new JScrollPane(m_jpReleaseChannelsPanel)); + tabbedPane.addTab(TranslationFacility.tr("options.tabtitle.release_channels"), new JScrollPane(m_jpReleaseChannelsPanel)); // Columns UserColumnsPanel m_jpUserColumns = new UserColumnsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("columns"), new JScrollPane(m_jpUserColumns)); + tabbedPane.addTab(TranslationFacility.tr("columns"), new JScrollPane(m_jpUserColumns)); // Colors userColorsPanel = new UserColorsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("colors"), new JScrollPane(userColorsPanel)); + tabbedPane.addTab(TranslationFacility.tr("colors"), new JScrollPane(userColorsPanel)); // Colors @@ -122,11 +122,11 @@ private void initComponents() { ImagePanel buttonPanel = new ImagePanel(); // Add Buttons saveButton = new JButton(); - saveButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.save")); + saveButton.setText(TranslationFacility.tr("ls.button.save")); saveButton.setFont(saveButton.getFont().deriveFont(Font.BOLD)); buttonPanel.add(saveButton); cancelButton = new JButton(); - cancelButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + cancelButton.setText(TranslationFacility.tr("ls.button.cancel")); buttonPanel.add(cancelButton); getContentPane().add(buttonPanel, BorderLayout.SOUTH); @@ -161,7 +161,7 @@ private void save() { if (OptionManager.instance().isRestartNeeded()) { Helper.showMessage(OptionenDialog.this, - HOVerwaltung.instance().getLanguageString("NeustartErforderlich"), "", + TranslationFacility.tr("NeustartErforderlich"), "", JOptionPane.INFORMATION_MESSAGE); } if (OptionManager.instance().isReInitNeeded()) { diff --git a/src/main/java/core/option/ReleaseChannelPanel.java b/src/main/java/core/option/ReleaseChannelPanel.java index b9efc5ba0..3bde250cb 100644 --- a/src/main/java/core/option/ReleaseChannelPanel.java +++ b/src/main/java/core/option/ReleaseChannelPanel.java @@ -1,7 +1,7 @@ package core.option; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.util.Updater; @@ -24,7 +24,7 @@ public final class ReleaseChannelPanel extends ImagePanel { private final JRadioButton m_jrb_Beta = new JRadioButton(Updater.ReleaseChannel.BETA.label, false); private final JRadioButton m_jrb_Dev = new JRadioButton(Updater.ReleaseChannel.DEV.label, false); private final ButtonGroup m_bg_ButtonGroup = new ButtonGroup(); - private final JLabel m_jl_PleaseSelect = new JLabel(HOVerwaltung.instance().getLanguageString("options.release_channels_pleaseSelect")); + private final JLabel m_jl_PleaseSelect = new JLabel(TranslationFacility.tr("options.release_channels_pleaseSelect")); private final JTextArea m_jta_Description = new JTextArea("", 8, 1); private Updater.ReleaseChannel rc; private JCheckBox m_jchUpdateCheck; @@ -49,7 +49,7 @@ public void itemStateChanged(ItemEvent itemEvent) { ReleaseChannelLabel = source.getText(); core.model.UserParameter.temp().ReleaseChannel = ReleaseChannelLabel; m_jta_Description.setText( - core.model.HOVerwaltung.instance().getLanguageString("options.release_channels_" + + TranslationFacility.tr("options.release_channels_" + source.getText().toUpperCase(Locale.ENGLISH) + "_desc") ); rc = Updater.ReleaseChannel.byLabel(ReleaseChannelLabel); @@ -111,8 +111,8 @@ private void initComponents() { placement.gridy = 2; add(m_jta_Description, placement); - m_jchUpdateCheck = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("UpdateCheck")); - m_jchUpdateCheck.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_UpdateCheck")); + m_jchUpdateCheck = new JCheckBox(TranslationFacility.tr("UpdateCheck")); + m_jchUpdateCheck.setToolTipText(TranslationFacility.tr("tt_Optionen_UpdateCheck")); m_jchUpdateCheck.setSelected(UserParameter.instance().updateCheck); m_jchUpdateCheck.setOpaque(false); m_jchUpdateCheck.setEnabled(true); diff --git a/src/main/java/core/option/TabOptionenPanel.java b/src/main/java/core/option/TabOptionenPanel.java index 947e94755..0ee5f28d1 100644 --- a/src/main/java/core/option/TabOptionenPanel.java +++ b/src/main/java/core/option/TabOptionenPanel.java @@ -3,12 +3,12 @@ import core.gui.comp.panel.ImagePanel; +import core.model.TranslationFacility; -import java.awt.GridLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ItemEvent; -import javax.swing.JCheckBox; - /** * Alle weiteren Optionen, die Keine Formeln sind @@ -60,54 +60,54 @@ public final void itemStateChanged(ItemEvent itemEvent) { private void initComponents() { setLayout(new GridLayout(9, 1, 4, 4)); - // m_jcbHTIP= new ComboBoxPanel( model.HOVerwaltung.instance().getLanguageString( "Hattrick" ), HT_IP_ADRESSEN, 120 ); + // m_jcbHTIP= new ComboBoxPanel( model.TranslationFacility.tr( "Hattrick" ), HT_IP_ADRESSEN, 120 ); // m_jcbHTIP.setSelectedItem ( gui.UserParameter.temp ().htip ); // m_jcbHTIP.addItemListener ( this ); // add( m_jcbHTIP ); - m_jchSpieleruebersicht = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("Spieleruebersicht")); - m_jchSpieleruebersicht.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_TabManagement")); + m_jchSpieleruebersicht = new JCheckBox(TranslationFacility.tr("Spieleruebersicht")); + m_jchSpieleruebersicht.setToolTipText(TranslationFacility.tr("tt_Optionen_TabManagement")); m_jchSpieleruebersicht.setOpaque(false); m_jchSpieleruebersicht.setSelected(!core.model.UserParameter.temp().tempTabSpieleruebersicht); m_jchSpieleruebersicht.addItemListener(this); add(m_jchSpieleruebersicht); - m_jchAufstellung = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("Aufstellung")); - m_jchAufstellung.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_TabManagement")); + m_jchAufstellung = new JCheckBox(TranslationFacility.tr("Aufstellung")); + m_jchAufstellung.setToolTipText(TranslationFacility.tr("tt_Optionen_TabManagement")); m_jchAufstellung.setOpaque(false); m_jchAufstellung.setSelected(!core.model.UserParameter.temp().tempTabAufstellung); m_jchAufstellung.addItemListener(this); add(m_jchAufstellung); - m_jchLigatabelle = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("Ligatabelle")); - m_jchLigatabelle.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_TabManagement")); + m_jchLigatabelle = new JCheckBox(TranslationFacility.tr("Ligatabelle")); + m_jchLigatabelle.setToolTipText(TranslationFacility.tr("tt_Optionen_TabManagement")); m_jchLigatabelle.setOpaque(false); m_jchLigatabelle.setSelected(!core.model.UserParameter.temp().tempTabLigatabelle); m_jchLigatabelle.addItemListener(this); add(m_jchLigatabelle); - m_jchSpiele = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("Tab_Title_Matches")); - m_jchSpiele.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_TabManagement")); + m_jchSpiele = new JCheckBox(TranslationFacility.tr("Tab_Title_Matches")); + m_jchSpiele.setToolTipText(TranslationFacility.tr("tt_Optionen_TabManagement")); m_jchSpiele.setOpaque(false); m_jchSpiele.setSelected(!core.model.UserParameter.temp().tempTabSpiele); m_jchSpiele.addItemListener(this); add(m_jchSpiele); - m_jchSpielerAnalyse = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("SpielerAnalyse")); - m_jchSpielerAnalyse.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_TabManagement")); + m_jchSpielerAnalyse = new JCheckBox(TranslationFacility.tr("SpielerAnalyse")); + m_jchSpielerAnalyse.setToolTipText(TranslationFacility.tr("tt_Optionen_TabManagement")); m_jchSpielerAnalyse.setOpaque(false); m_jchSpielerAnalyse.setSelected(!core.model.UserParameter.temp().tempTabSpieleranalyse); m_jchSpielerAnalyse.addItemListener(this); add(m_jchSpielerAnalyse); - m_jchStatistik = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("Statistik")); - m_jchStatistik.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_TabManagement")); + m_jchStatistik = new JCheckBox(TranslationFacility.tr("Statistik")); + m_jchStatistik.setToolTipText(TranslationFacility.tr("tt_Optionen_TabManagement")); m_jchStatistik.setOpaque(false); m_jchStatistik.setSelected(!core.model.UserParameter.temp().tempTabStatistik); m_jchStatistik.addItemListener(this); add(m_jchStatistik); - m_jchInformation = new JCheckBox(core.model.HOVerwaltung.instance().getLanguageString("Verschiedenes")); - m_jchInformation.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString("tt_Optionen_TabManagement")); + m_jchInformation = new JCheckBox(TranslationFacility.tr("Verschiedenes")); + m_jchInformation.setToolTipText(TranslationFacility.tr("tt_Optionen_TabManagement")); m_jchInformation.setOpaque(false); m_jchInformation.setSelected(!core.model.UserParameter.temp().tempTabInformation); m_jchInformation.addItemListener(this); diff --git a/src/main/java/core/option/TrainingPreferencesPanel.java b/src/main/java/core/option/TrainingPreferencesPanel.java index 2fd60015f..19720459e 100644 --- a/src/main/java/core/option/TrainingPreferencesPanel.java +++ b/src/main/java/core/option/TrainingPreferencesPanel.java @@ -1,17 +1,18 @@ package core.option; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.training.SkillDrops; import core.util.Helper; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; + import static module.lineup.LineupPanel.TITLE_FG; /** @@ -32,8 +33,8 @@ final class TrainingPreferencesPanel extends ImagePanel implements ChangeListene // private TrainingAdjustmentPanel m_jtapDefending; // private TrainingAdjustmentPanel m_jtapOsmosis; private SliderPanel m_jslFutureWeeks; - private final JCheckBox m_jcSkillDrops = new JCheckBox(HOVerwaltung.instance().getLanguageString("skillDrops")); - private final JCheckBox m_jcSkillDropsInPrediction = new JCheckBox(HOVerwaltung.instance().getLanguageString("ls.options.training.showSkillDrops")); + private final JCheckBox m_jcSkillDrops = new JCheckBox(TranslationFacility.tr("skillDrops")); + private final JCheckBox m_jcSkillDropsInPrediction = new JCheckBox(TranslationFacility.tr("ls.options.training.showSkillDrops")); TrainingPreferencesPanel() { @@ -78,31 +79,31 @@ private void initComponents() { // add(label); -// m_jtapGoalkeeping = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingtype.goalkeeping"), +// m_jtapGoalkeeping = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingtype.goalkeeping"), // WeeklyTrainingType.instance(TrainingType.GOALKEEPING).getBaseTrainingLength(), UserParameter.temp().TRAINING_OFFSET_GOALKEEPING, this); // add(m_jtapGoalkeeping); // -// m_jtapDefending = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingtype.defending"), +// m_jtapDefending = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingtype.defending"), // WeeklyTrainingType.instance(TrainingType.DEFENDING).getBaseTrainingLength(),UserParameter.temp().TRAINING_OFFSET_DEFENDING, this); // add(m_jtapDefending); // -// m_jtapPlaymaking = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingtype.playmaking"), +// m_jtapPlaymaking = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingtype.playmaking"), // WeeklyTrainingType.instance(TrainingType.PLAYMAKING).getBaseTrainingLength(), UserParameter.temp().TRAINING_OFFSET_PLAYMAKING, this); // add(m_jtapPlaymaking); // -// m_jtapPassing = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingtype.shortpasses"), +// m_jtapPassing = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingtype.shortpasses"), // WeeklyTrainingType.instance(TrainingType.SHORT_PASSES).getBaseTrainingLength(), UserParameter.temp().TRAINING_OFFSET_PASSING, this); // add(m_jtapPassing); // -// m_jtapWinger = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingtype.crossing"), +// m_jtapWinger = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingtype.crossing"), // WeeklyTrainingType.instance(TrainingType.CROSSING_WINGER).getBaseTrainingLength(), UserParameter.temp().TRAINING_OFFSET_WINGER, this); // add(m_jtapWinger); // -// m_jtapScoring = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingtype.scoring"), +// m_jtapScoring = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingtype.scoring"), // WeeklyTrainingType.instance(TrainingType.SCORING).getBaseTrainingLength(), UserParameter.temp().TRAINING_OFFSET_SCORING, this); // add(m_jtapScoring); // -// m_jtapSetPieces = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingtype.setpieces"), +// m_jtapSetPieces = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingtype.setpieces"), // WeeklyTrainingType.instance(TrainingType.SET_PIECES).getBaseTrainingLength(), UserParameter.temp().TRAINING_OFFSET_SETPIECES, this); // add(m_jtapSetPieces); @@ -111,23 +112,23 @@ private void initComponents() { // label.setFont(getFont().deriveFont(Font.BOLD)); // add(label); -// m_jtapOsmosis = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("training.osmosis"), +// m_jtapOsmosis = new TrainingAdjustmentPanel(TranslationFacility.tr("training.osmosis"), // WeeklyTrainingType.OSMOSIS_BASE_PERCENTAGE, UserParameter.temp().TRAINING_OFFSET_OSMOSIS, this); // add(m_jtapOsmosis); // -// m_tapAgeFactor = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.player.age"), +// m_tapAgeFactor = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.player.age"), // WeeklyTrainingType.BASE_AGE_FACTOR, UserParameter.temp().TRAINING_OFFSET_AGE, this); // add(m_tapAgeFactor); // -// m_jtapCoachFactor = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.coachingskill"), +// m_jtapCoachFactor = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.coachingskill"), // WeeklyTrainingType.BASE_COACH_FACTOR, UserParameter.temp().TrainerFaktor, this); // add(m_jtapCoachFactor); // -// m_jtapAssisstantFactor = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("FaktorCoTraineranzahl"), +// m_jtapAssisstantFactor = new TrainingAdjustmentPanel(TranslationFacility.tr("FaktorCoTraineranzahl"), // WeeklyTrainingType.BASE_ASSISTANT_COACH_FACTOR, UserParameter.temp().TRAINING_OFFSET_ASSISTANTS, this); // add(m_jtapAssisstantFactor); // -// m_jtapIntensityFactor = new TrainingAdjustmentPanel(HOVerwaltung.instance().getLanguageString("ls.team.trainingintensity"), +// m_jtapIntensityFactor = new TrainingAdjustmentPanel(TranslationFacility.tr("ls.team.trainingintensity"), // WeeklyTrainingType.BASE_INTENSITY_FACTOR, UserParameter.temp().TRAINING_OFFSET_INTENSITY, this); // add(m_jtapIntensityFactor); @@ -137,8 +138,8 @@ private void initComponents() { add(label); var width = UserParameter.instance().fontSize * 10; - m_jslFutureWeeks = new SliderPanel(HOVerwaltung.instance().getLanguageString("futureWeeks"), 80, 0, 1, 1f, width); - m_jslFutureWeeks.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Optionen_futureWeeks")); + m_jslFutureWeeks = new SliderPanel(TranslationFacility.tr("futureWeeks"), 80, 0, 1, 1f, width); + m_jslFutureWeeks.setToolTipText(TranslationFacility.tr("tt_Optionen_futureWeeks")); m_jslFutureWeeks.setValue(core.model.UserParameter.temp().futureWeeks); m_jslFutureWeeks.addChangeListener(this); add(m_jslFutureWeeks); diff --git a/src/main/java/core/option/UserColorsPanel.java b/src/main/java/core/option/UserColorsPanel.java index 810e63552..676a9b355 100644 --- a/src/main/java/core/option/UserColorsPanel.java +++ b/src/main/java/core/option/UserColorsPanel.java @@ -6,7 +6,7 @@ import core.gui.theme.HOColorName; import core.gui.theme.Theme; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import javax.swing.*; @@ -17,7 +17,7 @@ import java.util.List; import static core.gui.theme.HOColor.areDifferentColors; -import static java.awt.event.ItemEvent.*; +import static java.awt.event.ItemEvent.DESELECTED; import static javax.swing.ListSelectionModel.SINGLE_SELECTION; public class UserColorsPanel extends JPanel { @@ -49,10 +49,10 @@ public boolean isCellEditable(int row, int column) { private final JTable colorTable = new JTable(tableModel); private final String[] columnNames = new String[]{ - HOVerwaltung.instance().getLanguageString("Name"), - HOVerwaltung.instance().getLanguageString("Reference"), - HOVerwaltung.instance().getLanguageString("Value"), - HOVerwaltung.instance().getLanguageString("Default"), + TranslationFacility.tr("Name"), + TranslationFacility.tr("Reference"), + TranslationFacility.tr("Value"), + TranslationFacility.tr("Default"), }; private JPanel tablePanel; private List colors = new ArrayList<>(); diff --git a/src/main/java/core/option/UserColumnsPanel.java b/src/main/java/core/option/UserColumnsPanel.java index 65fb99164..ad48a5a31 100644 --- a/src/main/java/core/option/UserColumnsPanel.java +++ b/src/main/java/core/option/UserColumnsPanel.java @@ -7,17 +7,17 @@ import core.gui.model.UserColumnController; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import tool.updater.TableEditor; import tool.updater.TableModel; import tool.updater.UpdaterCellRenderer; -import java.awt.BorderLayout; -import java.awt.Dimension; + +import javax.swing.*; +import javax.swing.table.TableColumnModel; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serial; -import javax.swing.*; -import javax.swing.table.TableColumnModel; /** @@ -33,7 +33,7 @@ public class UserColumnsPanel extends JPanel implements ActionListener { private static final long serialVersionUID = 1L; private JComboBox m_jcbColumnModel = null; private JTable table = null; - private final String[] columnNames = new String[]{" ", HOVerwaltung.instance().getLanguageString("column")}; + private final String[] columnNames = new String[]{" ", TranslationFacility.tr("column")}; private final Icon lockedImage = ThemeManager.getIcon(HOIconName.LOCKED); protected UserColumnsPanel() { diff --git a/src/main/java/core/option/db/UserAdministrationDialog.java b/src/main/java/core/option/db/UserAdministrationDialog.java index 282aa5432..3d0df4f2d 100644 --- a/src/main/java/core/option/db/UserAdministrationDialog.java +++ b/src/main/java/core/option/db/UserAdministrationDialog.java @@ -5,25 +5,16 @@ import core.db.user.UserManager; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.GUIUtils; import core.util.Helper; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.Window; -import java.io.File; -import java.io.Serial; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; +import javax.swing.*; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableModel; +import java.awt.*; +import java.io.File; +import java.io.Serial; public class UserAdministrationDialog extends JDialog { @@ -91,7 +82,7 @@ private void addListeners() { var success = oldDbDirectory.renameTo(newDbDirectory); if (!success) { JOptionPane.showMessageDialog(null, - HOVerwaltung.instance().getLanguageString("ls.useradministration.rename.error_message"), + TranslationFacility.tr("ls.useradministration.rename.error_message"), "Error", JOptionPane.ERROR_MESSAGE); editUser.setDbName(oldDbName); // reset db name @@ -105,7 +96,7 @@ private void addListeners() { } else if (isLoggedIn) { // restart HO to use new database Helper.showMessage(null, - HOVerwaltung.instance().getLanguageString("NeustartErforderlich"), "", + TranslationFacility.tr("NeustartErforderlich"), "", JOptionPane.INFORMATION_MESSAGE); } saveAndReload(); @@ -137,7 +128,7 @@ private void saveAndReload() { } private void initComponents() { - setTitle(HOVerwaltung.instance().getLanguageString("ls.menu.file.database.dbuseradministration")); + setTitle(TranslationFacility.tr("ls.menu.file.database.dbuseradministration")); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); @@ -155,7 +146,7 @@ private void initComponents() { add(getButtonPanel(), gbc); this.closeButton = new JButton(); - this.closeButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.close")); + this.closeButton.setText(TranslationFacility.tr("ls.button.close")); gbc.gridy = 2; gbc.gridx = 0; gbc.gridwidth = 2; @@ -169,7 +160,7 @@ private JPanel getButtonPanel() { JPanel buttonPanel = new JPanel(new GridBagLayout()); this.newButton = new JButton(); - this.newButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.add")); + this.newButton.setText(TranslationFacility.tr("ls.button.add")); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0; gbc.anchor = GridBagConstraints.NORTHWEST; @@ -177,7 +168,7 @@ private JPanel getButtonPanel() { buttonPanel.add(this.newButton, gbc); this.editButton = new JButton(); - this.editButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.edit")); + this.editButton.setText(TranslationFacility.tr("ls.button.edit")); this.editButton.setEnabled(false); gbc.gridy++; gbc.insets = new Insets(2, 4, 2, 4); @@ -197,7 +188,7 @@ private JPanel getButtonPanel() { buttonPanel.add(this.moveDownButton, gbc); this.deleteButton = new JButton(); - this.deleteButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + this.deleteButton.setText(TranslationFacility.tr("ls.button.delete")); this.deleteButton.setEnabled(false); gbc.gridy++; gbc.weightx = 1.0; @@ -221,9 +212,9 @@ private User getSelectedUser() { private void deleteSelectedUser() { User user = getSelectedUser(); if (user != null) { - int res = JOptionPane.showConfirmDialog(this, HOVerwaltung.instance() - .getLanguageString("db.options.dlg.delete.question", user.getTeamName()), - HOVerwaltung.instance().getLanguageString("confirmation.title"), + int res = JOptionPane.showConfirmDialog(this, + TranslationFacility.tr("db.options.dlg.delete.question", user.getTeamName()), + TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); if (res == JOptionPane.YES_OPTION) { UserManager.instance().getAllUser().remove(user); @@ -252,10 +243,10 @@ private static class MyTableModel extends AbstractTableModel { @Serial private static final long serialVersionUID = 1975023278731081088L; private final String[] columnNames = new String[] { - HOVerwaltung.instance().getLanguageString("teamSelect.teamName"), - HOVerwaltung.instance().getLanguageString("db.options.dlg.label.dbName"), - HOVerwaltung.instance().getLanguageString("db.options.dlg.label.zips"), - HOVerwaltung.instance().getLanguageString("db.options.dlg.label.nt") + TranslationFacility.tr("teamSelect.teamName"), + TranslationFacility.tr("db.options.dlg.label.dbName"), + TranslationFacility.tr("db.options.dlg.label.zips"), + TranslationFacility.tr("db.options.dlg.label.nt") }; @Override @@ -270,9 +261,9 @@ public Object getValueAt(int row, int column) { return user.getNumberOfBackups(); case 3: if (user.isNtTeam()) - return HOVerwaltung.instance().getLanguageString("ls.button.yes"); + return TranslationFacility.tr("ls.button.yes"); else - return HOVerwaltung.instance().getLanguageString("ls.button.no"); + return TranslationFacility.tr("ls.button.no"); } return null; } diff --git a/src/main/java/core/option/db/UserEditDialog.java b/src/main/java/core/option/db/UserEditDialog.java index 49dabd253..88a904971 100644 --- a/src/main/java/core/option/db/UserEditDialog.java +++ b/src/main/java/core/option/db/UserEditDialog.java @@ -2,25 +2,20 @@ import core.db.user.User; import core.gui.comp.NumericDocument; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.GUIUtils; import core.util.StringUtils; import org.jetbrains.annotations.Nullable; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.Window; +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.Serial; -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - public class UserEditDialog extends JDialog { private JButton saveButton; @@ -101,7 +96,7 @@ private JPanel getButtonPanel() { gbc.weightx = 1; gbc.insets = new Insets(6, 6, 6, 2); this.saveButton = new JButton(); - this.saveButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.save")); + this.saveButton.setText(getLangStr("ls.button.save")); this.saveButton.setEnabled(false); buttonPanel.add(this.saveButton, gbc); @@ -109,7 +104,7 @@ private JPanel getButtonPanel() { gbc.weightx = 0; gbc.insets = new Insets(6, 2, 6, 6); this.cancelButton = new JButton(); - this.cancelButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + this.cancelButton.setText(getLangStr("ls.button.cancel")); buttonPanel.add(this.cancelButton, gbc); GUIUtils.equalizeComponentSizes(this.saveButton, this.cancelButton); @@ -179,9 +174,9 @@ private JPanel getContentPanel() { gbc.gridwidth = 1; contentPanel.add(ntTeamLabel, gbc); - ntTeamNo = new JRadioButton(HOVerwaltung.instance().getLanguageString("ls.button.no")); + ntTeamNo = new JRadioButton(getLangStr("ls.button.no")); ntTeamNo.setSelected(true); - ntTeamYes = new JRadioButton(HOVerwaltung.instance().getLanguageString("ls.button.yes")); + ntTeamYes = new JRadioButton(getLangStr("ls.button.yes")); ButtonGroup group = new ButtonGroup(); group.add(ntTeamNo); group.add(ntTeamYes); @@ -269,7 +264,7 @@ private boolean isChanged() { private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } } diff --git a/src/main/java/core/prediction/MatchEnginePanel.java b/src/main/java/core/prediction/MatchEnginePanel.java index 621058559..5243a0297 100644 --- a/src/main/java/core/prediction/MatchEnginePanel.java +++ b/src/main/java/core/prediction/MatchEnginePanel.java @@ -4,34 +4,22 @@ import core.gui.HOMainFrame; import core.gui.comp.panel.ImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.prediction.engine.MatchPredictionManager; import core.prediction.engine.MatchResult; import core.prediction.engine.TeamData; -import core.prediction.engine.TeamRatings; import module.teamAnalyzer.SystemManager; -import module.teamAnalyzer.vo.MatchRating; -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSlider; -import javax.swing.JSplitPane; -import javax.swing.SwingConstants; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - public class MatchEnginePanel extends ImagePanel implements ActionListener { private static final long serialVersionUID = 4911590394636764762L; - JButton m_jbButton = new JButton(HOVerwaltung.instance().getLanguageString("Simulate")); + JButton m_jbButton = new JButton(TranslationFacility.tr("Simulate")); private JSlider slider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 0); private MatchResultTable m_jtMatchResultTable; diff --git a/src/main/java/core/prediction/MatchResultTableModel.java b/src/main/java/core/prediction/MatchResultTableModel.java index 931ba2603..00ea8b6e1 100644 --- a/src/main/java/core/prediction/MatchResultTableModel.java +++ b/src/main/java/core/prediction/MatchResultTableModel.java @@ -6,22 +6,18 @@ package core.prediction; import core.gui.comp.entry.ColorLabelEntry; -import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; -import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.prediction.engine.MatchResult; -import java.awt.Color; - -import javax.swing.SwingConstants; +import javax.swing.*; public class MatchResultTableModel extends AbstractMatchTableModel { //~ Instance fields ---------------------------------------------------------------------------- private static final long serialVersionUID = 5568369952809628251L; public static final String[] columnNames = { - HOVerwaltung.instance().getLanguageString("ls.match.result"), - HOVerwaltung.instance().getLanguageString("frequency"), + TranslationFacility.tr("ls.match.result"), + TranslationFacility.tr("frequency"), "" }; //~ Constructors ------------------------------------------------------------------------------- diff --git a/src/main/java/core/prediction/MatchScoreDiffTableModel.java b/src/main/java/core/prediction/MatchScoreDiffTableModel.java index 33078dee2..c6fecbba9 100644 --- a/src/main/java/core/prediction/MatchScoreDiffTableModel.java +++ b/src/main/java/core/prediction/MatchScoreDiffTableModel.java @@ -6,10 +6,10 @@ package core.prediction; import core.gui.comp.entry.ColorLabelEntry; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.prediction.engine.MatchResult; -import javax.swing.SwingConstants; +import javax.swing.*; public class MatchScoreDiffTableModel extends AbstractMatchTableModel { @@ -17,8 +17,8 @@ public class MatchScoreDiffTableModel extends AbstractMatchTableModel { private static final long serialVersionUID = -2114489862284776054L; protected static String[] columnNames = { - HOVerwaltung.instance().getLanguageString("ls.match.result"), - HOVerwaltung.instance().getLanguageString("frequency") + TranslationFacility.tr("ls.match.result"), + TranslationFacility.tr("frequency") }; //~ Constructors ------------------------------------------------------------------------------- @@ -50,11 +50,11 @@ protected void initData() { result[diff + 4] += n; } - String homeWin = HOVerwaltung.instance().getLanguageString("Winby"); - String awayWin = HOVerwaltung.instance().getLanguageString("Lostby"); + String homeWin = TranslationFacility.tr("Winby"); + String awayWin = TranslationFacility.tr("Lostby"); if (!isHomeMatch()) { - awayWin = HOVerwaltung.instance().getLanguageString("Winby"); - homeWin = HOVerwaltung.instance().getLanguageString("Lostby"); + awayWin = TranslationFacility.tr("Winby"); + homeWin = TranslationFacility.tr("Lostby"); } for (int i = 8; i > 4; i--) { @@ -71,7 +71,7 @@ protected void initData() { m_clData[4][0] = new ColorLabelEntry( - HOVerwaltung.instance().getLanguageString("Unendschieden"), + TranslationFacility.tr("Unendschieden"), ColorLabelEntry.FG_STANDARD, ColorLabelEntry.BG_STANDARD, SwingConstants.LEFT); diff --git a/src/main/java/core/prediction/MatchScoreTableModel.java b/src/main/java/core/prediction/MatchScoreTableModel.java index 6c4eeed85..bc8102552 100644 --- a/src/main/java/core/prediction/MatchScoreTableModel.java +++ b/src/main/java/core/prediction/MatchScoreTableModel.java @@ -1,18 +1,19 @@ package core.prediction; import core.gui.comp.entry.ColorLabelEntry; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.prediction.engine.MatchResult; -import javax.swing.SwingConstants; + +import javax.swing.*; public class MatchScoreTableModel extends AbstractMatchTableModel { //~ Instance fields ---------------------------------------------------------------------------- private static final long serialVersionUID = -2007343001155380888L; protected static String[] columnNames = { - HOVerwaltung.instance().getLanguageString("Tore"), - HOVerwaltung.instance().getLanguageString("Heim"), - HOVerwaltung.instance().getLanguageString("Gast")}; + TranslationFacility.tr("Tore"), + TranslationFacility.tr("Heim"), + TranslationFacility.tr("Gast")}; //~ Constructors ------------------------------------------------------------------------------- diff --git a/src/main/java/core/prediction/PredictPanel.java b/src/main/java/core/prediction/PredictPanel.java index 30b3e9d67..9c7a397ca 100644 --- a/src/main/java/core/prediction/PredictPanel.java +++ b/src/main/java/core/prediction/PredictPanel.java @@ -3,21 +3,12 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; +import core.model.TranslationFacility; import core.prediction.engine.MatchResult; import core.util.HOLogger; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; - -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.SwingConstants; +import javax.swing.*; +import java.awt.*; class PredictPanel extends JPanel { @@ -154,7 +145,7 @@ private void initComponents() { constraints.gridx = 0; constraints.gridy = 1; - label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Heim")); + label = new JLabel(TranslationFacility.tr("Heim")); label.setFont(m_jlHomeTeam.getFont().deriveFont(Font.BOLD)); toppanel.add(label, constraints); @@ -165,7 +156,7 @@ private void initComponents() { constraints.gridx = 2; constraints.gridy = 1; - label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Unendschieden")); + label = new JLabel(TranslationFacility.tr("Unendschieden")); label.setFont(m_jlHomeTeam.getFont().deriveFont(Font.BOLD)); toppanel.add(label, constraints); @@ -176,7 +167,7 @@ private void initComponents() { constraints.gridx = 4; constraints.gridy = 1; - label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Gast")); + label = new JLabel(TranslationFacility.tr("Gast")); label.setFont(m_jlHomeTeam.getFont().deriveFont(Font.BOLD)); toppanel.add(label, constraints); @@ -237,7 +228,7 @@ private void initComponents() { constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 1; - label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Gesamt")); + label = new JLabel(TranslationFacility.tr("Gesamt")); bottompanel.add(label, constraints); constraints.gridx = 1; @@ -293,7 +284,7 @@ private void initComponents() { constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 1; - label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Rechts")); + label = new JLabel(TranslationFacility.tr("Rechts")); bottompanel.add(label, constraints); constraints.gridx = 1; @@ -349,7 +340,7 @@ private void initComponents() { constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 1; - label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Mitte")); + label = new JLabel(TranslationFacility.tr("Mitte")); bottompanel.add(label, constraints); constraints.gridx = 1; @@ -405,7 +396,7 @@ private void initComponents() { constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 1; - label = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Links")); + label = new JLabel(TranslationFacility.tr("Links")); bottompanel.add(label, constraints); constraints.gridx = 1; diff --git a/src/main/java/core/prediction/TeamRatingPanel.java b/src/main/java/core/prediction/TeamRatingPanel.java index 0b505bd8a..e1cb77ba4 100644 --- a/src/main/java/core/prediction/TeamRatingPanel.java +++ b/src/main/java/core/prediction/TeamRatingPanel.java @@ -3,24 +3,20 @@ import core.constants.player.PlayerAbility; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.IMatchDetails; import core.model.match.Matchdetails; import core.prediction.engine.TeamData; import core.prediction.engine.TeamRatings; import module.teamAnalyzer.ui.RatingUtil; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; - class TeamRatingPanel extends JPanel implements ItemListener { @@ -53,15 +49,13 @@ class TeamRatingPanel extends JPanel implements ItemListener { setLayout(m_clLayout); final TeamRatings tr = team.getRatings(); - final core.model.HOVerwaltung verwaltung = core.model.HOVerwaltung - .instance(); - addLine(tr.getMidfield(), verwaltung.getLanguageString("ls.match.ratingsector.midfield")); - addLine(tr.getRightDef(), verwaltung.getLanguageString("ls.match.ratingsector.rightdefence")); - addLine(tr.getMiddleDef(), verwaltung.getLanguageString("ls.match.ratingsector.centraldefence")); - addLine(tr.getLeftDef(), verwaltung.getLanguageString("ls.match.ratingsector.leftdefence")); - addLine(tr.getRightAttack(), verwaltung.getLanguageString("ls.match.ratingsector.rightattack")); - addLine(tr.getMiddleAttack(), verwaltung.getLanguageString("ls.match.ratingsector.centralattack")); - addLine(tr.getLeftAttack(), verwaltung.getLanguageString("ls.match.ratingsector.leftattack")); + addLine(tr.getMidfield(), TranslationFacility.tr("ls.match.ratingsector.midfield")); + addLine(tr.getRightDef(), TranslationFacility.tr("ls.match.ratingsector.rightdefence")); + addLine(tr.getMiddleDef(), TranslationFacility.tr("ls.match.ratingsector.centraldefence")); + addLine(tr.getLeftDef(), TranslationFacility.tr("ls.match.ratingsector.leftdefence")); + addLine(tr.getRightAttack(), TranslationFacility.tr("ls.match.ratingsector.rightattack")); + addLine(tr.getMiddleAttack(), TranslationFacility.tr("ls.match.ratingsector.centralattack")); + addLine(tr.getLeftAttack(), TranslationFacility.tr("ls.match.ratingsector.leftattack")); m_clConstraints.gridx = 0; m_clConstraints.gridy = row; @@ -211,10 +205,10 @@ private void initSubLevel() { subLevels = new ArrayList<>(); final HOVerwaltung verwaltung = HOVerwaltung.instance(); - subLevels.add(new RatingItem(verwaltung.getLanguageString("verylow"), 0)); - subLevels.add(new RatingItem(verwaltung.getLanguageString("low"), 1)); - subLevels.add(new RatingItem(verwaltung.getLanguageString("high"), 2)); - subLevels.add(new RatingItem(verwaltung.getLanguageString("veryhigh"), 3)); + subLevels.add(new RatingItem(TranslationFacility.tr("verylow"), 0)); + subLevels.add(new RatingItem(TranslationFacility.tr("low"), 1)); + subLevels.add(new RatingItem(TranslationFacility.tr("high"), 2)); + subLevels.add(new RatingItem(TranslationFacility.tr("veryhigh"), 3)); } private void initLevel(int n) { diff --git a/src/main/java/core/prediction/engine/Action.java b/src/main/java/core/prediction/engine/Action.java index 898978daf..819bdae26 100644 --- a/src/main/java/core/prediction/engine/Action.java +++ b/src/main/java/core/prediction/engine/Action.java @@ -1,5 +1,6 @@ package core.prediction.engine; +import core.model.TranslationFacility; import core.model.match.IMatchDetails; public class Action implements Comparable { @@ -47,25 +48,25 @@ public final String getShortDesc() { final StringBuilder buffer = new StringBuilder(); if (type == IMatchDetails.TAKTIK_KONTER) { - buffer.append(core.model.HOVerwaltung.instance().getLanguageString("Counter")); + buffer.append(TranslationFacility.tr("Counter")); } else { - buffer.append(core.model.HOVerwaltung.instance().getLanguageString("Attack")); + buffer.append(TranslationFacility.tr("Attack")); } buffer.append(" "); if (area == -1) { - buffer.append(core.model.HOVerwaltung.instance().getLanguageString("on_the_left")); + buffer.append(TranslationFacility.tr("on_the_left")); } else if (area == 0) { - buffer.append(core.model.HOVerwaltung.instance().getLanguageString("on_the_middle")); + buffer.append(TranslationFacility.tr("on_the_middle")); } else { - buffer.append(core.model.HOVerwaltung.instance().getLanguageString("on_the_right")); + buffer.append(TranslationFacility.tr("on_the_right")); } buffer.append(". "); if (score) { - buffer.append(core.model.HOVerwaltung.instance().getLanguageString("TOR")); + buffer.append(TranslationFacility.tr("TOR")); buffer.append("!"); } diff --git a/src/main/java/core/rating/RatingPredictionModel.java b/src/main/java/core/rating/RatingPredictionModel.java index 088763208..f5981449f 100644 --- a/src/main/java/core/rating/RatingPredictionModel.java +++ b/src/main/java/core/rating/RatingPredictionModel.java @@ -2,8 +2,8 @@ import core.constants.player.PlayerSkill; import core.constants.player.PlayerSpeciality; -import core.model.HOVerwaltung; import core.model.Team; +import core.model.TranslationFacility; import core.model.match.IMatchDetails; import core.model.match.MatchLineupPosition; import core.model.match.MatchTacticType; @@ -14,13 +14,18 @@ import module.lineup.Lineup; import module.lineup.substitution.model.Substitution; import org.jetbrains.annotations.NotNull; + import java.util.*; + import static core.constants.player.PlayerSkill.*; import static core.model.match.IMatchDetails.*; -import static core.model.player.IMatchRoleID.*; import static core.model.player.IMatchRoleID.KEEPER; import static core.model.player.IMatchRoleID.WINGER; -import static java.lang.Math.*; +import static core.model.player.IMatchRoleID.*; +import static java.lang.Math.max; +import static java.lang.Math.min; +import static java.lang.Math.pow; +import static java.lang.Math.sqrt; import static java.util.Map.entry; /** @@ -199,7 +204,7 @@ private double calcAverageRating(Lineup lineup, RatingSector s, int minutes) { protected double calcSectorRating(Lineup lineup, RatingSector s, int minute) { if (copyrightSchumTranslated == null) { // the author of the formulas"; - copyrightSchumTranslated = "© Schum - " + HOVerwaltung.instance().getLanguageString("ls.copyright.authoroftheformulas"); + copyrightSchumTranslated = "© Schum - " + TranslationFacility.tr("ls.copyright.authoroftheformulas"); } addCopyright(copyrightSchumTranslated); diff --git a/src/main/java/core/specialevents/SpecialEventsPrediction.java b/src/main/java/core/specialevents/SpecialEventsPrediction.java index b5a138b63..c37019647 100644 --- a/src/main/java/core/specialevents/SpecialEventsPrediction.java +++ b/src/main/java/core/specialevents/SpecialEventsPrediction.java @@ -1,13 +1,10 @@ package core.specialevents; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Vector; /** REQUIREMENTS * @@ -410,7 +407,7 @@ public void setGoalProbability(double goalProbability) { } public String getEventTypeAsString() { - return HOVerwaltung.instance().getLanguageString("ls.teamanalyzer." + this.eventType.toString()); + return TranslationFacility.tr("ls.teamanalyzer." + this.eventType.toString()); } public ISpecialEventPredictionAnalyzer.SpecialEventType getEventType() { diff --git a/src/main/java/core/training/FuturePlayerTraining.java b/src/main/java/core/training/FuturePlayerTraining.java index 9bef15e30..be6ff98e2 100644 --- a/src/main/java/core/training/FuturePlayerTraining.java +++ b/src/main/java/core/training/FuturePlayerTraining.java @@ -1,8 +1,9 @@ package core.training; import core.db.AbstractTable; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HODateTime; + import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.HashMap; @@ -86,10 +87,10 @@ public int getValue() { public String toString() { return switch (value) { - case 3 -> HOVerwaltung.instance().getLanguageString("trainpre.fulltrain"); - case 2 -> HOVerwaltung.instance().getLanguageString("trainpre.partialtrain"); - case 1 -> HOVerwaltung.instance().getLanguageString("trainpre.osmosistrain"); - case 0 -> HOVerwaltung.instance().getLanguageString("trainpre.notrain"); + case 3 -> TranslationFacility.tr("trainpre.fulltrain"); + case 2 -> TranslationFacility.tr("trainpre.partialtrain"); + case 1 -> TranslationFacility.tr("trainpre.osmosistrain"); + case 0 -> TranslationFacility.tr("trainpre.notrain"); default -> ""; }; } diff --git a/src/main/java/core/training/TrainingManager.java b/src/main/java/core/training/TrainingManager.java index e1d880b77..7c4e002ea 100644 --- a/src/main/java/core/training/TrainingManager.java +++ b/src/main/java/core/training/TrainingManager.java @@ -3,14 +3,16 @@ import core.db.DBManager; import core.gui.HOMainFrame; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HODateTime; import core.util.HOLogger; + +import javax.swing.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.time.temporal.ChronoUnit; -import java.util.*; +import java.util.List; import java.util.stream.Collectors; -import javax.swing.JOptionPane; /** * Singleton class that holds training information. @@ -115,8 +117,8 @@ public List getHistoricalTrainings() { @Deprecated public void recalcSubskills(boolean showBar) { if (JOptionPane.showConfirmDialog(HOMainFrame.instance(), - HOVerwaltung.instance().getLanguageString("Subskill.Recalc.Full")+"\n"+HOVerwaltung.instance().getLanguageString("subskill.Recalc.Start"), - HOVerwaltung.instance().getLanguageString("ls.menu.file.subskillrecalculation"), JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) { + TranslationFacility.tr("Subskill.Recalc.Full")+"\n"+TranslationFacility.tr("subskill.Recalc.Start"), + TranslationFacility.tr("ls.menu.file.subskillrecalculation"), JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) { HOVerwaltung.instance().recalcSubskills(showBar, null); } } diff --git a/src/main/java/core/training/TrainingPreviewPlayer.java b/src/main/java/core/training/TrainingPreviewPlayer.java index 420369f13..89df263f4 100644 --- a/src/main/java/core/training/TrainingPreviewPlayer.java +++ b/src/main/java/core/training/TrainingPreviewPlayer.java @@ -1,10 +1,8 @@ package core.training; -import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; -import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import javax.swing.*; @@ -149,69 +147,69 @@ else if (iStamina > 0) { */ public String getText() { if (iFullTrain >= FULL_TRAIN_MIN) { - return HOVerwaltung.instance().getLanguageString("trainpre.fulltrain") + ": " + return TranslationFacility.tr("trainpre.fulltrain") + ": " + FULL_TRAIN_MIN + "'"; } else if (iFullTrain > 0 && bFullEstimedTrain) { - return HOVerwaltung.instance().getLanguageString("trainpre.fulltrain") + ": " + return TranslationFacility.tr("trainpre.fulltrain") + ": " + iFullTrain + "'\n" - + HOVerwaltung.instance().getLanguageString("trainpre.fulltrain.estimated") + ": " + + TranslationFacility.tr("trainpre.fulltrain.estimated") + ": " + FULL_TRAIN_MIN + "'"; } else if (bFullEstimedTrain) { - return HOVerwaltung.instance().getLanguageString("trainpre.fulltrain.estimated") + ": " + return TranslationFacility.tr("trainpre.fulltrain.estimated") + ": " + FULL_TRAIN_MIN+ "'"; } else if (iFullTrain > 0 && ((iPartialTrain + iFullTrain) >= FULL_TRAIN_MIN)) { - return HOVerwaltung.instance().getLanguageString("trainpre.fulltrain") + ": " + return TranslationFacility.tr("trainpre.fulltrain") + ": " + iFullTrain + "'\n" - + HOVerwaltung.instance().getLanguageString("trainpre.partialtrain") + ": " + + TranslationFacility.tr("trainpre.partialtrain") + ": " + (FULL_TRAIN_MIN-iFullTrain) + "'"; } else if (iFullTrain > 0 && bPartialEstimedTrain) { - return HOVerwaltung.instance().getLanguageString("trainpre.fulltrain") + ": " + return TranslationFacility.tr("trainpre.fulltrain") + ": " + iFullTrain + "'\n" - + HOVerwaltung.instance().getLanguageString("trainpre.partialtrain.estimated") + ": " + + TranslationFacility.tr("trainpre.partialtrain.estimated") + ": " + (FULL_TRAIN_MIN-iFullTrain) + "'"; } else if (iFullTrain > 0 && iPartialTrain > 0) { - return HOVerwaltung.instance().getLanguageString("trainpre.fulltrain") + ": " + return TranslationFacility.tr("trainpre.fulltrain") + ": " + iFullTrain + "'\n" - + HOVerwaltung.instance().getLanguageString("trainpre.partialtrain") + ": " + + TranslationFacility.tr("trainpre.partialtrain") + ": " + iPartialTrain + "'"; } else if (iFullTrain > 0) { - return HOVerwaltung.instance().getLanguageString("trainpre.fulltrain") + ": " + return TranslationFacility.tr("trainpre.fulltrain") + ": " + iFullTrain + "'"; } else if (iPartialTrain >= FULL_TRAIN_MIN) { - return HOVerwaltung.instance().getLanguageString("trainpre.partialtrain") + ": " + return TranslationFacility.tr("trainpre.partialtrain") + ": " + FULL_TRAIN_MIN + "'"; } else if (iPartialTrain > 0 && bPartialEstimedTrain) { - return HOVerwaltung.instance().getLanguageString("trainpre.partialtrain") + ": " + return TranslationFacility.tr("trainpre.partialtrain") + ": " + iPartialTrain + "'\n" - + HOVerwaltung.instance().getLanguageString("trainpre.partialtrain.estimated") + ": " + + TranslationFacility.tr("trainpre.partialtrain.estimated") + ": " + (FULL_TRAIN_MIN-iPartialTrain) + "'"; } else if (bPartialEstimedTrain) { - return HOVerwaltung.instance().getLanguageString("trainpre.partialtrain.estimated") + ": " + return TranslationFacility.tr("trainpre.partialtrain.estimated") + ": " + FULL_TRAIN_MIN + "'"; } else if (iPartialTrain > 0) { - return HOVerwaltung.instance().getLanguageString("trainpre.partialtrain") + ": " + return TranslationFacility.tr("trainpre.partialtrain") + ": " + iPartialTrain + "'"; } else if (iStamina >= FULL_STAMINA_MIN) { - return HOVerwaltung.instance().getLanguageString("stamina.train") + ": " + return TranslationFacility.tr("stamina.train") + ": " + FULL_STAMINA_MIN + "'"; } else if (bEstimedStamina) { - return HOVerwaltung.instance().getLanguageString("stamina.train.estimated") + ": " + return TranslationFacility.tr("stamina.train.estimated") + ": " + FULL_STAMINA_MIN+ "'"; } else if (iStamina > 0) { - return HOVerwaltung.instance().getLanguageString("stamina.train") + ": " + return TranslationFacility.tr("stamina.train") + ": " + iStamina + "'"; } return null; diff --git a/src/main/java/core/util/Helper.java b/src/main/java/core/util/Helper.java index 49b20af22..5b43674b8 100644 --- a/src/main/java/core/util/Helper.java +++ b/src/main/java/core/util/Helper.java @@ -4,15 +4,17 @@ import core.datatype.CBItem; import core.datatype.ComboItem; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; + +import javax.swing.*; import java.awt.*; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Arrays; import java.util.Vector; -import javax.swing.*; /** * Helper class @@ -207,7 +209,7 @@ public static boolean parseInt(Window parent, JTextField field, boolean negativE final int temp = Integer.parseInt(field.getText()); if (!negativErlaubt && (temp < 0)) { - message = HOVerwaltung.instance().getLanguageString("negativVerboten"); + message = TranslationFacility.tr("negativVerboten"); throw new NumberFormatException(); } @@ -215,11 +217,11 @@ public static boolean parseInt(Window parent, JTextField field, boolean negativE return true; } catch (NumberFormatException nfe) { if (message.equals("")) { - message = HOVerwaltung.instance().getLanguageString("keineZahl"); + message = TranslationFacility.tr("keineZahl"); } showMessage(parent, message, - HOVerwaltung.instance().getLanguageString("Fehler"), JOptionPane.ERROR_MESSAGE); + TranslationFacility.tr("Fehler"), JOptionPane.ERROR_MESSAGE); field.setText(String.valueOf(0)); return false; @@ -464,7 +466,7 @@ public static double getMaxValue(double[] werte) { * @return String, translation */ public static String getTranslation(String key) { - return core.model.HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } /** @@ -474,7 +476,7 @@ public static String getTranslation(String key) { * @return String translation */ public static String getTranslation(String key, Object... messageArguments) { - return core.model.HOVerwaltung.instance().getLanguageString(key, messageArguments); + return TranslationFacility.tr(key, messageArguments); } diff --git a/src/main/java/core/util/StringUtils.java b/src/main/java/core/util/StringUtils.java index fc877a17f..4b9546d7b 100644 --- a/src/main/java/core/util/StringUtils.java +++ b/src/main/java/core/util/StringUtils.java @@ -1,6 +1,7 @@ package core.util; import core.model.HOVerwaltung; +import core.model.TranslationFacility; /** * Utility class for various String related operations. @@ -55,7 +56,7 @@ public static boolean isEmpty(String str) { private static String _separator = null; private static String getSeparator(){ if (_separator==null ) { - _separator = " " + HOVerwaltung.instance().getLanguageString("ls.match.result.separation") + " "; + _separator = " " + TranslationFacility.tr("ls.match.result.separation") + " "; } return _separator; } diff --git a/src/main/java/module/ifa/EmblemPanel.java b/src/main/java/module/ifa/EmblemPanel.java index 3a5173f9f..cd9809d13 100644 --- a/src/main/java/module/ifa/EmblemPanel.java +++ b/src/main/java/module/ifa/EmblemPanel.java @@ -1,26 +1,16 @@ package module.ifa; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.config.ModuleConfig; import module.ifa.config.Config; import module.ifa.model.IfaModel; import module.ifa.model.ModelChangeListener; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Window; +import javax.swing.*; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import javax.swing.ImageIcon; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; - public class EmblemPanel extends JPanel { private static final long serialVersionUID = 5771493941186321587L; @@ -47,7 +37,7 @@ private void initialize() { this.panel.setLayout(new GridBagLayout()); this.panel.setBackground(Color.white); - this.logoLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + this.logoLabel = new JLabel(TranslationFacility.tr( "ifa.loadEmblem.clickHere")); this.logoLabel.setPreferredSize(new Dimension(200, 100)); this.logoLabel.setVerticalAlignment(0); @@ -72,7 +62,7 @@ public void setLogo(ImageIcon image) { this.logoLabel.setPreferredSize(new Dimension(image.getIconWidth(), image .getIconHeight())); } else { - this.logoLabel.setText(HOVerwaltung.instance().getLanguageString( + this.logoLabel.setText(TranslationFacility.tr( "ifa.loadEmblem.clickHere")); this.imagePath = ""; } diff --git a/src/main/java/module/ifa/IfaModule.java b/src/main/java/module/ifa/IfaModule.java index 7efa87b94..bd874ebb3 100644 --- a/src/main/java/module/ifa/IfaModule.java +++ b/src/main/java/module/ifa/IfaModule.java @@ -1,15 +1,12 @@ package module.ifa; -import java.awt.event.KeyEvent; - -import javax.swing.JMenu; -import javax.swing.JPanel; -import javax.swing.KeyStroke; - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; import module.ifa.menu.IFAMenu; +import javax.swing.*; +import java.awt.event.KeyEvent; + public class IfaModule extends DefaultModule { @Override @@ -24,7 +21,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Tab_IFA"); + return TranslationFacility.tr("Tab_IFA"); } @Override diff --git a/src/main/java/module/ifa/IfaOverviewDialog.java b/src/main/java/module/ifa/IfaOverviewDialog.java index d51007e76..4c506aba8 100644 --- a/src/main/java/module/ifa/IfaOverviewDialog.java +++ b/src/main/java/module/ifa/IfaOverviewDialog.java @@ -3,35 +3,24 @@ import core.gui.comp.renderer.DoubleTableCellRenderer; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.WorldDetailLeague; import core.model.WorldDetailsManager; import module.ifa.model.Country; import module.ifa.model.IfaModel; -import java.awt.Component; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.RowSorter; +import javax.swing.*; import javax.swing.RowSorter.SortKey; -import javax.swing.SortOrder; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableRowSorter; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; import static module.ifa.model.IfaModel.APACHE_LEAGUE_ID; @@ -48,7 +37,7 @@ public IfaOverviewDialog(IfaModel model, Frame parent) { } private void initComponents() { - setTitle(HOVerwaltung.instance().getLanguageString("ifa.infoDialog.title")); + setTitle(TranslationFacility.tr("ifa.infoDialog.title")); MyTableModel tblModel = new MyTableModel(); JTable table = new JTable(tblModel); @@ -87,7 +76,7 @@ public int compare(Country o1, Country o2) { table.setRowSorter(sorter); JButton closeButton = new JButton(); - closeButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.close")); + closeButton.setText(TranslationFacility.tr("ls.button.close")); closeButton.addActionListener(new ActionListener() { @Override @@ -141,16 +130,15 @@ private void addEntry(WorldDetailLeague league) { public String getColumnName(int columnIndex) { switch (columnIndex) { case COL_COUNTRY: - return HOVerwaltung.instance().getLanguageString("ifa.statisticsTable.col.country"); + return TranslationFacility.tr("ifa.statisticsTable.col.country"); case COL_ACTIVE_USERS: - return HOVerwaltung.instance().getLanguageString("ifa.infoDialog.col.activeUsers"); + return TranslationFacility.tr("ifa.infoDialog.col.activeUsers"); case COL_COOLNESS: - return HOVerwaltung.instance() - .getLanguageString("ifa.statisticsTable.col.coolness"); + return TranslationFacility.tr("ifa.statisticsTable.col.coolness"); case COL_VISITED: - return HOVerwaltung.instance().getLanguageString("ifa.infoDialog.col.visited"); + return TranslationFacility.tr("ifa.infoDialog.col.visited"); case COL_HOSTED: - return HOVerwaltung.instance().getLanguageString("ifa.infoDialog.col.hosted"); + return TranslationFacility.tr("ifa.infoDialog.col.hosted"); default: return super.getColumnName(columnIndex); } diff --git a/src/main/java/module/ifa/ImageDesignPanel.java b/src/main/java/module/ifa/ImageDesignPanel.java index 9bf6cf312..e0be98921 100644 --- a/src/main/java/module/ifa/ImageDesignPanel.java +++ b/src/main/java/module/ifa/ImageDesignPanel.java @@ -1,34 +1,17 @@ package module.ifa; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.config.ModuleConfig; import module.ifa.config.Config; import module.ifa.model.IfaModel; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.io.File; -import java.math.BigDecimal; - -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSlider; -import javax.swing.JSpinner; -import javax.swing.JTextField; -import javax.swing.SpinnerNumberModel; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.*; +import java.io.File; +import java.math.BigDecimal; public class ImageDesignPanel extends JPanel { @@ -74,7 +57,7 @@ public void setAway(boolean away) { emblemPath = ModuleConfig.instance().getString(Config.VISITED_EMBLEM_PATH.toString(), ""); headerText = ModuleConfig.instance().getString(Config.VISITED_HEADER_TEXT.toString(), - HOVerwaltung.instance().getLanguageString("ifa.visitedHeader.defaultText")); + TranslationFacility.tr("ifa.visitedHeader.defaultText")); brightness = ModuleConfig.instance() .getInteger(Config.VISITED_BRIGHTNESS.toString(), 50); grey = ModuleConfig.instance() @@ -89,7 +72,7 @@ public void setAway(boolean away) { emblemPath = ModuleConfig.instance() .getString(Config.HOSTED_EMBLEM_PATH.toString(), ""); headerText = ModuleConfig.instance().getString(Config.HOSTED_HEADER_TEXT.toString(), - HOVerwaltung.instance().getLanguageString("ifa.hostedHeader.defaultText")); + TranslationFacility.tr("ifa.hostedHeader.defaultText")); brightness = ModuleConfig.instance() .getInteger(Config.HOSTED_BRIGHTNESS.toString(), 50); grey = ModuleConfig.instance().getBoolean(Config.HOSTED_GREY.toString(), Boolean.FALSE); @@ -365,6 +348,6 @@ public void focusLost(FocusEvent arg0) { * @return */ private static String getLangString(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } } diff --git a/src/main/java/module/ifa/PluginIfaPanel.java b/src/main/java/module/ifa/PluginIfaPanel.java index d6b81608e..ec3ffd180 100644 --- a/src/main/java/module/ifa/PluginIfaPanel.java +++ b/src/main/java/module/ifa/PluginIfaPanel.java @@ -1,7 +1,7 @@ package module.ifa; import core.gui.comp.panel.LazyPanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.config.ModuleConfig; import module.ifa.config.Config; import module.ifa.model.Country; @@ -10,10 +10,11 @@ import module.ifa.table.IfaTableModel; import module.ifa.table.SummaryTableSorter; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import javax.swing.RowSorter.SortKey; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; +import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.math.BigDecimal; @@ -21,17 +22,6 @@ import java.util.Comparator; import java.util.List; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTable; -import javax.swing.RowSorter.SortKey; -import javax.swing.SortOrder; -import javax.swing.SwingUtilities; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - public class PluginIfaPanel extends LazyPanel { private static final long serialVersionUID = 3806181337290704445L; @@ -118,10 +108,10 @@ private JPanel createTablePanel(boolean away) { JLabel headerLabel = new JLabel(); if (away) { - headerLabel.setText(HOVerwaltung.instance().getLanguageString( + headerLabel.setText(TranslationFacility.tr( "ifa.statisticsTable.header.away")); } else { - headerLabel.setText(HOVerwaltung.instance().getLanguageString( + headerLabel.setText(TranslationFacility.tr( "ifa.statisticsTable.header.home")); } Font boldFont = headerLabel.getFont().deriveFont( diff --git a/src/main/java/module/ifa/RightPanel.java b/src/main/java/module/ifa/RightPanel.java index 60e3e86a1..88735e63b 100644 --- a/src/main/java/module/ifa/RightPanel.java +++ b/src/main/java/module/ifa/RightPanel.java @@ -3,7 +3,7 @@ import core.db.DBManager; import core.file.xml.XMLManager; import core.file.xml.XMLWorldDetailsParser; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.WorldDetailLeague; import core.model.WorldDetailsManager; import core.net.MyConnector; @@ -13,26 +13,13 @@ import module.ifa.gif.Gif89Encoder; import module.ifa.model.IfaModel; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.image.BufferedImage; import java.io.*; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.SwingUtilities; - import static java.lang.Double.parseDouble; public class RightPanel extends JPanel { @@ -54,15 +41,15 @@ public RightPanel(IfaModel model) { private void initComponents() { setLayout(new GridBagLayout()); - setBorder(BorderFactory.createTitledBorder(HOVerwaltung.instance().getLanguageString( + setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr( "ifa.imageBuilder.title"))); JPanel buttonPanel = new JPanel(); GridBagConstraints gbc = new GridBagConstraints(); - this.updateButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.update")); + this.updateButton = new JButton(TranslationFacility.tr("ls.button.update")); gbc.anchor = GridBagConstraints.EAST; buttonPanel.add(this.updateButton, gbc); - this.saveImageButton = new JButton(HOVerwaltung.instance().getLanguageString("ifa.imageBuilder.button.save")); + this.saveImageButton = new JButton(TranslationFacility.tr("ifa.imageBuilder.button.save")); gbc.gridx = 1; gbc.anchor = GridBagConstraints.WEST; buttonPanel.add(this.saveImageButton, gbc); @@ -73,13 +60,13 @@ private void initComponents() { gbc.gridwidth = 2; add(buttonPanel, gbc); - this.awayRadioButton = new JRadioButton(HOVerwaltung.instance().getLanguageString("ifa.imageBuilder.visited"), true); + this.awayRadioButton = new JRadioButton(TranslationFacility.tr("ifa.imageBuilder.visited"), true); gbc.insets = new Insets(5, 6, 5, 6); gbc.gridy = 1; gbc.gridwidth = 1; add(this.awayRadioButton, gbc); - this.homeRadioButton = new JRadioButton(HOVerwaltung.instance().getLanguageString("ifa.imageBuilder.hosted"), false); + this.homeRadioButton = new JRadioButton(TranslationFacility.tr("ifa.imageBuilder.hosted"), false); gbc.gridx = 1; add(this.homeRadioButton, gbc); diff --git a/src/main/java/module/ifa/StatsPanel.java b/src/main/java/module/ifa/StatsPanel.java index 7b6d5c3c9..f0f631676 100644 --- a/src/main/java/module/ifa/StatsPanel.java +++ b/src/main/java/module/ifa/StatsPanel.java @@ -3,25 +3,17 @@ import core.gui.HOMainFrame; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; -import core.model.WorldDetailsManager; +import core.model.TranslationFacility; import core.util.GUIUtils; import module.ifa.model.IfaModel; import module.ifa.model.ModelChangeListener; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.NumberFormat; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; - public class StatsPanel extends JPanel { private JLabel visitedValueLabel; @@ -55,11 +47,11 @@ public void modelChanged() { private void initComponents() { setLayout(new GridBagLayout()); - setBorder(BorderFactory.createTitledBorder(HOVerwaltung.instance().getLanguageString( + setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr( "ifa.statisticsTable.stats.title"))); GridBagConstraints gbc = new GridBagConstraints(); - JLabel visitedLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + JLabel visitedLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.visitedCountries")); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(4, 10, 3, 6); @@ -71,7 +63,7 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 3, 6); add(this.visitedValueLabel, gbc); - JLabel ofLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + JLabel ofLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.of")); gbc.gridx = 2; add(ofLabel, gbc); @@ -80,7 +72,7 @@ private void initComponents() { gbc.gridx = 3; add(this.countriesTotalValueLabel, gbc); - JLabel visitedCoolnessLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + JLabel visitedCoolnessLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.coolness")); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridx = 4; @@ -93,7 +85,7 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 3, 6); add(this.visitedCoolnessValueLabel, gbc); - ofLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + ofLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.of")); gbc.gridx = 6; add(ofLabel, gbc); @@ -104,7 +96,7 @@ private void initComponents() { // ROW 2 - JLabel hostedLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + JLabel hostedLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.hostedCountries")); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(4, 10, 3, 6); @@ -118,7 +110,7 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 3, 6); add(this.hostedValueLabel, gbc); - ofLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + ofLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.of")); gbc.gridx = 2; add(ofLabel, gbc); @@ -127,7 +119,7 @@ private void initComponents() { gbc.gridx = 3; add(this.countriesTotalValueLabel2, gbc); - JLabel hostedCoolnessLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + JLabel hostedCoolnessLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.coolness")); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridx = 4; @@ -140,7 +132,7 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 3, 6); add(this.hostedCoolnessValueLabel, gbc); - ofLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + ofLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.of")); gbc.gridx = 6; add(ofLabel, gbc); @@ -151,7 +143,7 @@ private void initComponents() { // ROW 3 - JLabel coolnessSumTotalLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + JLabel coolnessSumTotalLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.coolnessTotal")); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(4, 20, 3, 6); @@ -165,7 +157,7 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 3, 6); add(this.coolnessSumValueLabel, gbc); - ofLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + ofLabel = new JLabel(TranslationFacility.tr( "ifa.statisticsTable.stats.of")); gbc.gridx = 6; add(ofLabel, gbc); diff --git a/src/main/java/module/ifa/menu/IFAMenu.java b/src/main/java/module/ifa/menu/IFAMenu.java index 05afc9bdd..6571aa272 100644 --- a/src/main/java/module/ifa/menu/IFAMenu.java +++ b/src/main/java/module/ifa/menu/IFAMenu.java @@ -1,8 +1,8 @@ package module.ifa.menu; -import core.model.HOVerwaltung; -import javax.swing.JMenu; -import javax.swing.JMenuItem; +import core.model.TranslationFacility; + +import javax.swing.*; public class IFAMenu extends JMenu { @@ -10,7 +10,7 @@ public class IFAMenu extends JMenu { private static final long serialVersionUID = 1L; public IFAMenu() { - super(HOVerwaltung.instance().getLanguageString("Tab_IFA")); + super(TranslationFacility.tr("Tab_IFA")); initialize(); } @@ -20,7 +20,7 @@ private void initialize() { } private JMenuItem getRebuildItem(){ - JMenuItem ifaItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.menu.modules.ifa.reloadallmatches")); + JMenuItem ifaItem = new JMenuItem(TranslationFacility.tr("ls.menu.modules.ifa.reloadallmatches")); ifaItem.addActionListener(new MenuItemListener()); return ifaItem; } diff --git a/src/main/java/module/ifa/menu/RebuildDialog.java b/src/main/java/module/ifa/menu/RebuildDialog.java index f1f4d4807..d732fee58 100644 --- a/src/main/java/module/ifa/menu/RebuildDialog.java +++ b/src/main/java/module/ifa/menu/RebuildDialog.java @@ -1,36 +1,29 @@ package module.ifa.menu; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - import core.db.DBManager; import core.gui.HOMainFrame; import core.gui.RefreshManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.ifa.PluginIfaUtils; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JPanel; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; public class RebuildDialog extends JDialog implements ActionListener { private static final long serialVersionUID = -5212562044591100095L; - JLabel infoLabel = new JLabel(HOVerwaltung.instance().getLanguageString("ifa.reload.info")); - JButton okButton = new JButton(HOVerwaltung.instance().getLanguageString("ifa.reload.reloadbutton")); - JButton cancelButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + JLabel infoLabel = new JLabel(TranslationFacility.tr("ifa.reload.info")); + JButton okButton = new JButton(TranslationFacility.tr("ifa.reload.reloadbutton")); + JButton cancelButton = new JButton(TranslationFacility.tr("ls.button.cancel")); HOMainFrame mainFrame = null; Boolean updatePerformed = false; public RebuildDialog (HOMainFrame mainFrame) { - super(mainFrame, HOVerwaltung.instance().getLanguageString("ls.menu.modules.ifa.reloadallmatches")); + super(mainFrame, TranslationFacility.tr("ls.menu.modules.ifa.reloadallmatches")); this.mainFrame = mainFrame; setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); init(); diff --git a/src/main/java/module/ifa/table/IfaTableModel.java b/src/main/java/module/ifa/table/IfaTableModel.java index 6eb01bae6..ee833f3eb 100644 --- a/src/main/java/module/ifa/table/IfaTableModel.java +++ b/src/main/java/module/ifa/table/IfaTableModel.java @@ -1,17 +1,16 @@ package module.ifa.table; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.ifa.PluginIfaUtils; import module.ifa.model.IfaModel; import module.ifa.model.IfaStatistic; import module.ifa.model.ModelChangeListener; import module.ifa.model.Summary; +import javax.swing.table.AbstractTableModel; import java.util.Date; import java.util.List; -import javax.swing.table.AbstractTableModel; - public class IfaTableModel extends AbstractTableModel implements ModelChangeListener { static final int COL_COUNTRY = 0; @@ -110,13 +109,13 @@ public Class getColumnClass(int columnIndex) { @Override public String getColumnName(int columnIndex) { return switch (columnIndex) { - case COL_COUNTRY -> HOVerwaltung.instance().getLanguageString("ifa.statisticsTable.col.country"); - case COL_PLAYED -> HOVerwaltung.instance().getLanguageString("ifa.statisticsTable.col.played"); - case COL_WON -> HOVerwaltung.instance().getLanguageString("Gewonnen"); - case COL_DRAW -> HOVerwaltung.instance().getLanguageString("Unendschieden"); - case COL_LOST -> HOVerwaltung.instance().getLanguageString("Verloren"); - case COL_LASTMATCH -> HOVerwaltung.instance().getLanguageString("ifa.statisticsTable.col.lastMatch"); - case COL_COOLNESS -> HOVerwaltung.instance().getLanguageString("ifa.statisticsTable.col.coolness"); + case COL_COUNTRY -> TranslationFacility.tr("ifa.statisticsTable.col.country"); + case COL_PLAYED -> TranslationFacility.tr("ifa.statisticsTable.col.played"); + case COL_WON -> TranslationFacility.tr("Gewonnen"); + case COL_DRAW -> TranslationFacility.tr("Unendschieden"); + case COL_LOST -> TranslationFacility.tr("Verloren"); + case COL_LASTMATCH -> TranslationFacility.tr("ifa.statisticsTable.col.lastMatch"); + case COL_COOLNESS -> TranslationFacility.tr("ifa.statisticsTable.col.coolness"); default -> null; }; diff --git a/src/main/java/module/lineup/CopyListener.java b/src/main/java/module/lineup/CopyListener.java index 1761ea2bf..e1f06c00f 100644 --- a/src/main/java/module/lineup/CopyListener.java +++ b/src/main/java/module/lineup/CopyListener.java @@ -2,23 +2,23 @@ import core.gui.HOMainFrame; import core.model.HOVerwaltung; +import core.model.TranslationFacility; +import core.model.match.MatchLineupTeam; +import core.model.match.Matchdetails; import core.model.match.StyleOfPlay; import core.model.player.Player; import core.util.HOLogger; -import core.model.match.MatchLineupTeam; -import core.model.match.Matchdetails; -import java.awt.Component; -import java.awt.Toolkit; +import module.lineup.lineup.PlayerPositionPanel; +import module.lineup.ratings.LineupRatingPanel; + +import javax.swing.*; +import java.awt.*; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Objects; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import module.lineup.lineup.PlayerPositionPanel; -import module.lineup.ratings.LineupRatingPanel; import static core.model.player.IMatchRoleID.*; @@ -33,10 +33,10 @@ public class CopyListener implements ActionListener { private static final String LF = System.getProperty("line.separator", "\n"); private static final String EMPTY = ""; private static final String SPACE = " "; - private final JMenuItem miPlaintext = new JMenuItem(HOVerwaltung.instance().getLanguageString("Lineup.CopyRatings.PlainText")); - private final JMenuItem miHattickMLDef = new JMenuItem(HOVerwaltung.instance().getLanguageString("Lineup.CopyRatings.HattrickML")); - private final JMenuItem miLineup = new JMenuItem(HOVerwaltung.instance().getLanguageString("Aufstellung")); - private final JMenuItem miLineupAndRatings = new JMenuItem(HOVerwaltung.instance().getLanguageString("Lineup.CopyRatings.LineupAndRatings")); + private final JMenuItem miPlaintext = new JMenuItem(TranslationFacility.tr("Lineup.CopyRatings.PlainText")); + private final JMenuItem miHattickMLDef = new JMenuItem(TranslationFacility.tr("Lineup.CopyRatings.HattrickML")); + private final JMenuItem miLineup = new JMenuItem(TranslationFacility.tr("Aufstellung")); + private final JMenuItem miLineupAndRatings = new JMenuItem(TranslationFacility.tr("Lineup.CopyRatings.LineupAndRatings")); final JPopupMenu menu = new JPopupMenu(); @@ -95,13 +95,13 @@ public static void copyToClipboard(final String txt) { private String getRatingsAsText() { var sb = new StringBuilder(); if (lineupRatingPanel != null) { - sb.append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.midfield")).append(": ").append(lineupRatingPanel.getMidfieldRating()).append(LF); - sb.append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.rightdefence")).append(": ").append(lineupRatingPanel.getRightDefenseRating()).append(LF); - sb.append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.centraldefence")).append(": ").append(lineupRatingPanel.getCentralDefenseRating()).append(LF); - sb.append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.leftdefence")).append(": ").append(lineupRatingPanel.getLeftDefenseRating()).append(LF); - sb.append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.rightattack")).append(": ").append(lineupRatingPanel.getRightAttackRating()).append(LF); - sb.append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.centralattack")).append(": ").append(lineupRatingPanel.getCentralAttackRating()).append(LF); - sb.append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.leftattack")).append(": ").append(lineupRatingPanel.getLeftAttackRating()).append(LF); + sb.append(TranslationFacility.tr("ls.match.ratingsector.midfield")).append(": ").append(lineupRatingPanel.getMidfieldRating()).append(LF); + sb.append(TranslationFacility.tr("ls.match.ratingsector.rightdefence")).append(": ").append(lineupRatingPanel.getRightDefenseRating()).append(LF); + sb.append(TranslationFacility.tr("ls.match.ratingsector.centraldefence")).append(": ").append(lineupRatingPanel.getCentralDefenseRating()).append(LF); + sb.append(TranslationFacility.tr("ls.match.ratingsector.leftdefence")).append(": ").append(lineupRatingPanel.getLeftDefenseRating()).append(LF); + sb.append(TranslationFacility.tr("ls.match.ratingsector.rightattack")).append(": ").append(lineupRatingPanel.getRightAttackRating()).append(LF); + sb.append(TranslationFacility.tr("ls.match.ratingsector.centralattack")).append(": ").append(lineupRatingPanel.getCentralAttackRating()).append(LF); + sb.append(TranslationFacility.tr("ls.match.ratingsector.leftattack")).append(": ").append(lineupRatingPanel.getLeftAttackRating()).append(LF); } return sb.toString(); } @@ -113,18 +113,18 @@ private String getRatingsAsHattrickML_DefTop() { var sb = new StringBuilder(); if (lineupRatingPanel != null) { sb.append("[table]"); - sb.append("[tr][th][/th][th]").append(HOVerwaltung.instance().getLanguageString("Rechts")); - sb.append("[/th][th]").append(HOVerwaltung.instance().getLanguageString("Mitte")); - sb.append("[/th][th]").append(HOVerwaltung.instance().getLanguageString("Links")).append("[/th][/tr]").append(LF); - sb.append("[tr][th]").append(HOVerwaltung.instance().getLanguageString("match.sector.defence")); + sb.append("[tr][th][/th][th]").append(TranslationFacility.tr("Rechts")); + sb.append("[/th][th]").append(TranslationFacility.tr("Mitte")); + sb.append("[/th][th]").append(TranslationFacility.tr("Links")).append("[/th][/tr]").append(LF); + sb.append("[tr][th]").append(TranslationFacility.tr("match.sector.defence")); sb.append("[/th][td align=center]").append(lineupRatingPanel.getRightDefenseRating()); sb.append("[/td][td align=center]").append(lineupRatingPanel.getCentralDefenseRating()); sb.append("[/td][td align=center]").append(lineupRatingPanel.getLeftDefenseRating()); sb.append("[/td][/tr]").append(LF); - sb.append("[tr][th]").append(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.midfield")); + sb.append("[tr][th]").append(TranslationFacility.tr("ls.match.ratingsector.midfield")); sb.append("[/th][td colspan=3 align=center]"); sb.append(lineupRatingPanel.getMidfieldRating()).append("[/td][/tr]").append(LF); - sb.append("[tr][th]").append(HOVerwaltung.instance().getLanguageString("Attack")); + sb.append("[tr][th]").append(TranslationFacility.tr("Attack")); sb.append("[/th][td align=center]").append(lineupRatingPanel.getRightAttackRating()); sb.append("[/td][td align=center]").append(lineupRatingPanel.getCentralAttackRating()); sb.append("[/td][td align=center]").append(lineupRatingPanel.getLeftAttackRating()); @@ -171,7 +171,7 @@ private String getLineupRatingPanel() { byte system = lineupData.getCurrentTeamFormationCode(); String systemName = lineupData.getSystemName(system); - String header = "[table][tr][th colspan=5 align=center]" + hov.getLanguageString("Aufstellung") + + String header = "[table][tr][th colspan=5 align=center]" + TranslationFacility.tr("Aufstellung") + SPACE + systemName + "[/th][/tr]" + LF; String keeper = "[tr][td colspan=5 align=center]" + goalie + "[/td][/tr]" + LF; String defence = "[tr][td align=center]" + rightWB + "[/td]" + "[td align=center]" + rightCD + "[/td]" + "[td align=center]" + middleCD + "[/td]" + @@ -229,13 +229,13 @@ private String getLineupAndRatings() { var styleOfPlay = StyleOfPlay.fromInt(lineupData.getCoachModifier()); String styleOfPlayName = MatchLineupTeam.getStyleOfPlayName(styleOfPlay); - String header = "[table][tr][th colspan=8 align=center]" + hov.getLanguageString("Aufstellung") + - SPACE + systemName + " // " + hov.getLanguageString("ls.team.teamattitude") + ": " + - attitudeName + " // " + hov.getLanguageString("ls.team.tactic") + ": " + tacticName + - level + " // " + hov.getLanguageString("ls.team.styleofPlay") + ": " + styleOfPlayName + "[/th][/tr]" + LF; - String keeper = "[tr][td colspan=5 align=center]" + goalie + "[/td]" + "[th align=center]"+HOVerwaltung.instance().getLanguageString("Rechts") + - "[/th][th align=center]"+HOVerwaltung.instance().getLanguageString("Mitte") + - "[/th][th align=center]"+HOVerwaltung.instance().getLanguageString("Links")+"[/th][/tr]" + LF; + String header = "[table][tr][th colspan=8 align=center]" + TranslationFacility.tr("Aufstellung") + + SPACE + systemName + " // " + TranslationFacility.tr("ls.team.teamattitude") + ": " + + attitudeName + " // " + TranslationFacility.tr("ls.team.tactic") + ": " + tacticName + + level + " // " + TranslationFacility.tr("ls.team.styleofPlay") + ": " + styleOfPlayName + "[/th][/tr]" + LF; + String keeper = "[tr][td colspan=5 align=center]" + goalie + "[/td]" + "[th align=center]"+TranslationFacility.tr("Rechts") + + "[/th][th align=center]"+TranslationFacility.tr("Mitte") + + "[/th][th align=center]"+TranslationFacility.tr("Links")+"[/th][/tr]" + LF; String defence = "[tr][td align=center]" + rightWB + "[/td]" + "[td align=center]" + rightCD + "[/td]" + "[td align=center]" + middleCD + "[/td]" + "[td align=center]" + leftCD + "[/td]" + "[td align=center]" + leftWB + "[/td]" + "[td align=center]"+ lineupRatingPanel.getRightDefenseRating() + "[/td][td align=center]"+ lineupRatingPanel.getCentralDefenseRating() + "[/td][td align=center]"+ lineupRatingPanel.getLeftDefenseRating() + "[/td][/tr]" + LF; diff --git a/src/main/java/module/lineup/Lineup.java b/src/main/java/module/lineup/Lineup.java index 7ae3055d7..8b821f9e5 100644 --- a/src/main/java/module/lineup/Lineup.java +++ b/src/main/java/module/lineup/Lineup.java @@ -2,9 +2,15 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; import core.db.DBManager; import core.model.HOVerwaltung; -import core.model.match.*; +import core.model.TranslationFacility; +import core.model.match.IMatchDetails; +import core.model.match.MatchKurzInfo; +import core.model.match.MatchLineupPosition; +import core.model.match.Weather; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; import core.model.player.Player; @@ -15,14 +21,11 @@ import module.lineup.substitution.model.MatchOrderType; import module.lineup.substitution.model.RedCardCriteria; import module.lineup.substitution.model.Substitution; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.stream.Collectors; -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; -import org.jetbrains.annotations.Nullable; - import static java.lang.Math.max; @@ -362,12 +365,11 @@ public final int getAttitude() { } public String getAttitudeName(int attitude) { - HOVerwaltung hov = HOVerwaltung.instance(); return switch (attitude) { - case IMatchDetails.EINSTELLUNG_NORMAL -> hov.getLanguageString("ls.team.teamattitude_short.normal"); - case IMatchDetails.EINSTELLUNG_PIC -> hov.getLanguageString("ls.team.teamattitude_short.playitcool"); - case IMatchDetails.EINSTELLUNG_MOTS -> hov.getLanguageString("ls.team.teamattitude_short.matchoftheseason"); - default -> HOVerwaltung.instance().getLanguageString("Unbestimmt"); + case IMatchDetails.EINSTELLUNG_NORMAL -> TranslationFacility.tr("ls.team.teamattitude_short.normal"); + case IMatchDetails.EINSTELLUNG_PIC -> TranslationFacility.tr("ls.team.teamattitude_short.playitcool"); + case IMatchDetails.EINSTELLUNG_MOTS -> TranslationFacility.tr("ls.team.teamattitude_short.matchoftheseason"); + default -> TranslationFacility.tr("Unbestimmt"); }; } @@ -609,7 +611,7 @@ public static String getNameForSystem(byte system) { case SYS_523 -> "5-2-3"; case SYS_550 -> "5-5-0"; case SYS_253 -> "2-5-3"; - default -> HOVerwaltung.instance().getLanguageString("Unbestimmt"); + default -> TranslationFacility.tr("Unbestimmt"); }; } diff --git a/src/main/java/module/lineup/LineupDatabasePanel.java b/src/main/java/module/lineup/LineupDatabasePanel.java index 87de7d857..6bc791f1a 100644 --- a/src/main/java/module/lineup/LineupDatabasePanel.java +++ b/src/main/java/module/lineup/LineupDatabasePanel.java @@ -3,6 +3,7 @@ import core.db.DBManager; import core.gui.Refreshable; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.enums.MatchType; import core.model.match.MatchKurzInfo; @@ -91,8 +92,8 @@ private void initComponents() { gbc.gridy++; var buttonPanel = new JPanel(new FlowLayout()); - storeButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.save")); - deleteButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + storeButton = new JButton(TranslationFacility.tr("ls.button.save")); + deleteButton = new JButton(TranslationFacility.tr("ls.button.delete")); buttonPanel.add(storeButton); buttonPanel.add(deleteButton); layout.setConstraints(buttonPanel, gbc); @@ -283,7 +284,7 @@ private void deleteTemplate() { private String templateDefaultName=null; private String getTemplateDefaultName() { if ( templateDefaultName==null){ - templateDefaultName = HOVerwaltung.instance().getLanguageString("ls.module.lineup.template") + DBManager.instance().getTemplateMatchLineupTeamNextNumber(); + templateDefaultName = TranslationFacility.tr("ls.module.lineup.template") + DBManager.instance().getTemplateMatchLineupTeamNextNumber(); } return templateDefaultName; } diff --git a/src/main/java/module/lineup/LineupMasterView.java b/src/main/java/module/lineup/LineupMasterView.java index 406869713..28137740c 100644 --- a/src/main/java/module/lineup/LineupMasterView.java +++ b/src/main/java/module/lineup/LineupMasterView.java @@ -3,19 +3,18 @@ import core.gui.RefreshManager; import core.gui.Refreshable; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchLineupPosition; import core.model.player.IMatchRoleID; import module.lineup.penalties.PenaltyTaker; import module.lineup.penalties.PenaltyTakersView; import module.lineup.substitution.SubstitutionOverview; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.util.ArrayList; import java.util.List; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; - /** * Top-Level Container for the Lineups (contains a tab for the lineup, a tab for * the match orders...) @@ -45,15 +44,15 @@ private void initComponents() { HOVerwaltung hov = HOVerwaltung.instance(); this.lineupPanel = new LineupPanel(); - this.tabbedPane.addTab(hov.getLanguageString("Aufstellung"), this.lineupPanel); + this.tabbedPane.addTab(TranslationFacility.tr("Aufstellung"), this.lineupPanel); this.substitutionOverview = new SubstitutionOverview(hov.getModel().getCurrentLineup()); - this.tabbedPane.addTab(hov.getLanguageString("subs.Title"), this.substitutionOverview); + this.tabbedPane.addTab(TranslationFacility.tr("subs.Title"), this.substitutionOverview); this.penaltyTakersView = new PenaltyTakersView(); this.penaltyTakersView.setPlayers(hov.getModel().getCurrentPlayers()); this.penaltyTakersView.setLineup(hov.getModel().getCurrentLineup()); - this.tabbedPane.addTab(hov.getLanguageString("lineup.penaltytakers.tab.title"), this.penaltyTakersView); + this.tabbedPane.addTab(TranslationFacility.tr("lineup.penaltytakers.tab.title"), this.penaltyTakersView); setLayout(new BorderLayout()); add(this.tabbedPane, BorderLayout.CENTER); diff --git a/src/main/java/module/lineup/LineupModule.java b/src/main/java/module/lineup/LineupModule.java index 931ea4588..85816479a 100644 --- a/src/main/java/module/lineup/LineupModule.java +++ b/src/main/java/module/lineup/LineupModule.java @@ -1,13 +1,11 @@ package module.lineup; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; +import javax.swing.*; import java.awt.event.KeyEvent; -import javax.swing.JPanel; -import javax.swing.KeyStroke; - public final class LineupModule extends DefaultModule { public LineupModule() { @@ -21,7 +19,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Aufstellung"); + return TranslationFacility.tr("Aufstellung"); } @Override diff --git a/src/main/java/module/lineup/LineupRatingAssistantPanel.java b/src/main/java/module/lineup/LineupRatingAssistantPanel.java index 000a399ee..871d2c0a3 100644 --- a/src/main/java/module/lineup/LineupRatingAssistantPanel.java +++ b/src/main/java/module/lineup/LineupRatingAssistantPanel.java @@ -2,7 +2,7 @@ import core.gui.RefreshManager; import core.gui.Updatable; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HOLogger; import module.lineup.assistant.LineupAssistantPanel; import module.lineup.lineup.MatchAndLineupSelectionPanel; @@ -71,9 +71,9 @@ private void initComponents() { pane.add(lineupRatingPanel, BorderLayout.NORTH); var tabView = new JTabbedPane(); - tabView.addTab(HOVerwaltung.instance().getLanguageString("ls.module.lineup.assistant"), new JScrollPane(lineupAssistantPanel)); - tabView.addTab(HOVerwaltung.instance().getLanguageString("ls.module.lineup.lineup_simulator"), new JScrollPane(lineupSettingsPanel)); - tabView.addTab(HOVerwaltung.instance().getLanguageString("ls.menu.file.database"), new JScrollPane(lineupDatabasePanel)); + tabView.addTab(TranslationFacility.tr("ls.module.lineup.assistant"), new JScrollPane(lineupAssistantPanel)); + tabView.addTab(TranslationFacility.tr("ls.module.lineup.lineup_simulator"), new JScrollPane(lineupSettingsPanel)); + tabView.addTab(TranslationFacility.tr("ls.menu.file.database"), new JScrollPane(lineupDatabasePanel)); pane.add(tabView, BorderLayout.CENTER); var matchPanel = new JPanel(new BorderLayout()); diff --git a/src/main/java/module/lineup/assistant/LineupAssistantPanel.java b/src/main/java/module/lineup/assistant/LineupAssistantPanel.java index ed37c96e7..ddbeaad02 100644 --- a/src/main/java/module/lineup/assistant/LineupAssistantPanel.java +++ b/src/main/java/module/lineup/assistant/LineupAssistantPanel.java @@ -4,24 +4,30 @@ import core.gui.HOMainFrame; import core.gui.Refreshable; import core.gui.comp.panel.ImagePanel; -import core.gui.theme.*; +import core.gui.theme.GroupTeamFactory; +import core.gui.theme.HOColorName; +import core.gui.theme.ImageUtilities; +import core.gui.theme.ThemeManager; import core.model.HOModel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.IMatchRoleID; import core.model.player.Player; import core.util.Helper; -import module.lineup.*; +import module.lineup.LineupAssistantSelectorOverlay; import module.lineup.lineup.PlayerPositionPanel; + +import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.*; import java.util.List; -import javax.swing.*; -import static module.lineup.LineupPanel.TITLE_FG; +import java.util.*; + import static core.util.Helper.getTranslation; +import static module.lineup.LineupPanel.TITLE_FG; //TODO check if it needs to implement Refreshable @@ -46,22 +52,22 @@ public class LineupAssistantPanel extends ImagePanel implements Refreshable, Act private final JCheckBox m_jcbxIdealPositionFirst = new JCheckBox("", userParameter.aufstellungsAssistentPanel_idealPosition); private final CBItem[] PRIORITIES = { - new CBItem(HOVerwaltung.instance().getLanguageString("AW-MF-ST"), + new CBItem(TranslationFacility.tr("AW-MF-ST"), LineupAssistant.AW_MF_ST), - new CBItem(HOVerwaltung.instance().getLanguageString("AW-ST-MF"), + new CBItem(TranslationFacility.tr("AW-ST-MF"), LineupAssistant.AW_ST_MF), - new CBItem(HOVerwaltung.instance().getLanguageString("MF-AW-ST"), + new CBItem(TranslationFacility.tr("MF-AW-ST"), LineupAssistant.MF_AW_ST), - new CBItem(HOVerwaltung.instance().getLanguageString("MF-ST-AW"), + new CBItem(TranslationFacility.tr("MF-ST-AW"), LineupAssistant.MF_ST_AW), - new CBItem(HOVerwaltung.instance().getLanguageString("ST-AW-MF"), + new CBItem(TranslationFacility.tr("ST-AW-MF"), LineupAssistant.ST_AW_MF), - new CBItem(HOVerwaltung.instance().getLanguageString("ST-MF-AW"), + new CBItem(TranslationFacility.tr("ST-MF-AW"), LineupAssistant.ST_MF_AW) }; private final JComboBox m_jcbPriority = new JComboBox<>(PRIORITIES); @@ -133,7 +139,7 @@ public final void actionPerformed(java.awt.event.ActionEvent actionEvent) { lineup.resetSubstituteBench(); lineup.setKicker(0); lineup.setCaptain(0); - HOMainFrame.instance().setInformation(HOVerwaltung.instance().getLanguageString("Aufstellung_geloescht")); + HOMainFrame.instance().setInformation(TranslationFacility.tr("Aufstellung_geloescht")); mainFrame.getLineupPanel().update(); } else if (actionEvent.getSource().equals(m_jbStartAssistant)) { @@ -164,8 +170,8 @@ else if (actionEvent.getSource().equals(overlayOk)) { // Return. javax.swing.JOptionPane.showMessageDialog(HOMainFrame.instance() .getLineupPanel(), - HOVerwaltung.instance().getLanguageString("lineupassist.Error"), - HOVerwaltung.instance().getLanguageString("lineupassist.ErrorHeader"), + TranslationFacility.tr("lineupassist.Error"), + TranslationFacility.tr("lineupassist.ErrorHeader"), javax.swing.JOptionPane.INFORMATION_MESSAGE); return; } @@ -241,7 +247,7 @@ private void startAssistant(HOModel hoModel, HOMainFrame mainFrame) { isIgnoreSuspended() ); - mainFrame.setInformation(HOVerwaltung.instance().getLanguageString("Autoaufstellung_fertig")); + mainFrame.setInformation(TranslationFacility.tr("Autoaufstellung_fertig")); mainFrame.getLineupPanel().update(); // gui.RefreshManager.instance ().doRefresh (); @@ -289,7 +295,7 @@ private void displayGUI() { constraints.gridwidth = 2; if (infoLabel == null) { infoLabel = new JLabel(); - infoLabel.setText(HOVerwaltung.instance().getLanguageString("lineupassist.Info")); + infoLabel.setText(TranslationFacility.tr("lineupassist.Info")); infoLabel.setOpaque(true); infoLabel.setHorizontalAlignment(JLabel.CENTER); infoLabel.setFont(getFont().deriveFont(Font.BOLD)); @@ -302,7 +308,7 @@ private void displayGUI() { constraints.gridheight = 1; if (overlayOk == null) { - overlayOk = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.ok")); + overlayOk = new JButton(TranslationFacility.tr("ls.button.ok")); overlayOk.setFont(new Font("serif", Font.BOLD, 16)); overlayOk.setBackground(ThemeManager.getColor(HOColorName.BUTTON_ASSIST_OK_BG)); overlayOk.setForeground(ImageUtilities.getColorForContrast(HOColorName.BUTTON_ASSIST_OK_BG)); @@ -312,7 +318,7 @@ private void displayGUI() { constraints.gridy = 2; if (overlayCancel == null) { - overlayCancel = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + overlayCancel = new JButton(TranslationFacility.tr("ls.button.cancel")); overlayCancel.addActionListener(this); overlayCancel.setFont(new Font("serif", Font.BOLD, 16)); overlayCancel.setBackground(ThemeManager.getColor(HOColorName.BUTTON_ASSIST_CANCEL_BG)); diff --git a/src/main/java/module/lineup/lineup/LineupCheck.java b/src/main/java/module/lineup/lineup/LineupCheck.java index 62bfdf940..628870075 100644 --- a/src/main/java/module/lineup/lineup/LineupCheck.java +++ b/src/main/java/module/lineup/lineup/LineupCheck.java @@ -4,20 +4,17 @@ import core.gui.model.MatchOrdersCBItem; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchKurzInfo; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; import module.lineup.Lineup; import org.jetbrains.annotations.Nullable; +import javax.swing.*; import java.util.ArrayList; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JOptionPane; - public class LineupCheck { public static boolean doUpload(@Nullable MatchOrdersCBItem match, Lineup lineup) { @@ -38,14 +35,14 @@ public static boolean doUpload(@Nullable MatchOrdersCBItem match, Lineup lineup) problems.add(getWarningLabel("lineup.upload.check.lessThan11PenaltytakersSet")); } if (!problems.isEmpty()) { - JLabel label = new JLabel(HOVerwaltung.instance().getLanguageString("lineup.upload.check.uploadAnywayQ")); + JLabel label = new JLabel(TranslationFacility.tr("lineup.upload.check.uploadAnywayQ")); label.setBorder(BorderFactory.createEmptyBorder(10, 20, 2, 10)); problems.add(label); } else { return true; } - String title = HOVerwaltung.instance().getLanguageString("lineup.upload.check.title"); + String title = TranslationFacility.tr("lineup.upload.check.title"); int result = JOptionPane.showConfirmDialog(HOMainFrame.instance(), problems.toArray(), title, JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE); @@ -76,13 +73,13 @@ private static boolean isFree(Lineup lineup, int positionId) { } private static JLabel getWarningLabel(String key) { - JLabel label = new JLabel(HOVerwaltung.instance().getLanguageString(key)); + JLabel label = new JLabel(TranslationFacility.tr(key)); label.setIcon(ThemeManager.getIcon(HOIconName.EXCLAMATION)); return label; } private static JLabel getErrorLabel(String key) { - JLabel label = new JLabel(HOVerwaltung.instance().getLanguageString(key)); + JLabel label = new JLabel(TranslationFacility.tr(key)); label.setIcon(ThemeManager.getIcon(HOIconName.EXCLAMATION_RED)); return label; } diff --git a/src/main/java/module/lineup/lineup/LineupPositionsPanel.java b/src/main/java/module/lineup/lineup/LineupPositionsPanel.java index e16b476be..c421ce8fa 100644 --- a/src/main/java/module/lineup/lineup/LineupPositionsPanel.java +++ b/src/main/java/module/lineup/lineup/LineupPositionsPanel.java @@ -7,8 +7,9 @@ import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; -import core.model.match.*; +import core.model.match.Weather; import core.model.player.IMatchRoleID; import core.model.player.Player; import core.util.HOLogger; @@ -16,12 +17,12 @@ import module.lineup.Lineup; import module.lineup.LineupPanel; +import javax.swing.*; +import javax.swing.border.Border; import java.awt.*; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -import javax.swing.*; -import javax.swing.border.Border; import static core.model.UserParameter.GOALKEEPER_AT_TOP; @@ -359,7 +360,7 @@ private void initComponents() { constraints.gridy = 4; constraints.gridwidth = 7; constraints.fill = GridBagConstraints.HORIZONTAL; - JLabel label1 = new JLabel(HOVerwaltung.instance().getLanguageString("moduleLineup.LineupPanel.SubstitutesLabel"), JLabel.CENTER); + JLabel label1 = new JLabel(TranslationFacility.tr("moduleLineup.LineupPanel.SubstitutesLabel"), JLabel.CENTER); Border border = BorderFactory.createLineBorder(Color.BLACK, 2); label1.setBorder(border); Font labelFont = label1.getFont(); diff --git a/src/main/java/module/lineup/lineup/MatchAndLineupSelectionPanel.java b/src/main/java/module/lineup/lineup/MatchAndLineupSelectionPanel.java index a373c092b..a33de1a56 100644 --- a/src/main/java/module/lineup/lineup/MatchAndLineupSelectionPanel.java +++ b/src/main/java/module/lineup/lineup/MatchAndLineupSelectionPanel.java @@ -10,6 +10,7 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.*; import core.model.player.TrainerType; import core.net.OnlineWorker; @@ -18,11 +19,14 @@ import module.lineup.LineupPanel; import org.jetbrains.annotations.Nullable; import org.w3c.dom.Document; + import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -45,9 +49,9 @@ public class MatchAndLineupSelectionPanel extends JPanel implements Refreshable private @Nullable MatchOrdersCBItem m_clSelectedMatch; - final String offensive_sop = HOVerwaltung.instance().getLanguageString("ls.team.styleofplay.offensive"); - final String defensive_sop = HOVerwaltung.instance().getLanguageString("ls.team.styleofplay.defensive"); - final String neutral_sop = HOVerwaltung.instance().getLanguageString("ls.team.styleofplay.neutral"); + final String offensive_sop = TranslationFacility.tr("ls.team.styleofplay.offensive"); + final String defensive_sop = TranslationFacility.tr("ls.team.styleofplay.defensive"); + final String neutral_sop = TranslationFacility.tr("ls.team.styleofplay.neutral"); public MatchOrdersCBItem getSelectedMatch() { return m_clSelectedMatch; @@ -91,11 +95,11 @@ private void initComponents() { gbc.gridx = 1; m_jcbTeamAttitude = new JComboBox<>(new CBItem[]{ new CBItem( - HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.playitcool"), + TranslationFacility.tr("ls.team.teamattitude.playitcool"), IMatchDetails.EINSTELLUNG_PIC), - new CBItem(HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.normal"), + new CBItem(TranslationFacility.tr("ls.team.teamattitude.normal"), IMatchDetails.EINSTELLUNG_NORMAL), - new CBItem(HOVerwaltung.instance().getLanguageString( + new CBItem(TranslationFacility.tr( "ls.team.teamattitude.matchoftheseason"), IMatchDetails.EINSTELLUNG_MOTS)}); layout.setConstraints(m_jcbTeamAttitude, gbc); add(m_jcbTeamAttitude); diff --git a/src/main/java/module/lineup/lineup/PlayerPositionPanel.java b/src/main/java/module/lineup/lineup/PlayerPositionPanel.java index 9a3eff317..968532b40 100644 --- a/src/main/java/module/lineup/lineup/PlayerPositionPanel.java +++ b/src/main/java/module/lineup/lineup/PlayerPositionPanel.java @@ -11,6 +11,7 @@ import core.gui.theme.ThemeManager; import core.model.HOModel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.match.Weather; import core.model.player.IMatchRoleID; @@ -21,14 +22,17 @@ import module.lineup.Lineup; import module.lineup.LineupAssistantSelectorOverlay; import org.jetbrains.annotations.Nullable; + +import javax.swing.*; import java.awt.*; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import javax.swing.*; +import java.util.Objects; import static core.model.UserParameter.GOALKEEPER_AT_TOP; import static core.model.UserParameter.POSITIONNAMES_SHORT; @@ -800,7 +804,7 @@ public void addSetPiecesIcon(){ } private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } } diff --git a/src/main/java/module/lineup/lineup/SwapPositionFeature.java b/src/main/java/module/lineup/lineup/SwapPositionFeature.java index b7cf4843a..7e29dccb4 100644 --- a/src/main/java/module/lineup/lineup/SwapPositionFeature.java +++ b/src/main/java/module/lineup/lineup/SwapPositionFeature.java @@ -4,15 +4,14 @@ import core.gui.theme.HOColorName; import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; + +import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Map; -import javax.swing.JComboBox; -import javax.swing.JToggleButton; - public class SwapPositionFeature { @@ -86,7 +85,7 @@ private void initSwapButton(PlayerPositionPanel spielerPositionsPanel) { } private void customizeSwapButton() { - swapButton.setToolTipText(HOVerwaltung.instance().getLanguageString("Lineup.Swap.ToolTip")); + swapButton.setToolTipText(TranslationFacility.tr("Lineup.Swap.ToolTip")); swapButton.setIcon(ImageUtilities.getSvgIcon(HOIconName.SWAP, Map.of("fillColor", HOColorName.SWAP_COLOR), 18, 18)); swapButton.setSelectedIcon(ImageUtilities.getSvgIcon(HOIconName.SWAP, Map.of("fillColor", HOColorName.SWAP_COLOR_PRESSED), 18, 18)); swapButton.setPreferredSize(new Dimension(18, 18)); diff --git a/src/main/java/module/lineup/penalties/PenaltyTakersView.java b/src/main/java/module/lineup/penalties/PenaltyTakersView.java index 8c0bfa913..2f89aeb03 100644 --- a/src/main/java/module/lineup/penalties/PenaltyTakersView.java +++ b/src/main/java/module/lineup/penalties/PenaltyTakersView.java @@ -5,43 +5,24 @@ import core.gui.comp.table.RowNumberTable; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchLineupPosition; -import core.model.player.Player; import core.model.player.MatchRoleID; +import core.model.player.Player; import core.util.GUIUtils; import module.lineup.Lineup; -import java.awt.Component; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ItemListener; -import java.io.Serial; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.RowFilter; -import javax.swing.RowSorter; -import javax.swing.SortOrder; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableRowSorter; +import java.awt.*; +import java.awt.event.ItemListener; +import java.io.Serial; +import java.text.NumberFormat; +import java.util.List; +import java.util.*; public class PenaltyTakersView extends JPanel { @@ -534,7 +515,7 @@ private void bestFit() { } private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } private class PenaltyTakersTableModel extends AbstractTableModel { diff --git a/src/main/java/module/lineup/ratings/CombinedRatingChartPanel.java b/src/main/java/module/lineup/ratings/CombinedRatingChartPanel.java index 7c6c90f47..e40f4ff31 100644 --- a/src/main/java/module/lineup/ratings/CombinedRatingChartPanel.java +++ b/src/main/java/module/lineup/ratings/CombinedRatingChartPanel.java @@ -1,19 +1,19 @@ package module.lineup.ratings; -import core.model.HOVerwaltung; -import core.model.UserParameter; -import core.util.Helper; +import core.gui.comp.ImageCheckbox; import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; -import core.util.chart.LinesChartDataModel; +import core.model.TranslationFacility; +import core.model.UserParameter; +import core.util.Helper; import core.util.chart.HOLinesChart; -import core.gui.comp.ImageCheckbox; +import core.util.chart.LinesChartDataModel; import org.knowm.xchart.style.lines.SeriesLines; import org.knowm.xchart.style.markers.SeriesMarkers; + +import javax.swing.*; import java.awt.*; import java.awt.event.ItemEvent; -import javax.swing.JPanel; -import javax.swing.JCheckBox; public final class CombinedRatingChartPanel extends JPanel { @@ -78,12 +78,11 @@ ImageCheckbox getCheckbox() { return checkbox; } } - private final HOVerwaltung hov = HOVerwaltung.instance(); private final UserParameter userParameter = UserParameter.instance(); private final RatingChartData chartData; private final JPanel controlsPanel = new JPanel(); private HOLinesChart oChartPanel; - private final JCheckBox showHelpLines = new JCheckBox(hov.getLanguageString("Hilflinien"), userParameter.CombinedRatingChartPanel_HelpLines); + private final JCheckBox showHelpLines = new JCheckBox(TranslationFacility.tr("Hilflinien"), userParameter.CombinedRatingChartPanel_HelpLines); private Datum leftDefense; private Datum centralDefense; private Datum rightDefense; @@ -142,59 +141,59 @@ private void initComponents() { gbc.gridy++; gbc.insets = new Insets(10,0,0,0); //top padding - leftDefense = new Datum(hov.getLanguageString("ls.match.ratingsector.leftdefence"), + leftDefense = new Datum(TranslationFacility.tr("ls.match.ratingsector.leftdefence"), ThemeManager.getColor(HOColorName.PALETTE13_0), "CombinedRatingChartPanel_LeftDefense"); controlsPanel.add(leftDefense.getCheckbox(), gbc); gbc.gridy++; gbc.insets = new Insets(0,0,0,0); //top padding - centralDefense = new Datum(hov.getLanguageString("ls.match.ratingsector.centraldefence"), + centralDefense = new Datum(TranslationFacility.tr("ls.match.ratingsector.centraldefence"), ThemeManager.getColor(HOColorName.PALETTE13_1), "CombinedRatingChartPanel_CentralDefense"); controlsPanel.add(centralDefense.getCheckbox(), gbc); gbc.gridy++; - rightDefense = new Datum(hov.getLanguageString("ls.match.ratingsector.rightdefence"), + rightDefense = new Datum(TranslationFacility.tr("ls.match.ratingsector.rightdefence"), ThemeManager.getColor(HOColorName.PALETTE13_2), "CombinedRatingChartPanel_RightDefense"); controlsPanel.add(rightDefense.getCheckbox(), gbc); gbc.gridy++; gbc.insets = new Insets(10,0,0,0); //top padding - midfield = new Datum(hov.getLanguageString("ls.match.ratingsector.midfield"), + midfield = new Datum(TranslationFacility.tr("ls.match.ratingsector.midfield"), ThemeManager.getColor(HOColorName.PALETTE13_3), "CombinedRatingChartPanel_Midfield"); controlsPanel.add(midfield.getCheckbox(), gbc); gbc.gridy++; - leftAttack = new Datum(hov.getLanguageString("ls.match.ratingsector.leftattack"), + leftAttack = new Datum(TranslationFacility.tr("ls.match.ratingsector.leftattack"), ThemeManager.getColor(HOColorName.PALETTE13_4), "CombinedRatingChartPanel_LeftAttack"); controlsPanel.add(leftAttack.getCheckbox(), gbc); gbc.gridy++; gbc.insets = new Insets(0,0,0,0); //top padding - centralAttack = new Datum(hov.getLanguageString("ls.match.ratingsector.centralattack"), + centralAttack = new Datum(TranslationFacility.tr("ls.match.ratingsector.centralattack"), ThemeManager.getColor(HOColorName.PALETTE13_5), "CombinedRatingChartPanel_CentralAttack"); controlsPanel.add(centralAttack.getCheckbox(), gbc); gbc.gridy++; - rightAttack = new Datum(hov.getLanguageString("ls.match.ratingsector.rightattack"), + rightAttack = new Datum(TranslationFacility.tr("ls.match.ratingsector.rightattack"), ThemeManager.getColor(HOColorName.PALETTE13_6), "CombinedRatingChartPanel_RightAttack"); controlsPanel.add(rightAttack.getCheckbox(), gbc); gbc.gridy++; gbc.insets = new Insets(10,0,0,0); //top padding - loddar = new Datum(hov.getLanguageString("ls.match.ratingtype.loddarstats"), + loddar = new Datum(TranslationFacility.tr("ls.match.ratingtype.loddarstats"), ThemeManager.getColor(HOColorName.PALETTE13_8), "CombinedRatingChartPanel_Loddar"); controlsPanel.add(loddar.getCheckbox(), gbc); gbc.gridy++; gbc.insets = new Insets(0,0,0,0); //top padding - String textLabel = hov.getLanguageString("ls.match.ratingtype.hatstats") + " (" + hov.getLanguageString("ls.chart.second_axis") + ")"; + String textLabel = TranslationFacility.tr("ls.match.ratingtype.hatstats") + " (" + TranslationFacility.tr("ls.chart.second_axis") + ")"; hatStats = new Datum(textLabel, ThemeManager.getColor(HOColorName.PALETTE13_7), "CombinedRatingChartPanel_HatStats", true, 19.0d); controlsPanel.add(hatStats.getCheckbox(), gbc); diff --git a/src/main/java/module/lineup/ratings/LineupRatingPanel.java b/src/main/java/module/lineup/ratings/LineupRatingPanel.java index 7505e3200..ad36e30d1 100644 --- a/src/main/java/module/lineup/ratings/LineupRatingPanel.java +++ b/src/main/java/module/lineup/ratings/LineupRatingPanel.java @@ -14,9 +14,9 @@ import module.lineup.Lineup; import module.lineup.LineupPanel; +import javax.swing.*; import java.awt.*; import java.text.NumberFormat; -import javax.swing.*; import static core.model.UserParameter.GOALKEEPER_AT_TOP; import static module.lineup.LineupPanel.TITLE_FG; @@ -240,7 +240,7 @@ private void initComponents() { mainPanel.add(m_jpMinuteToggler); // DEFENSE - var defenseLabel = new JLabel(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.defense")); + var defenseLabel = new JLabel(TranslationFacility.tr("ls.match.ratingsector.defense")); defenseLabel.setFont(defenseLabel.getFont().deriveFont(Font.BOLD)); gbcMainLayout.gridx = 0; @@ -272,7 +272,7 @@ private void initComponents() { mainPanel.add(m_jpLeftDefense); //Midfield ================================================== - var midfieldLabel = new JLabel(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.midfield")); + var midfieldLabel = new JLabel(TranslationFacility.tr("ls.match.ratingsector.midfield")); midfieldLabel.setFont(midfieldLabel.getFont().deriveFont(Font.BOLD)); gbcMainLayout.gridx = 0; gbcMainLayout.gridy = 1 + getLineupRatingLabelRowNumber(1); @@ -291,7 +291,7 @@ private void initComponents() { mainPanel.add(m_jpMidfield); // Attack - var attackLabel = new JLabel(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.attack")); + var attackLabel = new JLabel(TranslationFacility.tr("ls.match.ratingsector.attack")); attackLabel.setFont(attackLabel.getFont().deriveFont(Font.BOLD)); gbcMainLayout.gridx = 0; gbcMainLayout.gridy = 1 + getLineupRatingLabelRowNumber(2); @@ -550,7 +550,7 @@ private String getFormationExperienceTooltip() { } private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } abstract static class MinuteRating { diff --git a/src/main/java/module/lineup/ratings/MinuteTogglerPanel.java b/src/main/java/module/lineup/ratings/MinuteTogglerPanel.java index 8c22ac9c4..b55d94311 100644 --- a/src/main/java/module/lineup/ratings/MinuteTogglerPanel.java +++ b/src/main/java/module/lineup/ratings/MinuteTogglerPanel.java @@ -1,19 +1,17 @@ package module.lineup.ratings; -import core.model.HOVerwaltung; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import java.util.List; +import core.model.TranslationFacility; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import java.util.ListIterator; -import java.awt.Color; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.awt.event.MouseEvent; -import java.awt.event.MouseAdapter; - -import javax.swing.*; public final class MinuteTogglerPanel extends JPanel { @@ -96,9 +94,9 @@ public void mousePressed(MouseEvent e) { } }); - avg90Clock.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Lineup_RatingsPanel_Green_Clock")); - avg120Clock.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Lineup_RatingsPanel_Red_Clock")); - ratingsGraph.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Lineup_RatingsPanel_RatingGraph")); + avg90Clock.setToolTipText(TranslationFacility.tr("tt_Lineup_RatingsPanel_Green_Clock")); + avg120Clock.setToolTipText(TranslationFacility.tr("tt_Lineup_RatingsPanel_Red_Clock")); + ratingsGraph.setToolTipText(TranslationFacility.tr("tt_Lineup_RatingsPanel_RatingGraph")); JPanel clocksPanel = new JPanel(); clocksPanel.add(avg90Clock); diff --git a/src/main/java/module/lineup/ratings/RatingChartFrame.java b/src/main/java/module/lineup/ratings/RatingChartFrame.java index ab84d7a5c..e1724605f 100644 --- a/src/main/java/module/lineup/ratings/RatingChartFrame.java +++ b/src/main/java/module/lineup/ratings/RatingChartFrame.java @@ -1,28 +1,21 @@ package module.lineup.ratings; -import core.model.HOVerwaltung; -import core.model.UserParameter; import core.gui.HOMainFrame; +import core.model.TranslationFacility; +import core.model.UserParameter; -import java.awt.Dimension; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JCheckBox; -import javax.swing.ButtonGroup; -import javax.swing.JRadioButton; - class RatingChartFrame extends JFrame { - private final HOVerwaltung hov = HOVerwaltung.instance(); private final UserParameter userParameter = UserParameter.instance(); - private final JRadioButton combinedChartButton = new JRadioButton(hov.getLanguageString("lineup.CombinedChart")); - private final JRadioButton multiChartButton = new JRadioButton(hov.getLanguageString("lineup.MultiChart")); + private final JRadioButton combinedChartButton = new JRadioButton(TranslationFacility.tr("lineup.CombinedChart")); + private final JRadioButton multiChartButton = new JRadioButton(TranslationFacility.tr("lineup.MultiChart")); private final ButtonGroup chartButtonGroup = new ButtonGroup(); - private final JCheckBox etToggler = new JCheckBox(hov.getLanguageString("lineup.ETToggler"), userParameter.RatingChartFrame_ET); + private final JCheckBox etToggler = new JCheckBox(TranslationFacility.tr("lineup.ETToggler"), userParameter.RatingChartFrame_ET); private final JPanel controlsPanel = new JPanel(); private final JPanel placeholderChart = new JPanel(); private final RatingChartData chartData = new RatingChartData(); @@ -63,7 +56,7 @@ else if (e.getStateChange() == ItemEvent.DESELECTED) { } RatingChartFrame() { - super(HOVerwaltung.instance().getLanguageString("RatingChartFrame")); + super(TranslationFacility.tr("RatingChartFrame")); this.setIconImage(HOMainFrame.instance().getIconImage()); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLayout(new BorderLayout()); diff --git a/src/main/java/module/lineup/substitution/DetailsView.java b/src/main/java/module/lineup/substitution/DetailsView.java index b3ecd2e63..be81b8087 100644 --- a/src/main/java/module/lineup/substitution/DetailsView.java +++ b/src/main/java/module/lineup/substitution/DetailsView.java @@ -3,25 +3,18 @@ import core.gui.comp.entry.ColorLabelEntry; import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.Helper; import module.lineup.substitution.model.GoalDiffCriteria; import module.lineup.substitution.model.MatchOrderType; import module.lineup.substitution.model.RedCardCriteria; import module.lineup.substitution.model.Substitution; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.io.Serial; import java.text.MessageFormat; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - public class DetailsView extends JPanel { private static final Dimension COMPONENTENSIZE = new Dimension(Helper.calcCellWidth(300), @@ -87,25 +80,25 @@ private void updateView() { switch (this.substitution.getOrderType()) { case SUBSTITUTION -> { - this.playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.Out")); - this.playerInLabel.setText(HOVerwaltung.instance().getLanguageString("subs.In")); + this.playerLabel.setText(TranslationFacility.tr("subs.Out")); + this.playerInLabel.setText(TranslationFacility.tr("subs.In")); } case NEW_BEHAVIOUR -> { - this.playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.Player")); + this.playerLabel.setText(TranslationFacility.tr("subs.Player")); this.playerInLabel.setText(""); } case POSITION_SWAP -> { - this.playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.Reposition")); - this.playerInLabel.setText(HOVerwaltung.instance().getLanguageString("subs.RepositionWith")); + this.playerLabel.setText(TranslationFacility.tr("subs.Reposition")); + this.playerInLabel.setText(TranslationFacility.tr("subs.RepositionWith")); } case MAN_MARKING -> { - this.playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.manMarkingPlayer")); - this.playerInLabel.setText(HOVerwaltung.instance().getLanguageString("subs.manMarkedOpponentPlayer")); + this.playerLabel.setText(TranslationFacility.tr("subs.manMarkingPlayer")); + this.playerInLabel.setText(TranslationFacility.tr("subs.manMarkedOpponentPlayer")); } } } else { - this.playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.Out")); - this.playerInLabel.setText(HOVerwaltung.instance().getLanguageString("subs.In")); + this.playerLabel.setText(TranslationFacility.tr("subs.Out")); + this.playerInLabel.setText(TranslationFacility.tr("subs.In")); Color color = ThemeManager.getColor(HOColorName.TABLEENTRY_BG); this.firstPlayerEntry.setBackground(color); @@ -136,10 +129,10 @@ private void updateData() { if (this.substitution.getMatchMinuteCriteria() > 0) { when = MessageFormat.format( - HOVerwaltung.instance().getLanguageString("subs.MinuteAfterX"), + TranslationFacility.tr("subs.MinuteAfterX"), this.substitution.getMatchMinuteCriteria()); } else { - when = HOVerwaltung.instance().getLanguageString("subs.MinuteAnytime"); + when = TranslationFacility.tr("subs.MinuteAnytime"); } if (this.substitution.getRoleId() != -1) { @@ -170,7 +163,7 @@ private void initComponents() { gbc.insets = new Insets(10, 10, 2, 2); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; - add(new JLabel(HOVerwaltung.instance().getLanguageString("subs.Order")), gbc); + add(new JLabel(TranslationFacility.tr("subs.Order")), gbc); this.orderTypeEntry = createValueLabel(); gbc.gridx = 1; @@ -181,7 +174,7 @@ private void initComponents() { gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(2, 10, 2, 2); - this.playerLabel = new JLabel(HOVerwaltung.instance().getLanguageString("subs.Out")); + this.playerLabel = new JLabel(TranslationFacility.tr("subs.Out")); add(this.playerLabel, gbc); this.firstPlayerEntry = createValueLabel(); @@ -193,7 +186,7 @@ private void initComponents() { gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(2, 10, 2, 2); - this.playerInLabel = new JLabel(HOVerwaltung.instance().getLanguageString("subs.In")); + this.playerInLabel = new JLabel(TranslationFacility.tr("subs.In")); add(this.playerInLabel, gbc); this.secondPlayerEntry = createValueLabel(); @@ -205,7 +198,7 @@ private void initComponents() { gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(2, 10, 2, 2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("subs.When")), gbc); + add(new JLabel(TranslationFacility.tr("subs.When")), gbc); this.whenEntry = createValueLabel(); gbc.gridx = 1; @@ -216,7 +209,7 @@ private void initComponents() { gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(2, 10, 2, 2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("subs.Behavior")), gbc); + add(new JLabel(TranslationFacility.tr("subs.Behavior")), gbc); this.newBehaviourEntry = createValueLabel(); gbc.gridx = 1; @@ -227,7 +220,7 @@ private void initComponents() { gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(2, 10, 2, 2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("subs.Position")), gbc); + add(new JLabel(TranslationFacility.tr("subs.Position")), gbc); this.newPositionEntry = createValueLabel(); gbc.gridx = 1; @@ -238,7 +231,7 @@ private void initComponents() { gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(2, 10, 2, 2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("subs.RedCard")), gbc); + add(new JLabel(TranslationFacility.tr("subs.RedCard")), gbc); this.redCardsEntry = createValueLabel(); gbc.gridx = 1; @@ -249,7 +242,7 @@ private void initComponents() { gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(2, 10, 2, 2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("subs.Standing")), gbc); + add(new JLabel(TranslationFacility.tr("subs.Standing")), gbc); this.standingEntry = createValueLabel(); gbc.gridx = 1; diff --git a/src/main/java/module/lineup/substitution/LanguageStringLookup.java b/src/main/java/module/lineup/substitution/LanguageStringLookup.java index 07382428f..a80c82612 100644 --- a/src/main/java/module/lineup/substitution/LanguageStringLookup.java +++ b/src/main/java/module/lineup/substitution/LanguageStringLookup.java @@ -1,6 +1,6 @@ package module.lineup.substitution; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import module.lineup.substitution.model.GoalDiffCriteria; import module.lineup.substitution.model.MatchOrderType; @@ -10,89 +10,89 @@ public class LanguageStringLookup { public static String getOrderType(MatchOrderType orderType) { return switch (orderType) { - case NEW_BEHAVIOUR -> HOVerwaltung.instance().getLanguageString("subs.TypeOrder"); - case POSITION_SWAP -> HOVerwaltung.instance().getLanguageString("subs.TypeSwap"); - case SUBSTITUTION -> HOVerwaltung.instance().getLanguageString("subs.TypeSub"); - case MAN_MARKING -> HOVerwaltung.instance().getLanguageString("subs.TypeManMarking"); + case NEW_BEHAVIOUR -> TranslationFacility.tr("subs.TypeOrder"); + case POSITION_SWAP -> TranslationFacility.tr("subs.TypeSwap"); + case SUBSTITUTION -> TranslationFacility.tr("subs.TypeSub"); + case MAN_MARKING -> TranslationFacility.tr("subs.TypeManMarking"); default -> null; }; } public static String getBehaviour(byte id) { return switch (id) { - case (-1) -> HOVerwaltung.instance().getLanguageString("subs.BehNoChange"); - case IMatchRoleID.NORMAL -> HOVerwaltung.instance().getLanguageString("ls.player.behaviour.normal"); - case IMatchRoleID.OFFENSIVE -> HOVerwaltung.instance().getLanguageString("ls.player.behaviour.offensive"); - case IMatchRoleID.DEFENSIVE -> HOVerwaltung.instance().getLanguageString("ls.player.behaviour.defensive"); - case IMatchRoleID.TOWARDS_MIDDLE -> HOVerwaltung.instance().getLanguageString("ls.player.behaviour.towardsmiddle"); - case IMatchRoleID.TOWARDS_WING -> HOVerwaltung.instance().getLanguageString("ls.player.behaviour.towardswing"); + case (-1) -> TranslationFacility.tr("subs.BehNoChange"); + case IMatchRoleID.NORMAL -> TranslationFacility.tr("ls.player.behaviour.normal"); + case IMatchRoleID.OFFENSIVE -> TranslationFacility.tr("ls.player.behaviour.offensive"); + case IMatchRoleID.DEFENSIVE -> TranslationFacility.tr("ls.player.behaviour.defensive"); + case IMatchRoleID.TOWARDS_MIDDLE -> TranslationFacility.tr("ls.player.behaviour.towardsmiddle"); + case IMatchRoleID.TOWARDS_WING -> TranslationFacility.tr("ls.player.behaviour.towardswing"); default -> "UNKNOWN_BEHAVIOUR"; }; } public static String getPosition(int id) { return switch (id) { - case IMatchRoleID.keeper -> HOVerwaltung.instance().getLanguageString("subs.gk"); - case IMatchRoleID.rightBack -> HOVerwaltung.instance().getLanguageString("subs.rb"); - case IMatchRoleID.rightCentralDefender -> HOVerwaltung.instance().getLanguageString("subs.rcd"); - case IMatchRoleID.middleCentralDefender -> HOVerwaltung.instance().getLanguageString("subs.mcd"); - case IMatchRoleID.leftCentralDefender -> HOVerwaltung.instance().getLanguageString("subs.lcd"); - case IMatchRoleID.leftBack -> HOVerwaltung.instance().getLanguageString("subs.lb"); - case IMatchRoleID.rightWinger -> HOVerwaltung.instance().getLanguageString("subs.rw"); - case IMatchRoleID.rightInnerMidfield -> HOVerwaltung.instance().getLanguageString("subs.rim"); - case IMatchRoleID.centralInnerMidfield -> HOVerwaltung.instance().getLanguageString("subs.cim"); - case IMatchRoleID.leftInnerMidfield -> HOVerwaltung.instance().getLanguageString("subs.lim"); - case IMatchRoleID.leftWinger -> HOVerwaltung.instance().getLanguageString("subs.lw"); - case IMatchRoleID.rightForward -> HOVerwaltung.instance().getLanguageString("subs.rfw"); - case IMatchRoleID.centralForward -> HOVerwaltung.instance().getLanguageString("subs.cfw"); - case IMatchRoleID.leftForward -> HOVerwaltung.instance().getLanguageString("subs.lfw"); - case IMatchRoleID.substGK1 -> HOVerwaltung.instance().getLanguageString("subs.subgk"); - case IMatchRoleID.substWB1 -> HOVerwaltung.instance().getLanguageString("subs.subwb"); - case IMatchRoleID.substCD1 -> HOVerwaltung.instance().getLanguageString("subs.subdef"); - case IMatchRoleID.substIM1 -> HOVerwaltung.instance().getLanguageString("subs.submid"); - case IMatchRoleID.substWI1 -> HOVerwaltung.instance().getLanguageString("subs.subwing"); - case IMatchRoleID.substFW1 -> HOVerwaltung.instance().getLanguageString("subs.subfw"); - case IMatchRoleID.substXT1 -> HOVerwaltung.instance().getLanguageString("subs.subxtra"); + case IMatchRoleID.keeper -> TranslationFacility.tr("subs.gk"); + case IMatchRoleID.rightBack -> TranslationFacility.tr("subs.rb"); + case IMatchRoleID.rightCentralDefender -> TranslationFacility.tr("subs.rcd"); + case IMatchRoleID.middleCentralDefender -> TranslationFacility.tr("subs.mcd"); + case IMatchRoleID.leftCentralDefender -> TranslationFacility.tr("subs.lcd"); + case IMatchRoleID.leftBack -> TranslationFacility.tr("subs.lb"); + case IMatchRoleID.rightWinger -> TranslationFacility.tr("subs.rw"); + case IMatchRoleID.rightInnerMidfield -> TranslationFacility.tr("subs.rim"); + case IMatchRoleID.centralInnerMidfield -> TranslationFacility.tr("subs.cim"); + case IMatchRoleID.leftInnerMidfield -> TranslationFacility.tr("subs.lim"); + case IMatchRoleID.leftWinger -> TranslationFacility.tr("subs.lw"); + case IMatchRoleID.rightForward -> TranslationFacility.tr("subs.rfw"); + case IMatchRoleID.centralForward -> TranslationFacility.tr("subs.cfw"); + case IMatchRoleID.leftForward -> TranslationFacility.tr("subs.lfw"); + case IMatchRoleID.substGK1 -> TranslationFacility.tr("subs.subgk"); + case IMatchRoleID.substWB1 -> TranslationFacility.tr("subs.subwb"); + case IMatchRoleID.substCD1 -> TranslationFacility.tr("subs.subdef"); + case IMatchRoleID.substIM1 -> TranslationFacility.tr("subs.submid"); + case IMatchRoleID.substWI1 -> TranslationFacility.tr("subs.subwing"); + case IMatchRoleID.substFW1 -> TranslationFacility.tr("subs.subfw"); + case IMatchRoleID.substXT1 -> TranslationFacility.tr("subs.subxtra"); default -> ""; }; } public static String getStanding(GoalDiffCriteria standing) { return switch (standing) { - case ANY_STANDING -> HOVerwaltung.instance().getLanguageString("subs.GoalAny"); - case MATCH_IS_TIED -> HOVerwaltung.instance().getLanguageString("subs.GoalTied"); - case IN_THE_LEAD -> HOVerwaltung.instance().getLanguageString("subs.GoalLead"); - case DOWN -> HOVerwaltung.instance().getLanguageString("subs.GoalDown"); - case IN_THE_LEAD_BY_MORE_THAN_ONE -> HOVerwaltung.instance().getLanguageString("subs.GoalLeadMT1"); - case DOWN_BY_MORE_THAN_ONE -> HOVerwaltung.instance().getLanguageString("subs.GoalDownMT1"); - case NOT_DOWN -> HOVerwaltung.instance().getLanguageString("subs.GoalNotDown"); - case NOT_IN_THE_LEAD -> HOVerwaltung.instance().getLanguageString("subs.GoalNotLead"); - case IN_THE_LEAD_BY_MORE_THAN_TWO -> HOVerwaltung.instance().getLanguageString("subs.GoalLeadMT2"); - case DOWN_BY_MORE_THAN_TWO -> HOVerwaltung.instance().getLanguageString("subs.GoalDownMT2"); - case MATCH_IS_NOT_TIED -> HOVerwaltung.instance().getLanguageString("subs.MatchIsNotTied"); - case NOT_IN_THE_LEAD_BY_MORE_THAN_ONE -> HOVerwaltung.instance().getLanguageString("subs.GoalNotLeadMT1"); - case NOT_DOWN_BY_MORE_THAN_ONE -> HOVerwaltung.instance().getLanguageString("subs.GoalNotDownMT1"); - case NOT_IN_THE_LEAD_BY_MORE_THAN_TWO -> HOVerwaltung.instance().getLanguageString("subs.GoalNotLeadMT2"); - case NOT_DOWN_BY_MORE_THAN_TWO -> HOVerwaltung.instance().getLanguageString("subs.GoalNotDownMT2"); + case ANY_STANDING -> TranslationFacility.tr("subs.GoalAny"); + case MATCH_IS_TIED -> TranslationFacility.tr("subs.GoalTied"); + case IN_THE_LEAD -> TranslationFacility.tr("subs.GoalLead"); + case DOWN -> TranslationFacility.tr("subs.GoalDown"); + case IN_THE_LEAD_BY_MORE_THAN_ONE -> TranslationFacility.tr("subs.GoalLeadMT1"); + case DOWN_BY_MORE_THAN_ONE -> TranslationFacility.tr("subs.GoalDownMT1"); + case NOT_DOWN -> TranslationFacility.tr("subs.GoalNotDown"); + case NOT_IN_THE_LEAD -> TranslationFacility.tr("subs.GoalNotLead"); + case IN_THE_LEAD_BY_MORE_THAN_TWO -> TranslationFacility.tr("subs.GoalLeadMT2"); + case DOWN_BY_MORE_THAN_TWO -> TranslationFacility.tr("subs.GoalDownMT2"); + case MATCH_IS_NOT_TIED -> TranslationFacility.tr("subs.MatchIsNotTied"); + case NOT_IN_THE_LEAD_BY_MORE_THAN_ONE -> TranslationFacility.tr("subs.GoalNotLeadMT1"); + case NOT_DOWN_BY_MORE_THAN_ONE -> TranslationFacility.tr("subs.GoalNotDownMT1"); + case NOT_IN_THE_LEAD_BY_MORE_THAN_TWO -> TranslationFacility.tr("subs.GoalNotLeadMT2"); + case NOT_DOWN_BY_MORE_THAN_TWO -> TranslationFacility.tr("subs.GoalNotDownMT2"); default -> ""; }; } public static String getRedCard(RedCardCriteria redCardCriteria) { return switch (redCardCriteria) { - case IGNORE -> HOVerwaltung.instance().getLanguageString("subs.RedIgnore"); - case MY_PLAYER -> HOVerwaltung.instance().getLanguageString("subs.RedMy"); - case OPPONENT_PLAYER -> HOVerwaltung.instance().getLanguageString("subs.RedOpp"); - case MY_CENTRAL_DEFENDER -> HOVerwaltung.instance().getLanguageString("subs.RedMyCD"); - case MY_MIDFIELDER -> HOVerwaltung.instance().getLanguageString("subs.RedMyMF"); - case MY_FORWARD -> HOVerwaltung.instance().getLanguageString("subs.RedMyFW"); - case MY_WING_BACK -> HOVerwaltung.instance().getLanguageString("subs.RedMyWB"); - case MY_WINGER -> HOVerwaltung.instance().getLanguageString("subs.RedMyWI"); - case OPPONENT_CENTRAL_DEFENDER -> HOVerwaltung.instance().getLanguageString("subs.RedOppCD"); - case OPPONENT_MIDFIELDER -> HOVerwaltung.instance().getLanguageString("subs.RedOppMF"); - case OPPONENT_FORAWARD -> HOVerwaltung.instance().getLanguageString("subs.RedOppFW"); - case OPPONENT_WING_BACK -> HOVerwaltung.instance().getLanguageString("subs.RedOppWB"); - case OPPONENT_WINGER -> HOVerwaltung.instance().getLanguageString("subs.RedOppWi"); + case IGNORE -> TranslationFacility.tr("subs.RedIgnore"); + case MY_PLAYER -> TranslationFacility.tr("subs.RedMy"); + case OPPONENT_PLAYER -> TranslationFacility.tr("subs.RedOpp"); + case MY_CENTRAL_DEFENDER -> TranslationFacility.tr("subs.RedMyCD"); + case MY_MIDFIELDER -> TranslationFacility.tr("subs.RedMyMF"); + case MY_FORWARD -> TranslationFacility.tr("subs.RedMyFW"); + case MY_WING_BACK -> TranslationFacility.tr("subs.RedMyWB"); + case MY_WINGER -> TranslationFacility.tr("subs.RedMyWI"); + case OPPONENT_CENTRAL_DEFENDER -> TranslationFacility.tr("subs.RedOppCD"); + case OPPONENT_MIDFIELDER -> TranslationFacility.tr("subs.RedOppMF"); + case OPPONENT_FORAWARD -> TranslationFacility.tr("subs.RedOppFW"); + case OPPONENT_WING_BACK -> TranslationFacility.tr("subs.RedOppWB"); + case OPPONENT_WINGER -> TranslationFacility.tr("subs.RedOppWi"); default -> ""; }; } diff --git a/src/main/java/module/lineup/substitution/SubstitutionDataProvider.java b/src/main/java/module/lineup/substitution/SubstitutionDataProvider.java index fd5e2afb1..49aabed53 100644 --- a/src/main/java/module/lineup/substitution/SubstitutionDataProvider.java +++ b/src/main/java/module/lineup/substitution/SubstitutionDataProvider.java @@ -2,6 +2,7 @@ import core.datatype.CBItem; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.lineup.Lineup; import module.lineup.substitution.model.GoalDiffCriteria; import module.teamAnalyzer.SystemManager; @@ -81,19 +82,19 @@ public static CBItem[] getStandingItems() { */ public static CBItem[] getRedCardItems() { return new CBItem[]{ - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedIgnore"), -1), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedMy"), 1), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedOpp"), 2), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedMyCD"), 11), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedMyMF"), 12), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedMyFW"), 13), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedMyWB"), 14), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedMyWI"), 15), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedOppCD"), 21), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedOppMF"), 22), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedOppFW"), 23), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedOppWB"), 24), - new CBItem(HOVerwaltung.instance().getLanguageString("subs.RedOppWi"), 25), }; + new CBItem(TranslationFacility.tr("subs.RedIgnore"), -1), + new CBItem(TranslationFacility.tr("subs.RedMy"), 1), + new CBItem(TranslationFacility.tr("subs.RedOpp"), 2), + new CBItem(TranslationFacility.tr("subs.RedMyCD"), 11), + new CBItem(TranslationFacility.tr("subs.RedMyMF"), 12), + new CBItem(TranslationFacility.tr("subs.RedMyFW"), 13), + new CBItem(TranslationFacility.tr("subs.RedMyWB"), 14), + new CBItem(TranslationFacility.tr("subs.RedMyWI"), 15), + new CBItem(TranslationFacility.tr("subs.RedOppCD"), 21), + new CBItem(TranslationFacility.tr("subs.RedOppMF"), 22), + new CBItem(TranslationFacility.tr("subs.RedOppFW"), 23), + new CBItem(TranslationFacility.tr("subs.RedOppWB"), 24), + new CBItem(TranslationFacility.tr("subs.RedOppWi"), 25), }; } /** @@ -104,15 +105,14 @@ public static CBItem[] getRedCardItems() { */ public static List getBehaviourItems(boolean withInheritItem) { List behaviourValues = new ArrayList<>(); - HOVerwaltung hov = HOVerwaltung.instance(); if (withInheritItem) { - behaviourValues.add(new CBItem(hov.getLanguageString("subs.BehNoChange"), -1)); + behaviourValues.add(new CBItem(TranslationFacility.tr("subs.BehNoChange"), -1)); } - behaviourValues.add(new CBItem(hov.getLanguageString("ls.player.behaviour.normal"), 0)); - behaviourValues.add(new CBItem(hov.getLanguageString("ls.player.behaviour.offensive"), 1)); - behaviourValues.add(new CBItem(hov.getLanguageString("ls.player.behaviour.defensive"), 2)); - behaviourValues.add(new CBItem(hov.getLanguageString("ls.player.behaviour.towardsmiddle"), 3)); - behaviourValues.add(new CBItem(hov.getLanguageString("ls.player.behaviour.towardswing"), 4)); + behaviourValues.add(new CBItem(TranslationFacility.tr("ls.player.behaviour.normal"), 0)); + behaviourValues.add(new CBItem(TranslationFacility.tr("ls.player.behaviour.offensive"), 1)); + behaviourValues.add(new CBItem(TranslationFacility.tr("ls.player.behaviour.defensive"), 2)); + behaviourValues.add(new CBItem(TranslationFacility.tr("ls.player.behaviour.towardsmiddle"), 3)); + behaviourValues.add(new CBItem(TranslationFacility.tr("ls.player.behaviour.towardswing"), 4)); return behaviourValues; } diff --git a/src/main/java/module/lineup/substitution/SubstitutionEditDialog.java b/src/main/java/module/lineup/substitution/SubstitutionEditDialog.java index 6b7c11568..e3e4b5e62 100644 --- a/src/main/java/module/lineup/substitution/SubstitutionEditDialog.java +++ b/src/main/java/module/lineup/substitution/SubstitutionEditDialog.java @@ -1,28 +1,18 @@ package module.lineup.substitution; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.GUIUtils; import module.lineup.Lineup; import module.lineup.substitution.model.MatchOrderType; import module.lineup.substitution.model.Substitution; -import java.awt.BorderLayout; -import java.awt.Dialog; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JPanel; - public class SubstitutionEditDialog extends JDialog { private static final long serialVersionUID = 1875761460780943159L; @@ -68,21 +58,21 @@ private void setDlgTitle() { case POSITION_SWAP -> "subs.TypeSwap"; case MAN_MARKING -> "subs.TypeManMarking"; }; - setTitle(HOVerwaltung.instance().getLanguageString(dlgTitleKey)); + setTitle(TranslationFacility.tr(dlgTitleKey)); } private void initComponents() { getContentPane().setLayout(new BorderLayout()); JPanel buttonPanel = new JPanel(new GridBagLayout()); - JButton okButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.ok")); + JButton okButton = new JButton(TranslationFacility.tr("ls.button.ok")); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 1.0; gbc.insets = new Insets(12, 8, 8, 2); buttonPanel.add(okButton, gbc); - JButton cancelButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + JButton cancelButton = new JButton(TranslationFacility.tr("ls.button.cancel")); gbc.gridx = 1; gbc.weightx = 0.0; gbc.insets = new Insets(12, 2, 8, 8); @@ -112,7 +102,7 @@ public void actionPerformed(ActionEvent e) { } }; - cancelAction.putValue(Action.NAME, HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + cancelAction.putValue(Action.NAME, TranslationFacility.tr("ls.button.cancel")); cancelButton.setAction(cancelAction); GUIUtils.decorateWithActionOnESC(this, cancelAction); diff --git a/src/main/java/module/lineup/substitution/SubstitutionEditView.java b/src/main/java/module/lineup/substitution/SubstitutionEditView.java index 0fa2f0e3f..1e448ff50 100644 --- a/src/main/java/module/lineup/substitution/SubstitutionEditView.java +++ b/src/main/java/module/lineup/substitution/SubstitutionEditView.java @@ -2,6 +2,7 @@ import core.datatype.CBItem; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import core.util.Helper; import module.lineup.Lineup; @@ -350,10 +351,10 @@ private void initComponents() { JLabel playerLabel = new JLabel(); switch (this.orderType) { - case SUBSTITUTION -> playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.Out")); - case POSITION_SWAP -> playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.Reposition")); - case NEW_BEHAVIOUR -> playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.Player")); - case MAN_MARKING -> playerLabel.setText(HOVerwaltung.instance().getLanguageString("subs.manMarkingPlayer")); + case SUBSTITUTION -> playerLabel.setText(TranslationFacility.tr("subs.Out")); + case POSITION_SWAP -> playerLabel.setText(TranslationFacility.tr("subs.Reposition")); + case NEW_BEHAVIOUR -> playerLabel.setText(TranslationFacility.tr("subs.Player")); + case MAN_MARKING -> playerLabel.setText(TranslationFacility.tr("subs.manMarkingPlayer")); } GridBagConstraints gbc = new GridBagConstraints(); @@ -376,12 +377,12 @@ private void initComponents() { if ( this.orderType != MatchOrderType.NEW_BEHAVIOUR) { JLabel playerInLabel = new JLabel(); if (this.orderType == MatchOrderType.SUBSTITUTION) { - playerInLabel.setText(HOVerwaltung.instance().getLanguageString("subs.In")); + playerInLabel.setText(TranslationFacility.tr("subs.In")); } else if (this.orderType == MatchOrderType.POSITION_SWAP){ - playerInLabel.setText(HOVerwaltung.instance().getLanguageString("subs.RepositionWith")); + playerInLabel.setText(TranslationFacility.tr("subs.RepositionWith")); } else { - playerInLabel.setText(HOVerwaltung.instance().getLanguageString("subs.manMarkedOpponentPlayer")); + playerInLabel.setText(TranslationFacility.tr("subs.manMarkedOpponentPlayer")); } gbc.gridx = 0; gbc.gridy++; @@ -400,8 +401,7 @@ private void initComponents() { if( this.orderType != MatchOrderType.MAN_MARKING) { this.behaviourComboBox = new JComboBox(); if (this.orderType != MatchOrderType.POSITION_SWAP ) { - JLabel behaviourLabel = new JLabel(HOVerwaltung.instance() - .getLanguageString("subs.Behavior")); + JLabel behaviourLabel = new JLabel(TranslationFacility.tr("subs.Behavior")); gbc.gridx = 0; gbc.gridy++; gbc.anchor = GridBagConstraints.WEST; @@ -417,16 +417,15 @@ private void initComponents() { } if ( this.orderType != MatchOrderType.MAN_MARKING) { - JLabel whenLabel = new JLabel(HOVerwaltung.instance() - .getLanguageString("subs.When")); + JLabel whenLabel = new JLabel(TranslationFacility.tr("subs.When")); gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(4, 10, 4, 2); add(whenLabel, gbc); - this.whenTextField = new WhenTextField(HOVerwaltung.instance() - .getLanguageString("subs.MinuteAnytime"), HOVerwaltung - .instance().getLanguageString("subs.MinuteAfterX")); + this.whenTextField = new WhenTextField( + TranslationFacility.tr("subs.MinuteAnytime"), + TranslationFacility.tr("subs.MinuteAfterX")); Dimension textFieldSize = new Dimension(200, this.whenTextField.getPreferredSize().height); this.whenTextField.setMinimumSize(textFieldSize); @@ -451,15 +450,14 @@ private void initComponents() { gbc.insets = new Insets(8, 4, 8, 4); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; - add(new Divider(HOVerwaltung.instance().getLanguageString( + add(new Divider(TranslationFacility.tr( "subs.AdvancedConditions")), gbc); gbc.gridwidth = 1; gbc.weightx = 0.0; if (this.orderType != MatchOrderType.POSITION_SWAP) { - JLabel positionLabel = new JLabel(HOVerwaltung.instance() - .getLanguageString("subs.Position")); + JLabel positionLabel = new JLabel(TranslationFacility.tr("subs.Position")); gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(4, 10, 4, 2); @@ -479,8 +477,7 @@ private void initComponents() { add(this.positionChooser, gbc); } - JLabel redCardsLabel = new JLabel(HOVerwaltung.instance() - .getLanguageString("subs.RedCard")); + JLabel redCardsLabel = new JLabel(TranslationFacility.tr("subs.RedCard")); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy++; @@ -495,8 +492,7 @@ private void initComponents() { gbc.insets = new Insets(4, 2, 4, 10); add(this.redCardsComboBox, gbc); - JLabel standingLabel = new JLabel(HOVerwaltung.instance() - .getLanguageString("subs.Standing")); + JLabel standingLabel = new JLabel(TranslationFacility.tr("subs.Standing")); gbc.gridx = 0; gbc.gridy++; gbc.insets = new Insets(4, 10, 4, 2); diff --git a/src/main/java/module/lineup/substitution/SubstitutionOverview.java b/src/main/java/module/lineup/substitution/SubstitutionOverview.java index b07c349f0..e6a1d3bd5 100644 --- a/src/main/java/module/lineup/substitution/SubstitutionOverview.java +++ b/src/main/java/module/lineup/substitution/SubstitutionOverview.java @@ -5,6 +5,7 @@ import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.GUIUtils; import module.lineup.Lineup; import module.lineup.substitution.model.MatchOrderType; @@ -14,36 +15,19 @@ import module.lineup.substitution.plausibility.Problem; import module.lineup.substitution.plausibility.Uncertainty; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.Window; +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableColumn; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.io.Serial; -import java.util.*; - -import javax.swing.AbstractAction; -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTable; -import javax.swing.KeyStroke; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableColumn; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; /** * Main Panel for Match Orders (i.e. substitutions) in the Lineup tab. @@ -434,18 +418,18 @@ private class SubstitutionsTableModel extends AbstractTableModel { public SubstitutionsTableModel() { this.columnNames = new String[COLUMN_COUNT]; this.columnNames[WARNING_COL_IDX] = ""; - this.columnNames[ORDERTYPE_COL_IDX] = HOVerwaltung.instance().getLanguageString( + this.columnNames[ORDERTYPE_COL_IDX] = TranslationFacility.tr( "subs.orders.colheadline.order"); - this.columnNames[SUBJECTPLAYER_COL_IDX] = HOVerwaltung.instance().getLanguageString( + this.columnNames[SUBJECTPLAYER_COL_IDX] = TranslationFacility.tr( "subs.orders.colheadline.player1"); this.columnNames[ORDERTYPE_ICON_COL_IDX] = ""; - this.columnNames[OBJECTPLAYER_COL_IDX] = HOVerwaltung.instance().getLanguageString( + this.columnNames[OBJECTPLAYER_COL_IDX] = TranslationFacility.tr( "subs.orders.colheadline.player2"); - this.columnNames[WHEN_COL_IDX] = HOVerwaltung.instance().getLanguageString( + this.columnNames[WHEN_COL_IDX] = TranslationFacility.tr( "subs.orders.colheadline.when"); - this.columnNames[STANDING_COL_IDX] = HOVerwaltung.instance().getLanguageString( + this.columnNames[STANDING_COL_IDX] = TranslationFacility.tr( "subs.orders.colheadline.standing"); - this.columnNames[CARDS_COL_IDX] = HOVerwaltung.instance().getLanguageString( + this.columnNames[CARDS_COL_IDX] = TranslationFacility.tr( "subs.orders.colheadline.cards"); } @@ -501,9 +485,9 @@ public Object getValueAt(int rowIndex, int columnIndex) { return sub.getObjectPlayerName(); case WHEN_COL_IDX: if (sub.getMatchMinuteCriteria() > 0) { - return HOVerwaltung.instance().getLanguageString("subs.MinuteAfterX", (int) sub.getMatchMinuteCriteria()); + return TranslationFacility.tr("subs.MinuteAfterX", (int) sub.getMatchMinuteCriteria()); } - return HOVerwaltung.instance().getLanguageString("subs.MinuteAnytime"); + return TranslationFacility.tr("subs.MinuteAnytime"); case STANDING_COL_IDX: return LanguageStringLookup.getStanding(sub.getStanding()); case CARDS_COL_IDX: @@ -559,7 +543,7 @@ public void setProblem(Problem problem) { private class BehaviorAction extends AbstractAction { public BehaviorAction() { - super(HOVerwaltung.instance().getLanguageString("subs.Behavior")); + super(TranslationFacility.tr("subs.Behavior")); } @Override @@ -571,7 +555,7 @@ public void actionPerformed(ActionEvent e) { private class PositionSwapAction extends AbstractAction { public PositionSwapAction() { - super(HOVerwaltung.instance().getLanguageString("subs.TypeSwap")); + super(TranslationFacility.tr("subs.TypeSwap")); } @Override @@ -583,7 +567,7 @@ public void actionPerformed(ActionEvent e) { private class SubstitutionAction extends AbstractAction { public SubstitutionAction() { - super(HOVerwaltung.instance().getLanguageString("subs.TypeSub")); + super(TranslationFacility.tr("subs.TypeSub")); } @Override @@ -595,7 +579,7 @@ public void actionPerformed(ActionEvent e) { private class ManMarkingAction extends AbstractAction { public ManMarkingAction() { - super(HOVerwaltung.instance().getLanguageString("subs.TypeManMarking")); + super(TranslationFacility.tr("subs.TypeManMarking")); } @Override @@ -607,7 +591,7 @@ public void actionPerformed(ActionEvent e) { private class RemoveAction extends AbstractAction { public RemoveAction() { - super(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + super(TranslationFacility.tr("ls.button.delete")); } @Override @@ -623,7 +607,7 @@ public void actionPerformed(ActionEvent e) { private class RemoveAllAction extends AbstractAction { public RemoveAllAction() { - super(HOVerwaltung.instance().getLanguageString("ls.button.deleteall")); + super(TranslationFacility.tr("ls.button.deleteall")); } @Override @@ -637,7 +621,7 @@ public void actionPerformed(ActionEvent e) { private class EditAction extends AbstractAction { public EditAction() { - super(HOVerwaltung.instance().getLanguageString("ls.button.edit")); + super(TranslationFacility.tr("ls.button.edit")); } @Override diff --git a/src/main/java/module/lineup/substitution/plausibility/PlausibilityCheck.java b/src/main/java/module/lineup/substitution/plausibility/PlausibilityCheck.java index e9a7ab6f4..ba0141ab3 100644 --- a/src/main/java/module/lineup/substitution/plausibility/PlausibilityCheck.java +++ b/src/main/java/module/lineup/substitution/plausibility/PlausibilityCheck.java @@ -1,13 +1,17 @@ package module.lineup.substitution.plausibility; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import module.lineup.Lineup; import module.lineup.assistant.LineupAssistant; import module.lineup.substitution.LanguageStringLookup; import module.lineup.substitution.model.Substitution; -import static module.lineup.substitution.model.MatchOrderType.*; +import static module.lineup.substitution.model.MatchOrderType.MAN_MARKING; +import static module.lineup.substitution.model.MatchOrderType.NEW_BEHAVIOUR; +import static module.lineup.substitution.model.MatchOrderType.POSITION_SWAP; +import static module.lineup.substitution.model.MatchOrderType.SUBSTITUTION; public class PlausibilityCheck { @@ -68,19 +72,19 @@ public static String getComment(Problem problem, Substitution substitution) { switch ((Error) problem) { case PLAYERIN_NOT_IN_LINEUP: case PLAYERIN_NOT_REAL: - return HOVerwaltung.instance().getLanguageString(problem.getLanguageKey(), + return TranslationFacility.tr(problem.getLanguageKey(), getPlayerIn(substitution).getFullName()); case PLAYEROUT_NOT_IN_LINEUP: case PLAYEROUT_NOT_REAL: - return HOVerwaltung.instance().getLanguageString(problem.getLanguageKey(), + return TranslationFacility.tr(problem.getLanguageKey(), getPlayerOut(substitution).getFullName()); default: - return HOVerwaltung.instance().getLanguageString(problem.getLanguageKey()); + return TranslationFacility.tr(problem.getLanguageKey()); } } else if (problem instanceof Uncertainty) { switch ((Uncertainty) problem) { case SAME_TACTIC: - return HOVerwaltung.instance().getLanguageString(problem.getLanguageKey(), + return TranslationFacility.tr(problem.getLanguageKey(), getPlayerOut(substitution).getFullName(), LanguageStringLookup.getBehaviour(substitution.getBehaviour())); } diff --git a/src/main/java/module/matches/MatchReportPanel.java b/src/main/java/module/matches/MatchReportPanel.java index c33d22dfd..8be66eb21 100644 --- a/src/main/java/module/matches/MatchReportPanel.java +++ b/src/main/java/module/matches/MatchReportPanel.java @@ -3,24 +3,20 @@ import core.gui.comp.panel.LazyImagePanel; import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchEvent; import core.model.match.MatchKurzInfo; import core.model.match.Matchdetails; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.BorderLayout; -import java.awt.Insets; -import java.util.ArrayList; -import java.util.List; + import javax.swing.*; import javax.swing.border.CompoundBorder; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; -import static core.gui.theme.HOColorName.*; +import static core.gui.theme.HOColorName.GUEST_ACTION; +import static core.gui.theme.HOColorName.HOME_ACTION; +import static core.gui.theme.HOColorName.NEUTRAL_ACTION; public class MatchReportPanel extends LazyImagePanel { @@ -216,7 +212,7 @@ else if (highlight.getMatchEventID() == MatchEvent.MatchEventID.PENALTY_CONTEST_ constraints.gridx = 0; constraints.gridy = i + 4; constraints.gridwidth = 5; - JLabel penaltyContestLabel = new JLabel(HOVerwaltung.instance().getLanguageString("MatchEvent_71_report"), SwingConstants.CENTER); + JLabel penaltyContestLabel = new JLabel(TranslationFacility.tr("MatchEvent_71_report"), SwingConstants.CENTER); f = penaltyContestLabel.getFont(); penaltyContestLabel.setFont(f.deriveFont(f.getStyle() | Font.BOLD)); penaltyContestLabel.setBackground(Color.lightGray); @@ -229,7 +225,7 @@ else if (highlight.getMatchEventID() == MatchEvent.MatchEventID.PENALTY_CONTEST_ } if (bPenaltyContest) { - String subtitle = HOVerwaltung.instance().getLanguageString("penalites") + " (" + homePenalitiesScored + "-" + guestPenalitiesScored + ")"; + String subtitle = TranslationFacility.tr("penalites") + " (" + homePenalitiesScored + "-" + guestPenalitiesScored + ")"; penaltyContestresults.setText(subtitle); } diff --git a/src/main/java/module/matches/MatchesModule.java b/src/main/java/module/matches/MatchesModule.java index dee02ea4e..309a201ba 100644 --- a/src/main/java/module/matches/MatchesModule.java +++ b/src/main/java/module/matches/MatchesModule.java @@ -1,14 +1,11 @@ package module.matches; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; -import javax.swing.KeyStroke; - - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; +import javax.swing.*; +import java.awt.event.KeyEvent; + public final class MatchesModule extends DefaultModule { public MatchesModule(){ @@ -22,7 +19,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Tab_Title_Matches"); + return TranslationFacility.tr("Tab_Title_Matches"); } @Override diff --git a/src/main/java/module/matches/MatchesPanel.java b/src/main/java/module/matches/MatchesPanel.java index 66fdcbb38..e99c132f8 100644 --- a/src/main/java/module/matches/MatchesPanel.java +++ b/src/main/java/module/matches/MatchesPanel.java @@ -13,6 +13,7 @@ import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.match.IMatchDetails; import core.model.match.MatchKurzInfo; @@ -35,14 +36,13 @@ import module.teamAnalyzer.ui.RatingUtil; import org.jetbrains.annotations.NotNull; +import javax.swing.*; +import javax.swing.event.ChangeEvent; import java.awt.*; import java.awt.event.ItemEvent; import java.time.temporal.ChronoUnit; import java.util.List; -import javax.swing.*; -import javax.swing.event.ChangeEvent; - import static core.util.Helper.getTranslation; public final class MatchesPanel extends LazyImagePanel { @@ -195,10 +195,10 @@ private void deleteSelectedMatches() { } StringBuilder text = new StringBuilder(100); - text.append(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + text.append(TranslationFacility.tr("ls.button.delete")); if (infos.length > 1) { text.append(" (").append(infos.length).append(" "); - text.append(HOVerwaltung.instance().getLanguageString("Spiele")); + text.append(TranslationFacility.tr("Spiele")); text.append(")"); } text.append(":"); @@ -211,7 +211,7 @@ private void deleteSelectedMatches() { } int value = JOptionPane.showConfirmDialog(MatchesPanel.this, text, - HOVerwaltung.instance().getLanguageString("confirmation.title"), JOptionPane.YES_NO_OPTION); + TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); if (value == JOptionPane.YES_OPTION) { for (MatchKurzInfo info : infos) { @@ -389,23 +389,23 @@ private Component initSpieldetails() { // Allgemein StaerkenvergleichPanel teamsComparePanel = new StaerkenvergleichPanel(this.matchesModel); - matchDetailsTabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Allgemein"), + matchDetailsTabbedPane.addTab(TranslationFacility.tr("Allgemein"), new JScrollPane(teamsComparePanel)); // Rating Panel TeamsRatingPanel m_jpTeamsRatingPanel = new TeamsRatingPanel(this.matchesModel); - matchDetailsTabbedPane.addTab(HOVerwaltung.instance().getLanguageString("matches.tabtitle.ratings"), + matchDetailsTabbedPane.addTab(TranslationFacility.tr("matches.tabtitle.ratings"), new JScrollPane(m_jpTeamsRatingPanel)); // Highlights SpielHighlightPanel matchHighlightPanel = new SpielHighlightPanel(this.matchesModel); - matchDetailsTabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Highlights"), + matchDetailsTabbedPane.addTab(TranslationFacility.tr("Highlights"), new JScrollPane(matchHighlightPanel)); // Match report MatchReportPanel matchReportPanel = new MatchReportPanel(this.matchesModel); - matchDetailsTabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Matchbericht"), + matchDetailsTabbedPane.addTab(TranslationFacility.tr("Matchbericht"), matchReportPanel); mainpanel.add(matchDetailsTabbedPane, BorderLayout.CENTER); @@ -414,7 +414,7 @@ private Component initSpieldetails() { // Reloadbutton reloadMatchButton = new JButton(ThemeManager.getIcon(HOIconName.RELOAD)); - reloadMatchButton.setToolTipText(HOVerwaltung.instance().getLanguageString( + reloadMatchButton.setToolTipText(TranslationFacility.tr( "tt_Spiel_reload")); reloadMatchButton.setPreferredSize(new Dimension(24, 24)); reloadMatchButton.setEnabled(false); @@ -422,20 +422,20 @@ private Component initSpieldetails() { deleteButton = new JButton(ThemeManager.getIcon(HOIconName.REMOVE)); deleteButton.setBackground(ThemeManager.getColor(HOColorName.BUTTON_BG)); - deleteButton.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Spiel_loeschen")); + deleteButton.setToolTipText(TranslationFacility.tr("tt_Spiel_loeschen")); deleteButton.setPreferredSize(new Dimension(24, 24)); deleteButton.setEnabled(false); buttonPanel.add(deleteButton); adoptLineupButton = new JButton(ThemeManager.getIcon(HOIconName.GETLINEUP)); - adoptLineupButton.setToolTipText(HOVerwaltung.instance().getLanguageString( + adoptLineupButton.setToolTipText(TranslationFacility.tr( "tt_Spiel_aufstellunguebernehmen")); adoptLineupButton.setPreferredSize(new Dimension(24, 24)); adoptLineupButton.setEnabled(false); buttonPanel.add(adoptLineupButton); simulateMatchButton = new JButton(ThemeManager.getIcon(HOIconName.SIMULATEMATCH)); - simulateMatchButton.setToolTipText(HOVerwaltung.instance().getLanguageString("Simulate")); + simulateMatchButton.setToolTipText(TranslationFacility.tr("Simulate")); simulateMatchButton.setPreferredSize(new Dimension(24, 24)); simulateMatchButton.setEnabled(false); buttonPanel.add(simulateMatchButton); @@ -478,15 +478,14 @@ private Component initMatchesTable() { JScrollPane scrollpane3 = new JScrollPane(matchesHighlightsTable); JTabbedPane pane = new JTabbedPane(); - HOVerwaltung hov = HOVerwaltung.instance(); - pane.addTab(hov.getLanguageString("Spiele"), scrollpane); + pane.addTab(TranslationFacility.tr("Spiele"), scrollpane); pane.addTab( - hov.getLanguageString("Statistik") + " (" - + hov.getLanguageString("SerieAuswaertsSieg") + "-" - + hov.getLanguageString("SerieAuswaertsUnendschieden") + "-" - + hov.getLanguageString("SerieAuswaertsNiederlage") + ")", matchesOverviewPanel); + TranslationFacility.tr("Statistik") + " (" + + TranslationFacility.tr("SerieAuswaertsSieg") + "-" + + TranslationFacility.tr("SerieAuswaertsUnendschieden") + "-" + + TranslationFacility.tr("SerieAuswaertsNiederlage") + ")", matchesOverviewPanel); - pane.addTab(hov.getLanguageString("Statistik") + " (" + hov.getLanguageString("Tore") + pane.addTab(TranslationFacility.tr("Statistik") + " (" + TranslationFacility.tr("Tore") + ")", scrollpane3); panel.add(pane); diff --git a/src/main/java/module/matches/SpielHighlightPanel.java b/src/main/java/module/matches/SpielHighlightPanel.java index ee3b573eb..79d2465ca 100644 --- a/src/main/java/module/matches/SpielHighlightPanel.java +++ b/src/main/java/module/matches/SpielHighlightPanel.java @@ -4,24 +4,18 @@ import core.gui.comp.panel.LazyImagePanel; import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchEvent; import core.model.match.MatchKurzInfo; import core.model.match.Matchdetails; -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import javax.swing.border.CompoundBorder; +import java.awt.*; import java.io.Serial; import java.util.ArrayList; import java.util.List; -import javax.swing.*; -import javax.swing.border.CompoundBorder; - /** * Zeigt die Stärken eines Matches an. */ @@ -193,7 +187,7 @@ else if (highlight.getMatchEventID() == MatchEvent.MatchEventID.PENALTY_CONTEST_ constraints.gridx = 0; constraints.gridy = i + 4; constraints.gridwidth = 5; - JLabel penaltyContestLabel = new JLabel(HOVerwaltung.instance().getLanguageString("MatchEvent_71_report"), SwingConstants.CENTER); + JLabel penaltyContestLabel = new JLabel(TranslationFacility.tr("MatchEvent_71_report"), SwingConstants.CENTER); Font f = penaltyContestLabel.getFont(); penaltyContestLabel.setFont(f.deriveFont(f.getStyle() | Font.BOLD)); penaltyContestLabel.setBackground(Color.lightGray); @@ -209,7 +203,7 @@ else if (highlight.getMatchEventID() == MatchEvent.MatchEventID.PENALTY_CONTEST_ matchTeamsAndScores.setText(title); if (bPenaltyContest) { - String subtitle = HOVerwaltung.instance().getLanguageString("penalites") + " (" + homePenalitiesScored + "-" + guestPenalitiesScored + ")"; + String subtitle = TranslationFacility.tr("penalites") + " (" + homePenalitiesScored + "-" + guestPenalitiesScored + ")"; penaltyContestresults.setText(subtitle); } diff --git a/src/main/java/module/matches/SpielerDetailDialog.java b/src/main/java/module/matches/SpielerDetailDialog.java index eaea42524..51cf2e345 100644 --- a/src/main/java/module/matches/SpielerDetailDialog.java +++ b/src/main/java/module/matches/SpielerDetailDialog.java @@ -1,12 +1,7 @@ // %1374340947:de.hattrickorganizer.gui.matches% package module.matches; -import core.constants.player.PlayerAbility; -import core.constants.player.PlayerAggressiveness; -import core.constants.player.PlayerAgreeability; -import core.constants.player.PlayerHonesty; -import core.constants.player.PlayerSkill; -import core.constants.player.PlayerSpeciality; +import core.constants.player.*; import core.db.DBManager; import core.gui.comp.entry.ColorLabelEntry; import core.gui.comp.entry.DoubleLabelEntries; @@ -16,6 +11,7 @@ import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.match.MatchLineup; import core.model.match.MatchLineupPosition; @@ -26,25 +22,13 @@ import core.util.Helper; import module.playerOverview.PlayerStatusLabelEntry; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.Serial; import java.text.NumberFormat; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - /** * Zeigt Details zu einem Player zu einer Zeit an */ @@ -213,8 +197,8 @@ public SpielerDetailDialog(JFrame owner, MatchLineupPosition matchplayer, MatchL // Nicht gefunden if (player == null) { Helper.showMessage(owner, - HOVerwaltung.instance().getLanguageString("Fehler_Spielerdetails"), - HOVerwaltung.instance().getLanguageString("Fehler"), JOptionPane.ERROR_MESSAGE); + TranslationFacility.tr("Fehler_Spielerdetails"), + TranslationFacility.tr("Fehler"), JOptionPane.ERROR_MESSAGE); return; } @@ -280,7 +264,7 @@ private void setLabels(Player m_clPlayer) { if (m_clPlayer.getBonus() > 0) { bonus = " (" + m_clPlayer.getBonus() + "% " - + HOVerwaltung.instance().getLanguageString("Bonus") + ")"; + + TranslationFacility.tr("Bonus") + ")"; } m_jpGehalt.getLeft().setText(gehalttext + bonus); @@ -330,7 +314,7 @@ private void setLabels(Player m_clPlayer) { if (m_clPlayer.getBonus() > 0) { bonus = " (" + m_clPlayer.getBonus() + "% " - + HOVerwaltung.instance().getLanguageString("Bonus") + ")"; + + TranslationFacility.tr("Bonus") + ")"; } m_jpGehalt.getLeft().setText(gehalttext + bonus); @@ -452,7 +436,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { panel.add(label); constraints.gridheight = 1; - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.name")); + label = new JLabel(TranslationFacility.tr("ls.player.name")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 0; @@ -467,7 +451,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.age")); + label = new JLabel(TranslationFacility.tr("ls.player.age")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 1; @@ -482,7 +466,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.nationality")); + label = new JLabel(TranslationFacility.tr("ls.player.nationality")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 2; @@ -497,7 +481,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Aufgestellt")); + label = new JLabel(TranslationFacility.tr("Aufgestellt")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 3; @@ -512,8 +496,8 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Aktuell") + " " - + HOVerwaltung.instance().getLanguageString("Rating")); + label = new JLabel(TranslationFacility.tr("Aktuell") + " " + + TranslationFacility.tr("Rating")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 4; @@ -528,7 +512,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("BestePosition")); + label = new JLabel(TranslationFacility.tr("BestePosition")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 5; @@ -543,7 +527,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Gruppe")); + label = new JLabel(TranslationFacility.tr("Gruppe")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 0; @@ -560,7 +544,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Status")); + label = new JLabel(TranslationFacility.tr("Status")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 1; @@ -575,7 +559,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.wage")); + label = new JLabel(TranslationFacility.tr("ls.player.wage")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 2; @@ -590,7 +574,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.tsi")); + label = new JLabel(TranslationFacility.tr("ls.player.tsi")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 3; @@ -605,7 +589,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Rating")); + label = new JLabel(TranslationFacility.tr("Rating")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 4; @@ -631,7 +615,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { panel.add(label); constraints.gridwidth = 1; - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.experience")); + label = new JLabel(TranslationFacility.tr("ls.player.experience")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 7; @@ -652,7 +636,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.form")); + label = new JLabel(TranslationFacility.tr("ls.player.form")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 7; @@ -673,7 +657,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.stamina")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 8; @@ -694,7 +678,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.keeper")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 8; @@ -715,7 +699,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.playmaking")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 9; @@ -736,7 +720,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.passing")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.passing")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 9; @@ -757,7 +741,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.winger")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.winger")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 10; @@ -778,7 +762,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.defending")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.defending")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 10; @@ -799,7 +783,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.scoring")); constraints.gridx = 0; constraints.weightx = 0.0; constraints.gridy = 11; @@ -820,7 +804,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.setpieces")); constraints.gridx = 4; constraints.weightx = 0.0; constraints.gridy = 11; @@ -852,7 +836,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { panel.add(label); constraints.gridheight = 1; - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.leadership")); + label = new JLabel(TranslationFacility.tr("ls.player.leadership")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 0; @@ -874,7 +858,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.speciality")); + label = new JLabel(TranslationFacility.tr("ls.player.speciality")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 1; @@ -889,7 +873,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.aggressiveness")); + label = new JLabel(TranslationFacility.tr("ls.player.aggressiveness")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 2; @@ -904,7 +888,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.agreeability")); + label = new JLabel(TranslationFacility.tr("ls.player.agreeability")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 3; @@ -919,7 +903,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.honesty")); + label = new JLabel(TranslationFacility.tr("ls.player.honesty")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 4; @@ -946,7 +930,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { constraints.gridwidth = 1; constraints.gridheight = 1; - label = new JLabel(HOVerwaltung.instance().getLanguageString("ToreFreund")); + label = new JLabel(TranslationFacility.tr("ToreFreund")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 7; @@ -961,7 +945,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ToreLiga")); + label = new JLabel(TranslationFacility.tr("ToreLiga")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 8; @@ -976,7 +960,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("TorePokal")); + label = new JLabel(TranslationFacility.tr("TorePokal")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 9; @@ -991,7 +975,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.career_goals")); + label = new JLabel(TranslationFacility.tr("ls.player.career_goals")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 10; @@ -1006,7 +990,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { layout.setConstraints(component, constraints); panel.add(component); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Hattricks")); + label = new JLabel(TranslationFacility.tr("Hattricks")); constraints.gridx = 8; constraints.weightx = 0.0; constraints.gridy = 11; @@ -1057,31 +1041,30 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { subconstraints.insets = new Insets(1, 2, 1, 1); JPanel subpanel = new ImagePanel(sublayout); - subpanel.setBorder(BorderFactory.createTitledBorder(HOVerwaltung.instance() - .getLanguageString("Rating"))); + subpanel.setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr("Rating"))); subconstraints.gridx = 0; subconstraints.gridy = 0; subconstraints.weightx = 0.0; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Maximal")); + label = new JLabel(TranslationFacility.tr("Maximal")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); subconstraints.gridx = 0; subconstraints.gridy = 1; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Minimal")); + label = new JLabel(TranslationFacility.tr("Minimal")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); subconstraints.gridx = 0; subconstraints.gridy = 2; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Durchschnitt")); + label = new JLabel(TranslationFacility.tr("Durchschnitt")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); subconstraints.gridx = 0; subconstraints.gridy = 3; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Spiele")); + label = new JLabel(TranslationFacility.tr("Spiele")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); @@ -1154,8 +1137,7 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { subconstraints.weighty = 0.0; subconstraints.insets = new Insets(1, 2, 1, 1); subpanel = new ImagePanel(sublayout); - subpanel.setBorder(BorderFactory.createTitledBorder(HOVerwaltung.instance() - .getLanguageString("Rating") + subpanel.setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr("Rating") + " " + MatchRoleID.getNameForPosition(MatchRoleID .getPosition(matchplayer.getRoleId(), matchplayer.getBehaviour())))); @@ -1163,25 +1145,25 @@ private void initComponents(Player player, MatchLineupPosition matchplayer) { subconstraints.gridx = 0; subconstraints.gridy = 0; subconstraints.weightx = 0.0; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Maximal")); + label = new JLabel(TranslationFacility.tr("Maximal")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); subconstraints.gridx = 0; subconstraints.gridy = 1; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Minimal")); + label = new JLabel(TranslationFacility.tr("Minimal")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); subconstraints.gridx = 0; subconstraints.gridy = 2; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Durchschnitt")); + label = new JLabel(TranslationFacility.tr("Durchschnitt")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); subconstraints.gridx = 0; subconstraints.gridy = 3; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Spiele")); + label = new JLabel(TranslationFacility.tr("Spiele")); sublayout.setConstraints(label, subconstraints); subpanel.add(label); diff --git a/src/main/java/module/matches/SpielerSternePanel.java b/src/main/java/module/matches/SpielerSternePanel.java index 3340fd6eb..b8d6a9c8a 100644 --- a/src/main/java/module/matches/SpielerSternePanel.java +++ b/src/main/java/module/matches/SpielerSternePanel.java @@ -6,7 +6,7 @@ import core.gui.comp.panel.ImagePanel; import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchLineup; import core.model.match.MatchLineupPosition; import core.model.player.IMatchRoleID; @@ -15,24 +15,11 @@ import core.util.Helper; import core.util.StringUtils; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - /** * Zeigt den Player an der Position an und dessen Sterne */ @@ -135,7 +122,7 @@ private final void initComponents() { panel.setBackground(ColorLabelEntry.BG_STANDARD); panel.setOpaque(true); - m_jbSpieler.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString( + m_jbSpieler.setToolTipText(TranslationFacility.tr( "tt_Spiel_Spielerdetails")); m_jbSpieler.setHorizontalAlignment(SwingConstants.LEFT); m_jbSpieler.setMargin(new Insets(0, 1, 0, 1)); @@ -254,38 +241,38 @@ protected final void initLabel(int posid, byte taktik) { switch (posid) { case IMatchRoleID.setPieces: { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("match.setpiecestaker")); + m_jlPosition.setText(TranslationFacility.tr("match.setpiecestaker")); break; } case IMatchRoleID.captain: { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("Spielfuehrer")); + m_jlPosition.setText(TranslationFacility.tr("Spielfuehrer")); break; } case IMatchRoleID.substCD1: { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("Reserve") + " " - + HOVerwaltung.instance().getLanguageString("defender")); + m_jlPosition.setText(TranslationFacility.tr("Reserve") + " " + + TranslationFacility.tr("defender")); break; } case IMatchRoleID.substFW1: { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("Reserve") + " " - + HOVerwaltung.instance().getLanguageString("ls.player.position.forward")); + m_jlPosition.setText(TranslationFacility.tr("Reserve") + " " + + TranslationFacility.tr("ls.player.position.forward")); break; } case IMatchRoleID.substWI1: { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("Reserve") + " " - + HOVerwaltung.instance().getLanguageString("ls.player.position.winger")); + m_jlPosition.setText(TranslationFacility.tr("Reserve") + " " + + TranslationFacility.tr("ls.player.position.winger")); break; } case IMatchRoleID.substIM1: { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("Reserve") + m_jlPosition.setText(TranslationFacility.tr("Reserve") + " " - + HOVerwaltung.instance().getLanguageString( + + TranslationFacility.tr( "ls.player.position.innermidfielder")); break; } case IMatchRoleID.substGK1: { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("Reserve") + " " - + HOVerwaltung.instance().getLanguageString("ls.player.position.keeper")); + m_jlPosition.setText(TranslationFacility.tr("Reserve") + " " + + TranslationFacility.tr("ls.player.position.keeper")); break; } default: { @@ -293,7 +280,7 @@ protected final void initLabel(int posid, byte taktik) { // least 3... if ((posid >= IMatchRoleID.FirstPlayerReplaced) && (posid <= IMatchRoleID.ThirdPlayerReplaced)) { - m_jlPosition.setText(HOVerwaltung.instance().getLanguageString("Ausgewechselt")); + m_jlPosition.setText(TranslationFacility.tr("Ausgewechselt")); break; } else { diff --git a/src/main/java/module/matches/StaerkenvergleichPanel.java b/src/main/java/module/matches/StaerkenvergleichPanel.java index 802d4d5e1..5f1a5310a 100644 --- a/src/main/java/module/matches/StaerkenvergleichPanel.java +++ b/src/main/java/module/matches/StaerkenvergleichPanel.java @@ -12,23 +12,15 @@ import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.*; -import core.model.match.MatchLineupPosition; import core.model.player.IMatchRoleID; import core.util.Helper; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - /** * Zeigt die Stärken eines Matches an */ @@ -130,7 +122,7 @@ protected void update() { String name4matchtyp = info.getMatchType().getName(); if ((details.getZuschauer() <= 0) && (info.getMatchType().getSourceString().equals("hattrick"))) { - name4matchtyp += (" ( " + HOVerwaltung.instance().getLanguageString("Reload_Match") + " )"); + name4matchtyp += (" ( " + TranslationFacility.tr("Reload_Match") + " )"); } matchtypLabel.setText(name4matchtyp); @@ -295,7 +287,7 @@ private void initComponents() { layout.setConstraints(label, constraints); panel.add(label); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Zuschauer")); + label = new JLabel(TranslationFacility.tr("Zuschauer")); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 0.0; @@ -316,7 +308,7 @@ private void initComponents() { layout.setConstraints(zuschauerLabel, constraints); panel.add(zuschauerLabel); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.match.weather")); + label = new JLabel(TranslationFacility.tr("ls.match.weather")); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 0.0; @@ -349,7 +341,7 @@ private void initComponents() { layout.setConstraints(label, constraints); panel.add(label); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Heim")); + label = new JLabel(TranslationFacility.tr("Heim")); label.setFont(label.getFont().deriveFont(Font.BOLD, label.getFont().getSize() + 1)); label.setHorizontalAlignment(SwingConstants.LEFT); constraints.anchor = GridBagConstraints.CENTER; @@ -361,7 +353,7 @@ private void initComponents() { layout.setConstraints(label, constraints); panel.add(label); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Gast")); + label = new JLabel(TranslationFacility.tr("Gast")); label.setFont(label.getFont().deriveFont(Font.BOLD, label.getFont().getSize() + 1)); label.setHorizontalAlignment(SwingConstants.LEFT); constraints.anchor = GridBagConstraints.CENTER; @@ -374,7 +366,7 @@ private void initComponents() { panel.add(label); // Teams mit Ergebnis - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.match.result")); + label = new JLabel(TranslationFacility.tr("ls.match.result")); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 0.0; @@ -426,7 +418,7 @@ private void initComponents() { panel.add(gastTeamToreLabel); // Sterne - label = new JLabel(HOVerwaltung.instance().getLanguageString("Rating")); + label = new JLabel(TranslationFacility.tr("Rating")); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 0.0; @@ -475,8 +467,7 @@ private void initComponents() { panel.add(gastSterneLabel); // HatStats - label = new JLabel(HOVerwaltung.instance() - .getLanguageString("ls.match.ratingtype.hatstats")); + label = new JLabel(TranslationFacility.tr("ls.match.ratingtype.hatstats")); add(panel, label, layout, constraints, 0, 6); heimTeamHatstatsLabel = new JLabel(); add(panel, heimTeamHatstatsLabel, layout, constraints, 1, 6); @@ -484,7 +475,7 @@ private void initComponents() { add(panel, gastTeamHatstatsLabel, layout, constraints, 4, 6); // LoddarStats - label = new JLabel(HOVerwaltung.instance().getLanguageString( + label = new JLabel(TranslationFacility.tr( "ls.match.ratingtype.loddarstats")); add(panel, label, layout, constraints, 0, 7); heimTeamLoddarLabel = new JLabel(); @@ -493,7 +484,7 @@ private void initComponents() { add(panel, gastTeamLoddarLabel, layout, constraints, 4, 7); // Einstellung - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.team.teamattitude")); + label = new JLabel(TranslationFacility.tr("ls.team.teamattitude")); add(panel, label, layout, constraints, 0, 8); heimEinstellungLabel = new JLabel(); add(panel, heimEinstellungLabel, layout, constraints, 1, 8); @@ -501,7 +492,7 @@ private void initComponents() { add(panel, gastEinstellungLabel, layout, constraints, 4, 8); // Taktiktyp - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.team.tactic")); + label = new JLabel(TranslationFacility.tr("ls.team.tactic")); add(panel, label, layout, constraints, 0, 9); heimTaktikLabel = new JLabel(); add(panel, heimTaktikLabel, layout, constraints, 1, 9); @@ -509,7 +500,7 @@ private void initComponents() { add(panel, gastTaktikLabel, layout, constraints, 4, 9); // Taktikskill - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.team.tacticalskill")); + label = new JLabel(TranslationFacility.tr("ls.team.tacticalskill")); add(panel, label, layout, constraints, 0, 10); heimTaktikskillLabel = new JLabel(); add(panel, heimTaktikskillLabel, layout, constraints, 1, 10); @@ -517,7 +508,7 @@ private void initComponents() { add(panel, gastTaktikskillLabel, layout, constraints, 4, 10); // StyleOfPlay - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.team.styleofPlay")); + label = new JLabel(TranslationFacility.tr("ls.team.styleofPlay")); add(panel, label, layout, constraints, 0, 11); homeStyleOfPlayLabel = new JLabel(); add(panel, homeStyleOfPlayLabel, layout, constraints, 1, 11); @@ -525,7 +516,7 @@ private void initComponents() { add(panel, awayStyleOfPlayLabel, layout, constraints, 4, 11); // Stimmung - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit")); + label = new JLabel(TranslationFacility.tr("ls.team.teamspirit")); add(panel, label, layout, constraints, 0, 12); heimStimmungLabel = new JLabel(); add(panel, heimStimmungLabel, layout, constraints, 1, 12); @@ -533,7 +524,7 @@ private void initComponents() { add(panel, gastStimmungLabel, layout, constraints, 4, 12); // Selbstvertrauen - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.team.confidence")); + label = new JLabel(TranslationFacility.tr("ls.team.confidence")); label.setPreferredSize(new Dimension(label.getPreferredSize().width + 10, label .getPreferredSize().height)); add(panel, label, layout, constraints, 0, 13); @@ -618,9 +609,9 @@ private double getStars(List players) { private String getEinstellungText(int einstellung) { return switch (einstellung) { - case IMatchDetails.EINSTELLUNG_NORMAL -> HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.normal"); - case IMatchDetails.EINSTELLUNG_PIC -> HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.playitcool"); - case IMatchDetails.EINSTELLUNG_MOTS -> HOVerwaltung.instance().getLanguageString( + case IMatchDetails.EINSTELLUNG_NORMAL -> TranslationFacility.tr("ls.team.teamattitude.normal"); + case IMatchDetails.EINSTELLUNG_PIC -> TranslationFacility.tr("ls.team.teamattitude.playitcool"); + case IMatchDetails.EINSTELLUNG_MOTS -> TranslationFacility.tr( "ls.team.teamattitude.matchoftheseason"); default -> ""; }; diff --git a/src/main/java/module/matches/statistics/MatchesHighlightsTable.java b/src/main/java/module/matches/statistics/MatchesHighlightsTable.java index 9d0c98d46..317beba21 100644 --- a/src/main/java/module/matches/statistics/MatchesHighlightsTable.java +++ b/src/main/java/module/matches/statistics/MatchesHighlightsTable.java @@ -2,20 +2,20 @@ import core.db.DBManager; import core.gui.comp.renderer.TableHeaderRenderer1; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.match.MatchesHighlightsStat; import module.matches.MatchLocation; import module.matches.MatchesPanel; import tool.updater.TableModel; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; + +import javax.swing.*; import java.awt.*; public class MatchesHighlightsTable extends JTable { - private String[] columns = {HOVerwaltung.instance().getLanguageString("Highlights"),HOVerwaltung.instance().getLanguageString("Gesamt"),HOVerwaltung.instance().getLanguageString("Tore"),"%"}; + private String[] columns = {TranslationFacility.tr("Highlights"),TranslationFacility.tr("Gesamt"),TranslationFacility.tr("Tore"),"%"}; public MatchesHighlightsTable(int iMatchType){ super(); diff --git a/src/main/java/module/matches/statistics/MatchesOverviewCommonPanel.java b/src/main/java/module/matches/statistics/MatchesOverviewCommonPanel.java index 4598789e0..979840abe 100644 --- a/src/main/java/module/matches/statistics/MatchesOverviewCommonPanel.java +++ b/src/main/java/module/matches/statistics/MatchesOverviewCommonPanel.java @@ -3,17 +3,13 @@ import core.db.DBManager; import core.gui.comp.panel.ImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchKurzInfo; import core.util.StringUtils; import module.matches.MatchesPanel; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; - -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.SwingConstants; +import javax.swing.*; +import java.awt.*; @@ -57,34 +53,34 @@ private void initialize() { setLayout(layout); - JLabel label = new JLabel(HOVerwaltung.instance().getLanguageString("HighestVictory")); + JLabel label = new JLabel(TranslationFacility.tr("HighestVictory")); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.FIRST_LINE_START; add(label,1,1,2); add(teamNames[HighestVictory],1,2,1); add(resultLabels[HighestVictory],2,2,1); - add(new JLabel(HOVerwaltung.instance().getLanguageString("HighestDefeat")),1,3,2); + add(new JLabel(TranslationFacility.tr("HighestDefeat")),1,3,2); add(teamNames[HighestDefeat],1,4,1); add(resultLabels[HighestDefeat],2,4,1); add(new JLabel(" "),1,5,2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("WonWithoutOppGoal")),1,6,1); + add(new JLabel(TranslationFacility.tr("WonWithoutOppGoal")),1,6,1); add(resultLabels[WonWithoutOppGoal],2,6,1); - add(new JLabel(HOVerwaltung.instance().getLanguageString("LostWithoutOwnGoal")),1,7,1); + add(new JLabel(TranslationFacility.tr("LostWithoutOwnGoal")),1,7,1); add(resultLabels[LostWithoutOwnGoal],2,7,1); add(new JLabel(" "),1,8,2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("5GoalsDiffWin")),1,9,1); + add(new JLabel(TranslationFacility.tr("5GoalsDiffWin")),1,9,1); add(resultLabels[FiveGoalsDiffWin],2,9,1); - add(new JLabel(HOVerwaltung.instance().getLanguageString("5GoalsDiffDefeat")),1,10,1); + add(new JLabel(TranslationFacility.tr("5GoalsDiffDefeat")),1,10,1); add(resultLabels[FiveGoalsDiffDefeat],2,10,1); add(new JLabel(" "),1,11,2); - add(new JLabel(HOVerwaltung.instance().getLanguageString("TrailingHTWinningFT")),1,12,1); + add(new JLabel(TranslationFacility.tr("TrailingHTWinningFT")),1,12,1); add(resultLabels[TrailingHTWinningFT],2,12,1); - add(new JLabel(HOVerwaltung.instance().getLanguageString("LeadingHTLosingFT")),1,13,1); + add(new JLabel(TranslationFacility.tr("LeadingHTLosingFT")),1,13,1); add(resultLabels[LeadingHTLosingFT],2,13,1); // add(new JLabel(" "),1,14,2); -// add(new JLabel(HOVerwaltung.instance().getLanguageString("highlight_yellowcard")),1,15,1); +// add(new JLabel(TranslationFacility.tr("highlight_yellowcard")),1,15,1); // add(resultLabels[YELLOW_CARDS],2,15,1); -// add(new JLabel(HOVerwaltung.instance().getLanguageString("highlight_redcard")),1,16,1); +// add(new JLabel(TranslationFacility.tr("highlight_redcard")),1,16,1); // add(resultLabels[RED_CARDS],2,16,1); refresh(matchtypes); diff --git a/src/main/java/module/misc/MiscModule.java b/src/main/java/module/misc/MiscModule.java index 9b08c44e5..7bed7e7c0 100644 --- a/src/main/java/module/misc/MiscModule.java +++ b/src/main/java/module/misc/MiscModule.java @@ -1,12 +1,10 @@ package module.misc; -import java.awt.event.KeyEvent; - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; -import javax.swing.JPanel; -import javax.swing.KeyStroke; +import javax.swing.*; +import java.awt.event.KeyEvent; public final class MiscModule extends DefaultModule { @@ -22,7 +20,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Verschiedenes"); + return TranslationFacility.tr("Verschiedenes"); } @Override diff --git a/src/main/java/module/misc/MiscPanel.java b/src/main/java/module/misc/MiscPanel.java index 161e2f6e7..4cec09919 100644 --- a/src/main/java/module/misc/MiscPanel.java +++ b/src/main/java/module/misc/MiscPanel.java @@ -5,22 +5,17 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.misc.Economy; import core.model.misc.Verein; import core.model.player.Player; import core.util.Helper; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.text.DecimalFormat; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; - import static core.util.Helper.getTranslation; @@ -97,46 +92,46 @@ private void initComponents() { setLayout(layout); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Jugend")); + label = new JLabel(TranslationFacility.tr("Jugend")); add(label,m_jpJugend.getComponent(false),1); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Fans")); + label = new JLabel(TranslationFacility.tr("Fans")); add(label,m_jpFansAnzahl.getComponent(false),2); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Fans")); + label = new JLabel(TranslationFacility.tr("Fans")); add(label,m_jpFans.getComponent(false),3); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Sponsoren")); + label = new JLabel(TranslationFacility.tr("Sponsoren")); add(label,m_jpSponsoren.getComponent(false),4); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Ungeschlagen")); + label = new JLabel(TranslationFacility.tr("Ungeschlagen")); add(label,m_jpUngeschlagen.getComponent(false),5); - label = new JLabel(HOVerwaltung.instance().getLanguageString("SiegeInFolge")); + label = new JLabel(TranslationFacility.tr("SiegeInFolge")); add(label,m_jpSiegeInFolge.getComponent(false),6); - label = new JLabel(HOVerwaltung.instance().getLanguageString("AnzahlSpieler")); + label = new JLabel(TranslationFacility.tr("AnzahlSpieler")); add(label,m_jpAnzahlSpieler.getComponent(false),7); - label = new JLabel(HOVerwaltung.instance().getLanguageString("AverageTSI")); + label = new JLabel(TranslationFacility.tr("AverageTSI")); add(label,m_jpAvgTSI.getComponent(false),8); - label = new JLabel(HOVerwaltung.instance().getLanguageString("TotalTSI")); + label = new JLabel(TranslationFacility.tr("TotalTSI")); add(label,m_jpSumTSI.getComponent(false),9); - label = new JLabel(HOVerwaltung.instance().getLanguageString("AverageEPV")); + label = new JLabel(TranslationFacility.tr("AverageEPV")); add(label,m_jpAvgEPV.getComponent(false),10); - label = new JLabel(HOVerwaltung.instance().getLanguageString("TotalEPV")); + label = new JLabel(TranslationFacility.tr("TotalEPV")); add(label,m_jpSumEPV.getComponent(false),11); - label = new JLabel(HOVerwaltung.instance().getLanguageString("DurchschnittForm")); + label = new JLabel(TranslationFacility.tr("DurchschnittForm")); add(label,m_jpDForm.getComponent(false),12); - label = new JLabel(HOVerwaltung.instance().getLanguageString("DurchschnittErfahrung")); + label = new JLabel(TranslationFacility.tr("DurchschnittErfahrung")); add(label,m_jpDErfahrung.getComponent(false),13); - label = new JLabel(HOVerwaltung.instance().getLanguageString("DurchschnittAlter")); + label = new JLabel(TranslationFacility.tr("DurchschnittAlter")); add(label,m_jpDAlter.getComponent(false),14); } diff --git a/src/main/java/module/misc/StaffPanel.java b/src/main/java/module/misc/StaffPanel.java index 73977fd0b..c200f6c0e 100755 --- a/src/main/java/module/misc/StaffPanel.java +++ b/src/main/java/module/misc/StaffPanel.java @@ -6,18 +6,13 @@ import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; import core.model.StaffMember; +import core.model.TranslationFacility; import core.model.misc.Verein; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; - import static core.util.Helper.getTranslation; @@ -70,7 +65,6 @@ private void initComponents() { this.setBackground(ThemeManager.getColor(HOColorName.PANEL_BG)); - HOVerwaltung hoV = HOVerwaltung.instance(); var title = getTranslation("Trainerstab"); var titledBorder = BorderFactory.createTitledBorder(title); titledBorder.setTitleColor(ThemeManager.getColor(HOColorName.LINEUP_HIGHLIGHT_FG)); @@ -94,7 +88,7 @@ private void initComponents() { add(new JLabel(staffMember.getStaffType().getName()), constraints); constraints.gridx = 1; add(new JLabel(staffMember.getName()), constraints); - String levelText = core.model.HOVerwaltung.instance().getLanguageString("ls.club.staff.level") + + String levelText = TranslationFacility.tr("ls.club.staff.level") + ": " + staffMember.getLevel(); constraints.gridx = 2; add(new JLabel(levelText), constraints); @@ -107,35 +101,35 @@ private void initComponents() { constraints.gridwidth = 3; - add(new JLabel("------ "+ hoV.getLanguageString("ls.club.staff.stafflevels") + "------"), constraints); + add(new JLabel("------ "+ TranslationFacility.tr("ls.club.staff.stafflevels") + "------"), constraints); nextYvalue++; } - label = new JLabel(hoV.getLanguageString("ls.club.staff.assistantcoach")); + label = new JLabel(TranslationFacility.tr("ls.club.staff.assistantcoach")); add(label,assistantCoachesLabel.getComponent(false), nextYvalue); nextYvalue++; - label = new JLabel(hoV.getLanguageString("ls.club.staff.medic")); + label = new JLabel(TranslationFacility.tr("ls.club.staff.medic")); add(label,doctorsLabel.getComponent(false), nextYvalue); nextYvalue++; - label = new JLabel(hoV.getLanguageString("ls.club.staff.spokesperson")); + label = new JLabel(TranslationFacility.tr("ls.club.staff.spokesperson")); add(label,spokepersonsLabel.getComponent(false), nextYvalue); nextYvalue++; - label = new JLabel(hoV.getLanguageString("ls.club.staff.sportspsychologist")); + label = new JLabel(TranslationFacility.tr("ls.club.staff.sportspsychologist")); add(label,psychologistsLabel.getComponent(false), nextYvalue); nextYvalue++; - label = new JLabel(hoV.getLanguageString("ls.club.staff.formcoach")); + label = new JLabel(TranslationFacility.tr("ls.club.staff.formcoach")); add(label,formCoachLabel.getComponent(false), nextYvalue); nextYvalue++; - label = new JLabel(hoV.getLanguageString("ls.club.staff.financialdirector")); + label = new JLabel(TranslationFacility.tr("ls.club.staff.financialdirector")); add(label,financialdirectorLabel.getComponent(false), nextYvalue); nextYvalue++; - label = new JLabel(hoV.getLanguageString("ls.club.staff.tacticalassistant")); + label = new JLabel(TranslationFacility.tr("ls.club.staff.tacticalassistant")); add(label,tacticalAssistantLabel.getComponent(false), nextYvalue); nextYvalue++; diff --git a/src/main/java/module/misc/TeamPanel.java b/src/main/java/module/misc/TeamPanel.java index 106e863cf..9f2aff6bb 100644 --- a/src/main/java/module/misc/TeamPanel.java +++ b/src/main/java/module/misc/TeamPanel.java @@ -5,17 +5,12 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.misc.Basics; import core.model.series.Liga; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; - -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; +import javax.swing.*; +import java.awt.*; import static core.util.Helper.getTranslation; @@ -85,36 +80,34 @@ private void initComponents() { setBorder(titledBorder); setLayout(layout); - HOVerwaltung hoV = HOVerwaltung.instance(); - - label = new JLabel(hoV.getLanguageString("ls.team.id")); + label = new JLabel(TranslationFacility.tr("ls.team.id")); add(label,teamIdLabel.getComponent(false),1); - label = new JLabel(hoV.getLanguageString("Verein")); + label = new JLabel(TranslationFacility.tr("Verein")); add(label,teamLabel.getComponent(false),2); - label = new JLabel(hoV.getLanguageString("Manager")); + label = new JLabel(TranslationFacility.tr("Manager")); add(label,managerLabel.getComponent(false),3); - label = new JLabel(hoV.getLanguageString("Stadion")); + label = new JLabel(TranslationFacility.tr("Stadion")); add(label,arenaLabel.getComponent(false),4); - label = new JLabel(hoV.getLanguageString("Season")); + label = new JLabel(TranslationFacility.tr("Season")); add(label,seasonLabel.getComponent(false),5); - label = new JLabel(hoV.getLanguageString("Spieltag")); + label = new JLabel(TranslationFacility.tr("Spieltag")); add(label,matchRoundLabel.getComponent(false),6); - label = new JLabel(hoV.getLanguageString("Liga")); + label = new JLabel(TranslationFacility.tr("Liga")); add(label,leagueLabel.getComponent(false),7); - label = new JLabel(hoV.getLanguageString("Platzierung")); + label = new JLabel(TranslationFacility.tr("Platzierung")); add(label,posLabel.getComponent(false),8); - label = new JLabel(hoV.getLanguageString("Punkte")); + label = new JLabel(TranslationFacility.tr("Punkte")); add(label,pointsLabel.getComponent(false),9); - label = new JLabel(hoV.getLanguageString("Torverhaeltnis")); + label = new JLabel(TranslationFacility.tr("Torverhaeltnis")); add(label,goalsLabel.getComponent(false),10); } diff --git a/src/main/java/module/nthrf/MainPanel.java b/src/main/java/module/nthrf/MainPanel.java index 4b4373af4..f6816f01e 100644 --- a/src/main/java/module/nthrf/MainPanel.java +++ b/src/main/java/module/nthrf/MainPanel.java @@ -1,17 +1,13 @@ package module.nthrf; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - /** @@ -41,17 +37,16 @@ public static MainPanel getInstance() { */ private void buildGui() { setLayout(new BorderLayout()); - HOVerwaltung hoV = HOVerwaltung.instance(); JTextArea ta = new JTextArea(); - ta.append(hoV.getLanguageString("nthrf.hint1")+"\n"); - ta.append(hoV.getLanguageString("nthrf.hint2")+"\n"); - ta.append(hoV.getLanguageString("nthrf.hint3")+"\n"); - ta.append(hoV.getLanguageString("nthrf.hint4")+" '"); - ta.append(hoV.getLanguageString("Start")+"' "); - ta.append(hoV.getLanguageString("nthrf.hint5")); + ta.append(TranslationFacility.tr("nthrf.hint1")+"\n"); + ta.append(TranslationFacility.tr("nthrf.hint2")+"\n"); + ta.append(TranslationFacility.tr("nthrf.hint3")+"\n"); + ta.append(TranslationFacility.tr("nthrf.hint4")+" '"); + ta.append(TranslationFacility.tr("Start")+"' "); + ta.append(TranslationFacility.tr("nthrf.hint5")); ta.setEditable(false); add(new JScrollPane(ta), BorderLayout.CENTER); - btnStart = new JButton(HOVerwaltung.instance().getLanguageString("Start")); + btnStart = new JButton(TranslationFacility.tr("Start")); btnStart.addActionListener(this); add(btnStart, BorderLayout.SOUTH); } diff --git a/src/main/java/module/nthrf/NtTeamChooser.java b/src/main/java/module/nthrf/NtTeamChooser.java index f441f6fe2..9cff4723e 100644 --- a/src/main/java/module/nthrf/NtTeamChooser.java +++ b/src/main/java/module/nthrf/NtTeamChooser.java @@ -1,20 +1,13 @@ package module.nthrf; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.BorderLayout; -import java.awt.Dimension; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JPanel; - public class NtTeamChooser extends JDialog implements ActionListener { @@ -23,7 +16,7 @@ public class NtTeamChooser extends JDialog implements ActionListener { public NtTeamChooser(List teams) { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setLayout(new BorderLayout()); - add(new JLabel(HOVerwaltung.instance().getLanguageString("Favourite.SelectTeam")), BorderLayout.NORTH); + add(new JLabel(TranslationFacility.tr("Favourite.SelectTeam")), BorderLayout.NORTH); JPanel teamPanel = new JPanel(); for (String[] t : teams) { JButton btn = new JButton(t[1] + " (" + t[0] + ")"); diff --git a/src/main/java/module/nthrf/NthrfUtil.java b/src/main/java/module/nthrf/NthrfUtil.java index 09d728649..8f662faea 100644 --- a/src/main/java/module/nthrf/NthrfUtil.java +++ b/src/main/java/module/nthrf/NthrfUtil.java @@ -2,18 +2,18 @@ import core.file.ExampleFileFilter; import core.file.xml.XMLManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.net.MyConnector; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javax.swing.*; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import javax.swing.JFileChooser; -import org.w3c.dom.Document; -import org.w3c.dom.Element; public class NthrfUtil { @@ -35,7 +35,7 @@ public static String createNthrf(long teamId) { final File path = new File(core.model.UserParameter.instance().hrfImport_HRFPath); File file = new File(core.model.UserParameter.instance().hrfImport_HRFPath + File.separator + fname); fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); - fileChooser.setDialogTitle(HOVerwaltung.instance().getLanguageString("ls.button.save")); + fileChooser.setDialogTitle(TranslationFacility.tr("ls.button.save")); fileChooser.setFileFilter(new ExampleFileFilter("hrf")); try { diff --git a/src/main/java/module/playerOverview/PlayerDetailsPanel.java b/src/main/java/module/playerOverview/PlayerDetailsPanel.java index 441ff88db..3086f70d9 100644 --- a/src/main/java/module/playerOverview/PlayerDetailsPanel.java +++ b/src/main/java/module/playerOverview/PlayerDetailsPanel.java @@ -1,11 +1,6 @@ package module.playerOverview; -import core.constants.player.PlayerAbility; -import core.constants.player.PlayerAggressiveness; -import core.constants.player.PlayerAgreeability; -import core.constants.player.PlayerHonesty; -import core.constants.player.PlayerSkill; -import core.constants.player.PlayerSpeciality; +import core.constants.player.*; import core.datatype.CBItem; import core.db.DBManager; import core.gui.HOMainFrame; @@ -18,7 +13,7 @@ import core.gui.theme.*; import core.model.FactorObject; import core.model.FormulaFactors; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchKurzInfo; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; @@ -28,15 +23,23 @@ import core.util.HODateTime; import core.util.Helper; import module.statistics.StatistikMainPanel; -import java.awt.*; -import java.awt.event.*; -import java.util.ArrayList; -import java.util.Collections; + import javax.swing.*; import javax.swing.border.MatteBorder; import javax.swing.border.TitledBorder; import javax.swing.plaf.basic.BasicProgressBarUI; -import static core.gui.theme.HOIconName.*; +import java.awt.*; +import java.awt.event.ActionListener; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Collections; + +import static core.gui.theme.HOIconName.GOTOANALYSEBOTTOM; +import static core.gui.theme.HOIconName.GOTOANALYSETOP; +import static core.gui.theme.HOIconName.GOTOSTATISTIK; +import static core.gui.theme.HOIconName.SMILEYS; import static core.gui.theme.ImageUtilities.getSvgIcon; import static core.model.player.IMatchRoleID.UNKNOWN; import static core.model.player.IMatchRoleID.UNSELECTABLE; @@ -434,7 +437,7 @@ private void initComponents() { constraintsPlayerGeneralPanel.gridheight = 8; layoutPlayerGeneralPanel.setConstraints(jlPlayerAvatar, constraintsPlayerGeneralPanel); jlPlayerAvatar.addActionListener(this); - jlPlayerAvatar.setToolTipText(HOVerwaltung.instance().getLanguageString("ls.player.download.avatar")); + jlPlayerAvatar.setToolTipText(TranslationFacility.tr("ls.player.download.avatar")); jpPlayerGeneral.add(jlPlayerAvatar); constraintsPlayerGeneralPanel.gridx = 1; @@ -790,10 +793,10 @@ private void initComponents() { final GridBagLayout layoutButtonPanel = new GridBagLayout(); jpButtonsPanel.setLayout(layoutButtonPanel); - initButton(m_jbStatistics, HOVerwaltung.instance().getLanguageString("tt_Spieler_statistik"), jpButtonsPanel); - initButton(m_jbAnalysisTop, HOVerwaltung.instance().getLanguageString("tt_Spieler_analyse1"), jpButtonsPanel); - initButton(m_jbAnalysisBottom, HOVerwaltung.instance().getLanguageString("tt_Spieler_analyse2"), jpButtonsPanel); - initButton(m_jbOffsets, HOVerwaltung.instance().getLanguageString("tt_Spieler_offset"), jpButtonsPanel); + initButton(m_jbStatistics, TranslationFacility.tr("tt_Spieler_statistik"), jpButtonsPanel); + initButton(m_jbAnalysisTop, TranslationFacility.tr("tt_Spieler_analyse1"), jpButtonsPanel); + initButton(m_jbAnalysisBottom, TranslationFacility.tr("tt_Spieler_analyse2"), jpButtonsPanel); + initButton(m_jbOffsets, TranslationFacility.tr("tt_Spieler_offset"), jpButtonsPanel); constraintsPlayerOtherInfos.gridy = 0; constraintsPlayerOtherInfos.gridx = 4; diff --git a/src/main/java/module/playerOverview/PlayerOverviewModule.java b/src/main/java/module/playerOverview/PlayerOverviewModule.java index f9ec04c39..4cde637ea 100644 --- a/src/main/java/module/playerOverview/PlayerOverviewModule.java +++ b/src/main/java/module/playerOverview/PlayerOverviewModule.java @@ -1,14 +1,11 @@ package module.playerOverview; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; -import javax.swing.KeyStroke; - - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; +import javax.swing.*; +import java.awt.event.KeyEvent; + public final class PlayerOverviewModule extends DefaultModule { public PlayerOverviewModule(){ @@ -22,7 +19,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Spieleruebersicht"); + return TranslationFacility.tr("Spieleruebersicht"); } @Override diff --git a/src/main/java/module/playerOverview/PlayerOverviewPanel.java b/src/main/java/module/playerOverview/PlayerOverviewPanel.java index 40c09342c..4ca931ede 100644 --- a/src/main/java/module/playerOverview/PlayerOverviewPanel.java +++ b/src/main/java/module/playerOverview/PlayerOverviewPanel.java @@ -3,15 +3,15 @@ import core.gui.HOMainFrame; import core.gui.comp.panel.ImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.Player; +import javax.swing.*; import java.awt.*; import java.awt.event.AdjustmentListener; import java.util.Objects; -import javax.swing.*; - /** * Overview of all the players on the team (main class of the package) */ @@ -120,13 +120,13 @@ private Component initSpielerDetail() { JScrollPane scrollPane = new JScrollPane(playerDetailsPanel); scrollPane.getVerticalScrollBar().setBlockIncrement(100); scrollPane.getVerticalScrollBar().setUnitIncrement(20); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("SpielerDetails"), scrollPane); + tabbedPane.addTab(TranslationFacility.tr("SpielerDetails"), scrollPane); spielerTrainingsSimulatorPanel = new SpielerTrainingsSimulatorPanel(); scrollPane = new JScrollPane(spielerTrainingsSimulatorPanel); scrollPane.getVerticalScrollBar().setBlockIncrement(100); scrollPane.getVerticalScrollBar().setUnitIncrement(20); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Skilltester"), scrollPane); + tabbedPane.addTab(TranslationFacility.tr("Skilltester"), scrollPane); return tabbedPane; } diff --git a/src/main/java/module/playerOverview/PlayerOverviewTable.java b/src/main/java/module/playerOverview/PlayerOverviewTable.java index 077c64494..73c2b7784 100644 --- a/src/main/java/module/playerOverview/PlayerOverviewTable.java +++ b/src/main/java/module/playerOverview/PlayerOverviewTable.java @@ -11,6 +11,7 @@ import core.gui.model.UserColumnController; import core.gui.model.UserColumnFactory; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.match.MatchKurzInfo; import core.model.player.Player; @@ -66,7 +67,7 @@ public void mouseReleased(MouseEvent e) { // Get name of the actual column at columnAtPoint, i.e. post-ordering of the columns // based on preferences. String columnName = PlayerOverviewTable.this.getColumnName(columnAtPoint); - String lastMatchRating = (HOVerwaltung.instance().getLanguageString("LastMatchRating")); + String lastMatchRating = (TranslationFacility.tr("LastMatchRating")); Player player = tableSorter.getPlayerAtRow(rowIndex); if (player != null) { diff --git a/src/main/java/module/playerOverview/PlayerSubskillOffsetDialog.java b/src/main/java/module/playerOverview/PlayerSubskillOffsetDialog.java index 20f10ff0d..141d99a8b 100644 --- a/src/main/java/module/playerOverview/PlayerSubskillOffsetDialog.java +++ b/src/main/java/module/playerOverview/PlayerSubskillOffsetDialog.java @@ -6,19 +6,17 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import core.option.SliderPanel; import core.util.Helper; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; + import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; final class PlayerSubskillOffsetDialog extends JDialog implements ActionListener, ChangeListener { @@ -49,7 +47,7 @@ final class PlayerSubskillOffsetDialog extends JDialog implements ActionListener PlayerSubskillOffsetDialog(javax.swing.JFrame owner, Player player) { super(owner, true); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - setTitle(HOVerwaltung.instance().getLanguageString("OffsetTitle") + " " + player.getShortName()); + setTitle(TranslationFacility.tr("OffsetTitle") + " " + player.getShortName()); m_clPlayer = player; @@ -149,7 +147,7 @@ private void initComponents() { constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 1; - getContentPane().add(new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.tsi")), constraints); + getContentPane().add(new JLabel(TranslationFacility.tr("ls.player.tsi")), constraints); constraints.anchor = GridBagConstraints.EAST; constraints.gridx = 1; @@ -159,7 +157,7 @@ private void initComponents() { getContentPane().add(tsi, constraints); okButton = - new JButton(HOVerwaltung.instance().getLanguageString("ls.button.ok")); + new JButton(TranslationFacility.tr("ls.button.ok")); okButton.addActionListener(this); constraints.anchor = GridBagConstraints.WEST; constraints.gridx = 0; @@ -170,7 +168,7 @@ private void initComponents() { getContentPane().add(okButton); cancelButton = - new JButton(HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + new JButton(TranslationFacility.tr("ls.button.cancel")); cancelButton.addActionListener(this); constraints.anchor = GridBagConstraints.EAST; diff --git a/src/main/java/module/playerOverview/RemoveGruppenPanel.java b/src/main/java/module/playerOverview/RemoveGruppenPanel.java index d94d7fe08..8414b4824 100644 --- a/src/main/java/module/playerOverview/RemoveGruppenPanel.java +++ b/src/main/java/module/playerOverview/RemoveGruppenPanel.java @@ -3,19 +3,21 @@ import core.gui.HOMainFrame; import core.gui.comp.panel.ImagePanel; -import core.gui.theme.*; - +import core.gui.theme.GroupTeamFactory; +import core.gui.theme.HOColorName; +import core.gui.theme.HOIconName; +import core.gui.theme.ImageUtilities; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; +import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; import java.util.Map; -import javax.swing.*; - /** * Panel handling group selection for the players. @@ -201,8 +203,8 @@ private void initComponents() { setLayout(layout); final ButtonGroup bg = new ButtonGroup(); - final String tooltipFrom = HOVerwaltung.instance().getLanguageString("tt_Gruppe_von"); - final String tooltipTo = HOVerwaltung.instance().getLanguageString("tt_Gruppe_nach"); + final String tooltipFrom = TranslationFacility.tr("tt_Gruppe_von"); + final String tooltipTo = TranslationFacility.tr("tt_Gruppe_nach"); initButton(noGruppe,tooltipFrom,"No-Team.png"); constraints.gridx = 0; @@ -292,7 +294,7 @@ private void initComponents() { bg2.add(fGruppe2); add(fGruppe2); - doButton.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Gruppe_wechseln")); + doButton.setToolTipText(TranslationFacility.tr("tt_Gruppe_wechseln")); doButton.setPreferredSize(new Dimension(28, 28)); doButton.setEnabled(false); doButton.addActionListener(this); @@ -302,7 +304,7 @@ private void initComponents() { layout.setConstraints(doButton, constraints); add(doButton); - m_jbClean.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Group_team_clear")); + m_jbClean.setToolTipText(TranslationFacility.tr("tt_Group_team_clear")); m_jbClean.setPreferredSize(new Dimension(28, 28)); m_jbClean.addActionListener(this); constraints.gridx = 8; diff --git a/src/main/java/module/playerOverview/SpielerTrainingsSimulatorPanel.java b/src/main/java/module/playerOverview/SpielerTrainingsSimulatorPanel.java index bd92d46a8..918c83ec9 100644 --- a/src/main/java/module/playerOverview/SpielerTrainingsSimulatorPanel.java +++ b/src/main/java/module/playerOverview/SpielerTrainingsSimulatorPanel.java @@ -10,33 +10,18 @@ import core.gui.comp.panel.ImagePanel; import core.gui.theme.ImageUtilities; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; import core.model.player.Player; import core.module.IModule; import core.util.Helper; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.event.ItemEvent; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.ItemListener; +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; import java.io.Serial; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; - /** * This is a Skill Tester, where parameters of a player can be changed to see @@ -126,8 +111,8 @@ final class SpielerTrainingsSimulatorPanel extends ImagePanel private final ColorLabelEntry m_jpEPV = new ColorLabelEntry("", ColorLabelEntry.FG_STANDARD, ColorLabelEntry.BG_STANDARD, SwingConstants.RIGHT); - private final JButton m_jbAddTempSpieler = new JButton(HOVerwaltung.instance().getLanguageString("AddTempspieler")); - private final JButton m_jbRemoveTempSpieler = new JButton(HOVerwaltung.instance().getLanguageString("RemoveTempspieler")); + private final JButton m_jbAddTempSpieler = new JButton(TranslationFacility.tr("AddTempspieler")); + private final JButton m_jbRemoveTempSpieler = new JButton(TranslationFacility.tr("RemoveTempspieler")); private final JComboBox m_jcbErfahrung = new JComboBox(PlayerAbility.ITEMS); private final JComboBox m_jcbFluegel = new JComboBox(PlayerAbility.ITEMS); private final JComboBox m_jcbForm = new JComboBox(Helper.EINSTUFUNG_FORM); @@ -429,7 +414,7 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(eingabenLayout); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.name")); + label = new JLabel(TranslationFacility.tr("ls.player.name")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 0; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -440,7 +425,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlName, eingabenconstraints); panel.add(m_jlName); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.speciality")); + label = new JLabel(TranslationFacility.tr("ls.player.speciality")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 1; eingabenconstraints.gridwidth = 1; @@ -453,7 +438,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jcbSpeciality, eingabenconstraints); panel.add(m_jcbSpeciality); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.age")); + label = new JLabel(TranslationFacility.tr("ls.player.age")); eingabenconstraints.gridx = 3; eingabenconstraints.gridy = 1; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -465,7 +450,7 @@ private void initComponents() { eingabenLayout.setConstraints(jtfAge, eingabenconstraints); panel.add(jtfAge); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.experience")); + label = new JLabel(TranslationFacility.tr("ls.player.experience")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 2; eingabenconstraints.gridwidth = 1; @@ -483,7 +468,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlErfahrung, eingabenconstraints); panel.add(m_jlErfahrung); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.form")); + label = new JLabel(TranslationFacility.tr("ls.player.form")); eingabenconstraints.gridx = 3; eingabenconstraints.gridy = 2; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -500,7 +485,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlForm, eingabenconstraints); panel.add(m_jlForm); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.stamina")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 3; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -517,7 +502,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlKondition, eingabenconstraints); panel.add(m_jlKondition); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.keeper")); eingabenconstraints.gridx = 3; eingabenconstraints.gridy = 3; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -534,7 +519,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlTorwart, eingabenconstraints); panel.add(m_jlTorwart); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.playmaking")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 4; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -551,7 +536,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlSpielaufbau, eingabenconstraints); panel.add(m_jlSpielaufbau); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.passing")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.passing")); eingabenconstraints.gridx = 3; eingabenconstraints.gridy = 4; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -568,7 +553,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlPasspiel, eingabenconstraints); panel.add(m_jlPasspiel); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.winger")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.winger")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 5; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -585,7 +570,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlFluegel, eingabenconstraints); panel.add(m_jlFluegel); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.defending")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.defending")); eingabenconstraints.gridx = 3; eingabenconstraints.gridy = 5; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -602,7 +587,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlVerteidigung, eingabenconstraints); panel.add(m_jlVerteidigung); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.scoring")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 6; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -619,7 +604,7 @@ private void initComponents() { eingabenLayout.setConstraints(m_jlTorschuss, eingabenconstraints); panel.add(m_jlTorschuss); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.setpieces")); eingabenconstraints.gridx = 3; eingabenconstraints.gridy = 6; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -637,7 +622,7 @@ private void initComponents() { panel.add(m_jlStandard); // Add loyalty label and combo - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.loyalty")); + label = new JLabel(TranslationFacility.tr("ls.player.loyalty")); eingabenconstraints.gridx = 0; eingabenconstraints.gridy = 7; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -655,7 +640,7 @@ private void initComponents() { panel.add(m_jlLoyalty); // Add homegrown label and checkbox - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.motherclub")); + label = new JLabel(TranslationFacility.tr("ls.player.motherclub")); eingabenconstraints.gridx = 3; eingabenconstraints.gridy = 7; eingabenLayout.setConstraints(label, eingabenconstraints); @@ -679,10 +664,10 @@ private void initComponents() { //Button-------- panel = new JPanel(); - m_jbAddTempSpieler.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_add_tempspieler")); + m_jbAddTempSpieler.setToolTipText(TranslationFacility.tr("tt_add_tempspieler")); m_jbAddTempSpieler.addActionListener(this); panel.add(m_jbAddTempSpieler); - m_jbRemoveTempSpieler.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_remove_tempspieler")); + m_jbRemoveTempSpieler.setToolTipText(TranslationFacility.tr("tt_remove_tempspieler")); m_jbRemoveTempSpieler.addActionListener(this); m_jbRemoveTempSpieler.setEnabled(false); panel.add(m_jbRemoveTempSpieler); @@ -697,7 +682,7 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(new GridLayout(21, 2, 2, 2)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("BestePosition")); + label = new JLabel(TranslationFacility.tr("BestePosition")); panel.add(label); panel.add(m_jpBestPos.getComponent(false)); @@ -708,7 +693,7 @@ private void initComponents() { panel.add(playerPositionValues[i].getComponent(false)); } - label = new JLabel(HOVerwaltung.instance().getLanguageString("Marktwert")); + label = new JLabel(TranslationFacility.tr("Marktwert")); panel.add(label); panel.add(m_jpEPV.getComponent(false)); diff --git a/src/main/java/module/playerOverview/SpielerTrainingsVergleichsPanel.java b/src/main/java/module/playerOverview/SpielerTrainingsVergleichsPanel.java index a6ea4398f..dd18b6b4d 100644 --- a/src/main/java/module/playerOverview/SpielerTrainingsVergleichsPanel.java +++ b/src/main/java/module/playerOverview/SpielerTrainingsVergleichsPanel.java @@ -7,20 +7,21 @@ import core.gui.Refreshable; import core.gui.comp.panel.ImagePanel; import core.gui.model.AufstellungsListRenderer; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.Player; -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.Serial; -import java.util.ArrayList; -import java.util.List; + import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.Serial; +import java.util.ArrayList; +import java.util.List; /** @@ -41,7 +42,7 @@ public class SpielerTrainingsVergleichsPanel extends ImagePanel //~ Instance fields ---------------------------------------------------------------------------- - private final JButton m_jbLoeschen = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + private final JButton m_jbLoeschen = new JButton(TranslationFacility.tr("ls.button.delete")); private final JList m_jlHRFs = new JList<>(); private final List changeListeners = new ArrayList<>(); @@ -70,7 +71,7 @@ public static List getSelectedPlayerDevelopmentStage() { public final void actionPerformed(ActionEvent actionEvent) { final var hrfs = m_jlHRFs.getSelectedValuesList(); - StringBuilder deleteInfoText = new StringBuilder(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + StringBuilder deleteInfoText = new StringBuilder(TranslationFacility.tr("ls.button.delete")); if (hrfs.size() > 1) { deleteInfoText.append(" (").append(hrfs.size()).append(" Files) : "); @@ -92,7 +93,7 @@ public final void actionPerformed(ActionEvent actionEvent) { } final int value = JOptionPane.showConfirmDialog(this, deleteInfoText.toString(), - HOVerwaltung.instance().getLanguageString("confirmation.title"), JOptionPane.YES_NO_OPTION); + TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); if (value == JOptionPane.OK_OPTION) { for (CBItem hrf : hrfs) { @@ -152,7 +153,7 @@ public final void valueChanged(ListSelectionEvent listSelectionEvent) { private void initComponents() { setLayout(new BorderLayout()); - final JLabel hrfComparisonLabel = new JLabel(HOVerwaltung.instance().getLanguageString("VergleichsHRF")); + final JLabel hrfComparisonLabel = new JLabel(TranslationFacility.tr("VergleichsHRF")); hrfComparisonLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 0)); add(hrfComparisonLabel, BorderLayout.NORTH); @@ -185,11 +186,11 @@ List loadCBItemHRFList() { new core.datatype.CBItem( date.toLocaleDateTime() + " ( " - + core.model.HOVerwaltung.instance().getLanguageString("Season") + + TranslationFacility.tr("Season") + " " + trainingWeek.season + " " - + core.model.HOVerwaltung.instance().getLanguageString("ls.training.week") + + TranslationFacility.tr("ls.training.week") + " " + trainingWeek.week + " )", diff --git a/src/main/java/module/playerOverview/TeamSummaryPanel.java b/src/main/java/module/playerOverview/TeamSummaryPanel.java index 09512aa7f..d87eab170 100644 --- a/src/main/java/module/playerOverview/TeamSummaryPanel.java +++ b/src/main/java/module/playerOverview/TeamSummaryPanel.java @@ -7,6 +7,7 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.util.Helper; @@ -40,13 +41,13 @@ private void initComponents() { final BoxLayout layout = new BoxLayout(this, BoxLayout.LINE_AXIS); this.setLayout(layout); - createField(HOVerwaltung.instance().getLanguageString("ls.team.numplayers"), numPlayerLabel); - createField(HOVerwaltung.instance().getLanguageString("ls.team.averageage"), averageAgeLabel); - createField(HOVerwaltung.instance().getLanguageString("ls.team.averagesalary"), averageSalaryLabel); - createField(HOVerwaltung.instance().getLanguageString("ls.team.totaltsi"), totalTsiLabel); - createField(HOVerwaltung.instance().getLanguageString("ls.team.averagetsi"), averageTsiLabel); - createField(HOVerwaltung.instance().getLanguageString("ls.team.averagestamina"), averageStaminaLabel); - createField(HOVerwaltung.instance().getLanguageString("ls.team.averageform"), averageFormLabel); + createField(TranslationFacility.tr("ls.team.numplayers"), numPlayerLabel); + createField(TranslationFacility.tr("ls.team.averageage"), averageAgeLabel); + createField(TranslationFacility.tr("ls.team.averagesalary"), averageSalaryLabel); + createField(TranslationFacility.tr("ls.team.totaltsi"), totalTsiLabel); + createField(TranslationFacility.tr("ls.team.averagetsi"), averageTsiLabel); + createField(TranslationFacility.tr("ls.team.averagestamina"), averageStaminaLabel); + createField(TranslationFacility.tr("ls.team.averageform"), averageFormLabel); } private void createField(String labelName, JComponent fieldLabel) { diff --git a/src/main/java/module/playeranalysis/PlayerAnalyseMainPanel.java b/src/main/java/module/playeranalysis/PlayerAnalyseMainPanel.java index 2f4b53d3e..daf3aec28 100644 --- a/src/main/java/module/playeranalysis/PlayerAnalyseMainPanel.java +++ b/src/main/java/module/playeranalysis/PlayerAnalyseMainPanel.java @@ -6,15 +6,13 @@ import core.gui.comp.panel.LazyImagePanel; import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; +import core.model.TranslationFacility; import core.model.UserParameter; -import java.awt.BorderLayout; -import java.awt.Dimension; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JSplitPane; public class PlayerAnalyseMainPanel extends LazyImagePanel { @@ -84,7 +82,7 @@ private void initComponents() { JPanel panel = new ImagePanel(new BorderLayout()); arrangeButton = new JButton(ImageUtilities.getSvgIcon(HOIconName.TURN)); - arrangeButton.setToolTipText(core.model.HOVerwaltung.instance().getLanguageString( + arrangeButton.setToolTipText(TranslationFacility.tr( "tt_SpielerAnalyse_drehen")); arrangeButton.setPreferredSize(new Dimension(24, 24)); panel.add(arrangeButton, BorderLayout.WEST); diff --git a/src/main/java/module/playeranalysis/PlayerAnalysisModule.java b/src/main/java/module/playeranalysis/PlayerAnalysisModule.java index 5fdc765a4..f7f7f4f6b 100644 --- a/src/main/java/module/playeranalysis/PlayerAnalysisModule.java +++ b/src/main/java/module/playeranalysis/PlayerAnalysisModule.java @@ -1,15 +1,12 @@ package module.playeranalysis; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; -import javax.swing.KeyStroke; - - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; import core.module.config.ModuleConfig; +import javax.swing.*; +import java.awt.event.KeyEvent; + public final class PlayerAnalysisModule extends DefaultModule { static final String SHOW_GAMEANALYSIS = "PA_PlayerAnalysis"; public static final String SHOW_PLAYERCOMPARE = "PA_PlayerCompare"; @@ -32,7 +29,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("SpielerAnalyse"); + return TranslationFacility.tr("SpielerAnalyse"); } @Override diff --git a/src/main/java/module/playeranalysis/PlayerAnalysisModulePanel.java b/src/main/java/module/playeranalysis/PlayerAnalysisModulePanel.java index 2673d6f9e..eb4283ab7 100644 --- a/src/main/java/module/playeranalysis/PlayerAnalysisModulePanel.java +++ b/src/main/java/module/playeranalysis/PlayerAnalysisModulePanel.java @@ -2,6 +2,7 @@ import core.gui.comp.panel.LazyImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.config.ModuleConfig; import module.playeranalysis.skillCompare.PlayerComparePanel; @@ -40,10 +41,10 @@ private JTabbedPane getTabbedPane() { if (tabbedPane == null) { tabbedPane = new JTabbedPane(); tabbedPane.add(getSpielerAnalyseMainPanel(), - HOVerwaltung.instance().getLanguageString("Spiele")); + TranslationFacility.tr("Spiele")); if (ModuleConfig.instance().getBoolean(PlayerAnalysisModule.SHOW_PLAYERCOMPARE)) tabbedPane.add(getPlayerComparePanel(), - HOVerwaltung.instance().getLanguageString("PlayerCompare")); + TranslationFacility.tr("PlayerCompare")); } return tabbedPane; } diff --git a/src/main/java/module/playeranalysis/SettingPanel.java b/src/main/java/module/playeranalysis/SettingPanel.java index f9869fef8..ee14181ab 100644 --- a/src/main/java/module/playeranalysis/SettingPanel.java +++ b/src/main/java/module/playeranalysis/SettingPanel.java @@ -2,19 +2,13 @@ package module.playeranalysis; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.config.ModuleConfig; -import java.awt.BorderLayout; -import java.awt.GridLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - class SettingPanel extends JPanel { public static ModuleConfig config = ModuleConfig.instance(); @@ -73,7 +67,7 @@ private void jbInit() { JPanel mainPanel = new ImagePanel(); mainPanel.setLayout(new GridLayout(12, 1)); mainPanel.setOpaque(false); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("PlayerCompare"), + mainPanel.add(createPanel(TranslationFacility.tr("PlayerCompare"), skillsCheckbox)); setLayout(new BorderLayout()); setOpaque(false); diff --git a/src/main/java/module/playeranalysis/skillCompare/MyTableCellRenderer.java b/src/main/java/module/playeranalysis/skillCompare/MyTableCellRenderer.java index c7c68fdee..71b147db6 100644 --- a/src/main/java/module/playeranalysis/skillCompare/MyTableCellRenderer.java +++ b/src/main/java/module/playeranalysis/skillCompare/MyTableCellRenderer.java @@ -7,24 +7,17 @@ import core.gui.theme.HOIconName; import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.MatchRoleID; import core.util.Helper; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.GridLayout; +import javax.swing.*; +import javax.swing.table.TableCellRenderer; +import java.awt.*; import java.text.DecimalFormat; import java.util.StringTokenizer; -import javax.swing.Icon; -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.table.TableCellRenderer; - class MyTableCellRenderer implements TableCellRenderer{ private Color gelb; private Color gruen; @@ -55,7 +48,7 @@ public Component getTableCellRendererComponent(JTable table, { JLabel label = new JLabel(); - if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.name"))) { + if(table.getColumnName(column).equals(TranslationFacility.tr("ls.player.name"))) { int i = 0; int spezWert = 0; StringTokenizer tk = new StringTokenizer(table.getValueAt(row,column).toString(),";"); @@ -82,20 +75,20 @@ else if(column == 2) { label.setHorizontalAlignment(SwingConstants.CENTER); label.setBackground(table.getBackground()); } - else if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("Gruppe"))) { + else if(table.getColumnName(column).equals(TranslationFacility.tr("Gruppe"))) { String group = ((String)table.getValueAt(row,column)); if(group != null && group.length() > 3) label.setIcon(ThemeManager.getIcon(group)); label.setBackground(table.getBackground()); - } else if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("BestePosition"))) { + } else if(table.getColumnName(column).equals(TranslationFacility.tr("BestePosition"))) { // we parse back into best position and best rating value byte tmpPos = ((Float)table.getValueAt(row,column)).byteValue(); float ratingValue = ((Float) table.getValueAt(row, column) - tmpPos) * 1000; label.setText(MatchRoleID.getNameForPosition(tmpPos) + " ("+ String.format("%.1f", ratingValue) +"%)"); label.setBackground(table.getBackground()); - } else if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_motherclub"))) { + } else if(table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_motherclub"))) { double skillwert = 0; String skillwertS; try { @@ -120,18 +113,18 @@ else if (changeWert > 0) label.setBackground(table.getBackground()); } else if(column<19 && - (table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_experience")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_leadership")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_form")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.stamina")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.keeper")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.defending")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.playmaking")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.passing")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.winger")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.scoring")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.setpieces")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_loyalty"))) + (table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_experience")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_leadership")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_form")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.stamina")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.keeper")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.defending")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.playmaking")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.passing")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.winger")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.scoring")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.skill_short.setpieces")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_loyalty"))) ) { double skillwert = 0; @@ -150,9 +143,9 @@ else if(column<19 && Icon ii = ImageUtilities.getImageIcon4Change(changeWert,true); label = new JLabel(""+skillWertNew,ii,SwingConstants.CENTER); label.setHorizontalTextPosition(SwingConstants.LEADING); - if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_experience")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_leadership")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.short_form")) + if(table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_experience")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_leadership")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.short_form")) ) { label.setBackground(gruen); @@ -164,25 +157,25 @@ else if(column<19 && } else if(column>=19 && - (table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefendertowardswing")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefenderoffensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbacktowardsmiddle")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackdefensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackoffensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfieldertowardswing")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderdefensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderoffensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingertowardsmiddle")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingeroffensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingerdefensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwarddefensive")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwardtowardswing"))) + (table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.centraldefendertowardswing")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.centraldefenderoffensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingbacktowardsmiddle")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingbackdefensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingbackoffensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.innermidfieldertowardswing")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.innermidfielderdefensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.innermidfielderoffensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingertowardsmiddle")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingeroffensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingerdefensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.forwarddefensive")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.keeper")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.centraldefender")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingback")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.innermidfielder")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.winger")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.forward")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.forwardtowardswing"))) ) { int i = 0; @@ -228,12 +221,12 @@ else if(changeValue == 0){ label.add(wertNeu); label.add(wertAlt); - if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward")) + if(table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.keeper")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.centraldefender")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.wingback")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.innermidfielder")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.winger")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.position_short.forward")) ) { label.setBackground(dunkelblau); @@ -249,14 +242,14 @@ else if(changeValue == 0){ label.validate(); } - else if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.wage"))) { + else if(table.getColumnName(column).equals(TranslationFacility.tr("ls.player.wage"))) { label.setText(Helper.getNumberFormat(true, 0).format(value)); label.setHorizontalAlignment(SwingConstants.RIGHT); label.setBackground(table.getBackground()); } - else if(table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.tsi")) - || table.getColumnName(column).equals(HOVerwaltung.instance().getLanguageString("ls.player.id"))){ + else if(table.getColumnName(column).equals(TranslationFacility.tr("ls.player.tsi")) + || table.getColumnName(column).equals(TranslationFacility.tr("ls.player.id"))){ label.setText(value.toString()); label.setHorizontalAlignment(SwingConstants.RIGHT); label.setBackground(table.getBackground()); diff --git a/src/main/java/module/playeranalysis/skillCompare/PlayerComparePanel.java b/src/main/java/module/playeranalysis/skillCompare/PlayerComparePanel.java index d51a3174c..79ea8f5a5 100644 --- a/src/main/java/module/playeranalysis/skillCompare/PlayerComparePanel.java +++ b/src/main/java/module/playeranalysis/skillCompare/PlayerComparePanel.java @@ -7,34 +7,15 @@ import core.datatype.CBItem; import core.gui.comp.panel.LazyImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; import java.util.List; import java.util.Vector; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTable; - /** * @author KickMuck */ @@ -154,20 +135,19 @@ private void initComponents() { // Default values for skill changes changedRating = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - HOVerwaltung hoV = HOVerwaltung.instance(); // Set the labels - JLabel m_L_Experience = new JLabel(hoV.getLanguageString("ls.player.experience")); - JLabel m_L_Form = new JLabel(hoV.getLanguageString("ls.player.form")); - JLabel m_L_Stamina = new JLabel(hoV.getLanguageString("ls.player.skill.stamina")); - JLabel m_L_Keeping = new JLabel(hoV.getLanguageString("ls.player.skill.keeper")); - JLabel m_L_Defending = new JLabel(hoV.getLanguageString("ls.player.skill.defending")); - JLabel m_L_Playmaking = new JLabel(hoV.getLanguageString("ls.player.skill.playmaking")); - JLabel m_L_Passing = new JLabel(hoV.getLanguageString("ls.player.skill.passing")); - JLabel m_L_Winger = new JLabel(hoV.getLanguageString("ls.player.skill.winger")); - JLabel m_L_Scoring = new JLabel(hoV.getLanguageString("ls.player.skill.scoring")); - JLabel m_L_SetPieces = new JLabel(hoV.getLanguageString("ls.player.skill.setpieces")); - JLabel m_L_Loyalty = new JLabel(hoV.getLanguageString("ls.player.loyalty")); - JLabel m_L_HomeGrown = new JLabel(hoV.getLanguageString("ls.player.motherclub")); + JLabel m_L_Experience = new JLabel(TranslationFacility.tr("ls.player.experience")); + JLabel m_L_Form = new JLabel(TranslationFacility.tr("ls.player.form")); + JLabel m_L_Stamina = new JLabel(TranslationFacility.tr("ls.player.skill.stamina")); + JLabel m_L_Keeping = new JLabel(TranslationFacility.tr("ls.player.skill.keeper")); + JLabel m_L_Defending = new JLabel(TranslationFacility.tr("ls.player.skill.defending")); + JLabel m_L_Playmaking = new JLabel(TranslationFacility.tr("ls.player.skill.playmaking")); + JLabel m_L_Passing = new JLabel(TranslationFacility.tr("ls.player.skill.passing")); + JLabel m_L_Winger = new JLabel(TranslationFacility.tr("ls.player.skill.winger")); + JLabel m_L_Scoring = new JLabel(TranslationFacility.tr("ls.player.skill.scoring")); + JLabel m_L_SetPieces = new JLabel(TranslationFacility.tr("ls.player.skill.setpieces")); + JLabel m_L_Loyalty = new JLabel(TranslationFacility.tr("ls.player.loyalty")); + JLabel m_L_HomeGrown = new JLabel(TranslationFacility.tr("ls.player.motherclub")); // Create table model for top table m_playerTableModelTop = new PlayerTableModel(m_ar_allPlayers, 1); @@ -186,30 +166,30 @@ private void initComponents() { GridBagConstraints gbc = new GridBagConstraints(); m_topButtonPanel.setLayout(gbl); - m_btCompare = new JButton(hoV.getLanguageString("Vergleichen")); - m_btCompare.setToolTipText(hoV.getLanguageString("ttCompare")); + m_btCompare = new JButton(TranslationFacility.tr("Vergleichen")); + m_btCompare.setToolTipText(TranslationFacility.tr("ttCompare")); - m_btReset = new JButton(hoV.getLanguageString("ls.button.reset")); - m_btReset.setToolTipText(hoV.getLanguageString("btReset")); + m_btReset = new JButton(TranslationFacility.tr("ls.button.reset")); + m_btReset.setToolTipText(TranslationFacility.tr("btReset")); - JLabel m_L_GroupBy = new JLabel(hoV.getLanguageString("vergleichen_alle")); - JLabel m_L_Header = new JLabel(hoV.getLanguageString("setze_alle")); + JLabel m_L_GroupBy = new JLabel(TranslationFacility.tr("vergleichen_alle")); + JLabel m_L_Header = new JLabel(TranslationFacility.tr("setze_alle")); // Create controls m_CB_type = new JComboBox(); - m_CB_type.addItem(hoV.getLanguageString("gewaehlte")); - m_CB_type.addItem(hoV.getLanguageString("ls.player.position.keeper")); - m_CB_type.addItem(hoV.getLanguageString("defender")); - m_CB_type.addItem(hoV.getLanguageString("ls.player.position.innermidfielder")); - m_CB_type.addItem(hoV.getLanguageString("ls.player.position.winger")); - m_CB_type.addItem(hoV.getLanguageString("ls.player.position.forward")); - m_CB_type.addItem(hoV.getLanguageString("GruppeA")); - m_CB_type.addItem(hoV.getLanguageString("GruppeB")); - m_CB_type.addItem(hoV.getLanguageString("GruppeC")); - m_CB_type.addItem(hoV.getLanguageString("GruppeD")); - m_CB_type.addItem(hoV.getLanguageString("GruppeE")); - m_CB_type.addItem(hoV.getLanguageString("GruppeF")); - m_CB_type.addItem(hoV.getLanguageString("alle")); + m_CB_type.addItem(TranslationFacility.tr("gewaehlte")); + m_CB_type.addItem(TranslationFacility.tr("ls.player.position.keeper")); + m_CB_type.addItem(TranslationFacility.tr("defender")); + m_CB_type.addItem(TranslationFacility.tr("ls.player.position.innermidfielder")); + m_CB_type.addItem(TranslationFacility.tr("ls.player.position.winger")); + m_CB_type.addItem(TranslationFacility.tr("ls.player.position.forward")); + m_CB_type.addItem(TranslationFacility.tr("GruppeA")); + m_CB_type.addItem(TranslationFacility.tr("GruppeB")); + m_CB_type.addItem(TranslationFacility.tr("GruppeC")); + m_CB_type.addItem(TranslationFacility.tr("GruppeD")); + m_CB_type.addItem(TranslationFacility.tr("GruppeE")); + m_CB_type.addItem(TranslationFacility.tr("GruppeF")); + m_CB_type.addItem(TranslationFacility.tr("alle")); m_CB_type.addItemListener(this); // Experience @@ -288,8 +268,8 @@ private void initComponents() { // Homegrown m_CB_Homegrown = new JComboBox(); m_CB_Homegrown.addItem("---"); - m_CB_Homegrown.addItem(hoV.getLanguageString("ls.button.no")); - m_CB_Homegrown.addItem(hoV.getLanguageString("ls.button.yes")); + m_CB_Homegrown.addItem(TranslationFacility.tr("ls.button.no")); + m_CB_Homegrown.addItem(TranslationFacility.tr("ls.button.yes")); m_CB_Homegrown.setSelectedIndex(0); m_CB_Homegrown.addItemListener(this); @@ -941,7 +921,7 @@ private void setDummyPlayerDetails() { module.playeranalysis.skillCompare.Player dummy = new module.playeranalysis.skillCompare.Player(); JLabel l_SpielerName = new JLabel(); l_SpielerName.setPreferredSize(new Dimension(100, 30)); - l_SpielerName.setText(HOVerwaltung.instance().getLanguageString("ls.player.name")); + l_SpielerName.setText(TranslationFacility.tr("ls.player.name")); l_SpielerName.setOpaque(true); JLabel platzhalter = new JLabel(); diff --git a/src/main/java/module/playeranalysis/skillCompare/PlayerTable.java b/src/main/java/module/playeranalysis/skillCompare/PlayerTable.java index 03ad66d15..68c703247 100644 --- a/src/main/java/module/playeranalysis/skillCompare/PlayerTable.java +++ b/src/main/java/module/playeranalysis/skillCompare/PlayerTable.java @@ -2,13 +2,12 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.Component; - -import javax.swing.JTable; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; +import java.awt.*; /** @@ -83,56 +82,56 @@ public Component getTableCellRendererComponent(JTable table, Object value, { col.setCellRenderer(new MyTableCellRenderer()); } - if(columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefendertowardswing")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefenderoffensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbacktowardsmiddle")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackoffensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackdefensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderdefensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfieldertowardswing")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderoffensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingertowardsmiddle")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingeroffensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingerdefensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwarddefensive")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwardtowardswing")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("Gruppe")) + if(columnName.equals(TranslationFacility.tr("ls.player.position_short.keeper")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.centraldefender")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.centraldefendertowardswing")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.centraldefenderoffensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.wingback")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.wingbacktowardsmiddle")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.wingbackoffensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.wingbackdefensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.innermidfielder")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.innermidfielderdefensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.innermidfieldertowardswing")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.innermidfielderoffensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.winger")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.wingertowardsmiddle")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.wingeroffensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.wingerdefensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.forward")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.forwarddefensive")) + || columnName.equals(TranslationFacility.tr("ls.player.position_short.forwardtowardswing")) + || columnName.equals(TranslationFacility.tr("Gruppe")) ) { width = 60; } - else if(columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.name")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("BestePosition")) + else if(columnName.equals(TranslationFacility.tr("ls.player.name")) + || columnName.equals(TranslationFacility.tr("BestePosition")) ) { width = 175; } - else if(columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.short_leadership")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.short_experience")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.short_form")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.stamina")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.keeper")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.defending")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.playmaking")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.passing")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.winger")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.scoring")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.skill_short.setpieces")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.short_loyalty")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.short_motherclub")) + else if(columnName.equals(TranslationFacility.tr("ls.player.short_leadership")) + || columnName.equals(TranslationFacility.tr("ls.player.short_experience")) + || columnName.equals(TranslationFacility.tr("ls.player.short_form")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.stamina")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.keeper")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.defending")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.playmaking")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.passing")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.winger")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.scoring")) + || columnName.equals(TranslationFacility.tr("ls.player.skill_short.setpieces")) + || columnName.equals(TranslationFacility.tr("ls.player.short_loyalty")) + || columnName.equals(TranslationFacility.tr("ls.player.short_motherclub")) ) { width = 40; } - else if(columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.wage")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.id")) - || columnName.equals(HOVerwaltung.instance().getLanguageString("ls.player.tsi")) + else if(columnName.equals(TranslationFacility.tr("ls.player.wage")) + || columnName.equals(TranslationFacility.tr("ls.player.id")) + || columnName.equals(TranslationFacility.tr("ls.player.tsi")) ) { width = 80; diff --git a/src/main/java/module/playeranalysis/skillCompare/PlayerTableModel.java b/src/main/java/module/playeranalysis/skillCompare/PlayerTableModel.java index b2c97c0d6..c3003a7d7 100644 --- a/src/main/java/module/playeranalysis/skillCompare/PlayerTableModel.java +++ b/src/main/java/module/playeranalysis/skillCompare/PlayerTableModel.java @@ -8,7 +8,7 @@ //import java.awt.*; //import javax.swing.*; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import javax.swing.table.DefaultTableModel; @@ -31,68 +31,68 @@ public class PlayerTableModel extends DefaultTableModel{ columnNames = new String[3]; m_anzZeilen = 19; - columnNames[0] = HOVerwaltung.instance().getLanguageString("original"); - columnNames[1] = HOVerwaltung.instance().getLanguageString("Position"); - columnNames[2] = HOVerwaltung.instance().getLanguageString("geaendert"); + columnNames[0] = TranslationFacility.tr("original"); + columnNames[1] = TranslationFacility.tr("Position"); + columnNames[2] = TranslationFacility.tr("geaendert"); data = new Object[19][3]; data[0][0] = m_spieler.getOldPosVal_GK(); - data[0][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper"); + data[0][1] = TranslationFacility.tr("ls.player.position_short.keeper"); data[0][2] = m_spieler.getPosVal_GK(); data[1][0] = m_spieler.getOldPosVal_CD(); - data[1][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender"); + data[1][1] = TranslationFacility.tr("ls.player.position_short.centraldefender"); data[1][2] = m_spieler.getPosVal_CD(); data[2][0] = m_spieler.getOldPosVal_CD_TW(); - data[2][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefendertowardswing"); + data[2][1] = TranslationFacility.tr("ls.player.position_short.centraldefendertowardswing"); data[2][2] = m_spieler.getPosVal_CD_TW(); data[3][0] = m_spieler.getOldPosVal_CD_O(); - data[3][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefenderoffensive"); + data[3][1] = TranslationFacility.tr("ls.player.position_short.centraldefenderoffensive"); data[3][2] = m_spieler.getPosVal_CD_O(); data[4][0] = m_spieler.getOldPosVal_WB(); - data[4][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback"); + data[4][1] = TranslationFacility.tr("ls.player.position_short.wingback"); data[4][2] = m_spieler.getPosVAL_WB(); data[5][0] = m_spieler.getOldPosVal_WB_TM(); - data[5][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbacktowardsmiddle"); + data[5][1] = TranslationFacility.tr("ls.player.position_short.wingbacktowardsmiddle"); data[5][2] = m_spieler.getPosVal_WB_TM(); data[6][0] = m_spieler.getOldPosVal_WB_O(); - data[6][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackoffensive"); + data[6][1] = TranslationFacility.tr("ls.player.position_short.wingbackoffensive"); data[6][2] = m_spieler.getPosVal_WB_O(); data[7][0] = m_spieler.getOldPosVAL_WB_D(); - data[7][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackdefensive"); + data[7][1] = TranslationFacility.tr("ls.player.position_short.wingbackdefensive"); data[7][2] = m_spieler.getPosVal_WB_D(); data[8][0] = m_spieler.getOldPosVal_IM(); - data[8][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder"); + data[8][1] = TranslationFacility.tr("ls.player.position_short.innermidfielder"); data[8][2] = m_spieler.getPosVal_IM(); data[9][0] = m_spieler.getOldPosVal_IM_TW(); - data[9][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfieldertowardswing"); + data[9][1] = TranslationFacility.tr("ls.player.position_short.innermidfieldertowardswing"); data[9][2] = m_spieler.getPosVal_IM_TW(); data[10][0] = m_spieler.getOldPosVal_IM_O(); - data[10][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderoffensive"); + data[10][1] = TranslationFacility.tr("ls.player.position_short.innermidfielderoffensive"); data[10][2] = m_spieler.getPosVal_IM_O(); data[11][0] = m_spieler.getOldPosVal_IM_D(); - data[11][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderdefensive"); + data[11][1] = TranslationFacility.tr("ls.player.position_short.innermidfielderdefensive"); data[11][2] = m_spieler.getPosVal_IM_D(); data[12][0] = m_spieler.getOldPosVal_W(); - data[12][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger"); + data[12][1] = TranslationFacility.tr("ls.player.position_short.winger"); data[12][2] = m_spieler.getPosVal_W(); data[13][0] = m_spieler.getOldPosVal_W_TM(); - data[13][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingertowardsmiddle"); + data[13][1] = TranslationFacility.tr("ls.player.position_short.wingertowardsmiddle"); data[13][2] = m_spieler.getPosVal_W_TM(); data[14][0] = m_spieler.getOldPosVal_W_O(); - data[14][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingeroffensive"); + data[14][1] = TranslationFacility.tr("ls.player.position_short.wingeroffensive"); data[14][2] = m_spieler.getPosVal_W_O(); data[15][0] = m_spieler.getOldPosVal_W_D(); - data[15][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingerdefensive"); + data[15][1] = TranslationFacility.tr("ls.player.position_short.wingerdefensive"); data[15][2] = m_spieler.getPosVal_W_D(); data[16][0] = m_spieler.getOldPosVal_F(); - data[16][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward"); + data[16][1] = TranslationFacility.tr("ls.player.position_short.forward"); data[16][2] = m_spieler.getPosVal_F(); data[17][0] = m_spieler.getOldPosVal_F_D(); - data[17][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwarddefensive"); + data[17][1] = TranslationFacility.tr("ls.player.position_short.forwarddefensive"); data[17][2] = m_spieler.getPosVal_F_D(); data[18][0] = m_spieler.getOldPosVal_F_TW(); - data[18][1] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwardtowardswing"); + data[18][1] = TranslationFacility.tr("ls.player.position_short.forwardtowardswing"); data[18][2] = m_spieler.getPosVal_F_TW(); } @@ -102,46 +102,46 @@ public class PlayerTableModel extends DefaultTableModel{ columnNames[0] = ""; - columnNames[1] = HOVerwaltung.instance().getLanguageString("ls.player.name"); + columnNames[1] = TranslationFacility.tr("ls.player.name"); columnNames[2] = ""; - columnNames[3] = HOVerwaltung.instance().getLanguageString("ls.player.age"); - columnNames[4] = HOVerwaltung.instance().getLanguageString("BestePosition"); - columnNames[5] = HOVerwaltung.instance().getLanguageString("Gruppe"); - columnNames[6] = HOVerwaltung.instance().getLanguageString("ls.player.short_motherclub"); - columnNames[7] = HOVerwaltung.instance().getLanguageString("ls.player.short_leadership"); - columnNames[8] = HOVerwaltung.instance().getLanguageString("ls.player.short_experience"); - columnNames[9] = HOVerwaltung.instance().getLanguageString("ls.player.short_form"); - columnNames[10] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.stamina"); - columnNames[11] = HOVerwaltung.instance().getLanguageString("ls.player.short_loyalty"); - columnNames[12] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.keeper"); - columnNames[13] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.defending"); - columnNames[14] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.playmaking"); - columnNames[15] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.passing"); - columnNames[16] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.winger"); - columnNames[17] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.scoring"); - columnNames[18] = HOVerwaltung.instance().getLanguageString("ls.player.skill_short.setpieces"); - columnNames[19] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper"); - columnNames[20] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender"); - columnNames[21] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefendertowardswing"); - columnNames[22] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefenderoffensive"); - columnNames[23] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback"); - columnNames[24] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbacktowardsmiddle"); - columnNames[25] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackoffensive"); - columnNames[26] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackdefensive"); - columnNames[27] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder"); - columnNames[28] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfieldertowardswing"); - columnNames[29] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderoffensive"); - columnNames[30] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderdefensive"); - columnNames[31] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger"); - columnNames[32] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingertowardsmiddle"); - columnNames[33] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingeroffensive"); - columnNames[34] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingerdefensive"); - columnNames[35] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward"); - columnNames[36] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwarddefensive"); - columnNames[37] = HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwardtowardswing"); - columnNames[38] = HOVerwaltung.instance().getLanguageString("ls.player.wage"); - columnNames[39] = HOVerwaltung.instance().getLanguageString("ls.player.tsi"); - columnNames[40] = HOVerwaltung.instance().getLanguageString("ls.player.id"); + columnNames[3] = TranslationFacility.tr("ls.player.age"); + columnNames[4] = TranslationFacility.tr("BestePosition"); + columnNames[5] = TranslationFacility.tr("Gruppe"); + columnNames[6] = TranslationFacility.tr("ls.player.short_motherclub"); + columnNames[7] = TranslationFacility.tr("ls.player.short_leadership"); + columnNames[8] = TranslationFacility.tr("ls.player.short_experience"); + columnNames[9] = TranslationFacility.tr("ls.player.short_form"); + columnNames[10] = TranslationFacility.tr("ls.player.skill_short.stamina"); + columnNames[11] = TranslationFacility.tr("ls.player.short_loyalty"); + columnNames[12] = TranslationFacility.tr("ls.player.skill_short.keeper"); + columnNames[13] = TranslationFacility.tr("ls.player.skill_short.defending"); + columnNames[14] = TranslationFacility.tr("ls.player.skill_short.playmaking"); + columnNames[15] = TranslationFacility.tr("ls.player.skill_short.passing"); + columnNames[16] = TranslationFacility.tr("ls.player.skill_short.winger"); + columnNames[17] = TranslationFacility.tr("ls.player.skill_short.scoring"); + columnNames[18] = TranslationFacility.tr("ls.player.skill_short.setpieces"); + columnNames[19] = TranslationFacility.tr("ls.player.position_short.keeper"); + columnNames[20] = TranslationFacility.tr("ls.player.position_short.centraldefender"); + columnNames[21] = TranslationFacility.tr("ls.player.position_short.centraldefendertowardswing"); + columnNames[22] = TranslationFacility.tr("ls.player.position_short.centraldefenderoffensive"); + columnNames[23] = TranslationFacility.tr("ls.player.position_short.wingback"); + columnNames[24] = TranslationFacility.tr("ls.player.position_short.wingbacktowardsmiddle"); + columnNames[25] = TranslationFacility.tr("ls.player.position_short.wingbackoffensive"); + columnNames[26] = TranslationFacility.tr("ls.player.position_short.wingbackdefensive"); + columnNames[27] = TranslationFacility.tr("ls.player.position_short.innermidfielder"); + columnNames[28] = TranslationFacility.tr("ls.player.position_short.innermidfieldertowardswing"); + columnNames[29] = TranslationFacility.tr("ls.player.position_short.innermidfielderoffensive"); + columnNames[30] = TranslationFacility.tr("ls.player.position_short.innermidfielderdefensive"); + columnNames[31] = TranslationFacility.tr("ls.player.position_short.winger"); + columnNames[32] = TranslationFacility.tr("ls.player.position_short.wingertowardsmiddle"); + columnNames[33] = TranslationFacility.tr("ls.player.position_short.wingeroffensive"); + columnNames[34] = TranslationFacility.tr("ls.player.position_short.wingerdefensive"); + columnNames[35] = TranslationFacility.tr("ls.player.position_short.forward"); + columnNames[36] = TranslationFacility.tr("ls.player.position_short.forwarddefensive"); + columnNames[37] = TranslationFacility.tr("ls.player.position_short.forwardtowardswing"); + columnNames[38] = TranslationFacility.tr("ls.player.wage"); + columnNames[39] = TranslationFacility.tr("ls.player.tsi"); + columnNames[40] = TranslationFacility.tr("ls.player.id"); m_anzZeilen = spieler.length; diff --git a/src/main/java/module/series/MatchDayPanel.java b/src/main/java/module/series/MatchDayPanel.java index cb77e5293..3eafea280 100644 --- a/src/main/java/module/series/MatchDayPanel.java +++ b/src/main/java/module/series/MatchDayPanel.java @@ -7,6 +7,7 @@ import core.gui.theme.HOColorName; import core.gui.theme.ImageUtilities; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.enums.MatchType; import core.model.series.Paarung; import core.net.OnlineWorker; @@ -15,12 +16,12 @@ import core.util.Helper; import core.util.StringUtils; import org.jetbrains.annotations.Nullable; + import javax.swing.*; import java.awt.*; -import java.awt.event.*; -import java.text.DateFormat; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.time.temporal.ChronoUnit; -import java.util.Date; import java.util.List; import static core.gui.theme.ThemeManager.getColor; @@ -113,13 +114,13 @@ private void setMatchButton(JButton button, @Nullable Paarung paarung) { if ( gameFinished ) { //Match already in the database if (DBManager.instance().isMatchInDB(paarung.getMatchId(), MatchType.LEAGUE)) { - button.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Ligatabelle_SpielAnzeigen")); + button.setToolTipText(TranslationFacility.tr("tt_Ligatabelle_SpielAnzeigen")); button.setEnabled(true); button.setIcon(ImageUtilities.getRightArrowIcon(getColor(HOColorName.SHOW_MATCH), 14, 14)); } // Match not yet in the database else { - button.setToolTipText(HOVerwaltung.instance().getLanguageString( + button.setToolTipText(TranslationFacility.tr( "tt_Ligatabelle_SpielDownloaden")); button.setEnabled(true); button.setIcon(ImageUtilities.getDownloadIcon(getColor(HOColorName.DOWNLOAD_MATCH), 14, 14)); @@ -127,7 +128,7 @@ private void setMatchButton(JButton button, @Nullable Paarung paarung) { } // Match has not taken place yet else { - button.setToolTipText(HOVerwaltung.instance().getLanguageString( + button.setToolTipText(TranslationFacility.tr( "tt_Ligatabelle_SpielNochnichtgespielt")); button.setEnabled(false); button.setIcon(ImageUtilities.getUnavailableIcon(getColor(HOColorName.DOWNLOAD_MATCH), 14, 14)); @@ -166,7 +167,7 @@ else if (spieltag == NAECHSTER_SPIELTAG) { List paarungen = this.model.getCurrentSeries().getPaarungenBySpieltag(spieltag); - String bordertext = HOVerwaltung.instance().getLanguageString("Spieltag") + " " + spieltag; + String bordertext = TranslationFacility.tr("Spieltag") + " " + spieltag; if (paarungen != null && !paarungen.isEmpty()) { bordertext += (" ( " + paarungen.get(0).getDatum().toLocaleDateTime() + " )"); @@ -280,7 +281,7 @@ private void initComponents() { setLayout(layout); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Heim")); + label = new JLabel(TranslationFacility.tr("Heim")); label.setFont(label.getFont().deriveFont(Font.BOLD)); label.setHorizontalAlignment(SwingConstants.CENTER); setConstraintsValues(constraints, GridBagConstraints.HORIZONTAL, 1.0, 0, 0, 1); @@ -293,14 +294,14 @@ private void initComponents() { layout.setConstraints(label, constraints); add(label); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Gast")); + label = new JLabel(TranslationFacility.tr("Gast")); label.setFont(label.getFont().deriveFont(Font.BOLD)); label.setHorizontalAlignment(SwingConstants.CENTER); setConstraintsValues(constraints, GridBagConstraints.HORIZONTAL, 1.0, 2, 0, 1); layout.setConstraints(label, constraints); add(label); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.match.result")); + label = new JLabel(TranslationFacility.tr("ls.match.result")); label.setFont(label.getFont().deriveFont(Font.BOLD)); label.setHorizontalAlignment(SwingConstants.CENTER); setConstraintsValues(constraints, GridBagConstraints.NONE, 0.5, 3, 0, 3); diff --git a/src/main/java/module/series/SeriesModule.java b/src/main/java/module/series/SeriesModule.java index f69248fdf..aa157a4fb 100644 --- a/src/main/java/module/series/SeriesModule.java +++ b/src/main/java/module/series/SeriesModule.java @@ -1,10 +1,10 @@ package module.series; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; import javax.swing.*; -import java.awt.event.*; +import java.awt.event.KeyEvent; public final class SeriesModule extends DefaultModule { @@ -20,7 +20,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Ligatabelle"); + return TranslationFacility.tr("Ligatabelle"); } @Override diff --git a/src/main/java/module/series/SeriesPanel.java b/src/main/java/module/series/SeriesPanel.java index fc2a0327f..c8da367e8 100644 --- a/src/main/java/module/series/SeriesPanel.java +++ b/src/main/java/module/series/SeriesPanel.java @@ -7,9 +7,10 @@ import core.gui.theme.HOColorName; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; -import module.series.promotion.*; +import module.series.promotion.LeaguePromotionHandler; +import module.series.promotion.PromotionInfoPanel; import javax.swing.*; import java.awt.*; @@ -51,9 +52,9 @@ private void delete() { if (seasonComboBox.getSelectedItem() != null) { Spielplan spielplan = (Spielplan) seasonComboBox.getSelectedItem(); int value = JOptionPane.showConfirmDialog(this, - HOVerwaltung.instance().getLanguageString("ls.button.delete") + " " - + HOVerwaltung.instance().getLanguageString("Ligatabelle") + ":\n" - + spielplan.toString(), HOVerwaltung.instance().getLanguageString("confirmation.title"), JOptionPane.YES_NO_OPTION); + TranslationFacility.tr("ls.button.delete") + " " + + TranslationFacility.tr("Ligatabelle") + ":\n" + + spielplan.toString(), TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); if (value == JOptionPane.YES_OPTION) { DBManager.instance().deleteSpielplanTabelle(spielplan.getSaison(), spielplan.getLigaId()); @@ -144,14 +145,14 @@ private void initComponents() { final JPanel toolbarPanel = new ImagePanel(null); seasonComboBox = new JComboBox(); - seasonComboBox.setToolTipText(HOVerwaltung.instance().getLanguageString( + seasonComboBox.setToolTipText(TranslationFacility.tr( "tt_Ligatabelle_Saisonauswahl")); seasonComboBox.setSize(200, 25); seasonComboBox.setLocation(10, 5); toolbarPanel.add(seasonComboBox); deleteButton = new JButton(ThemeManager.getIcon(HOIconName.REMOVE)); - deleteButton.setToolTipText(HOVerwaltung.instance().getLanguageString( + deleteButton.setToolTipText(TranslationFacility.tr( "tt_Ligatabelle_SaisonLoeschen")); deleteButton.setSize(25, 25); deleteButton.setLocation(220, 5); diff --git a/src/main/java/module/series/Spielplan.java b/src/main/java/module/series/Spielplan.java index 39af341d4..b1dbf74e9 100644 --- a/src/main/java/module/series/Spielplan.java +++ b/src/main/java/module/series/Spielplan.java @@ -1,10 +1,12 @@ package module.series; import core.db.AbstractTable; +import core.model.TranslationFacility; import core.model.series.*; import core.net.OnlineWorker; import core.util.HODateTime; import core.util.HOLogger; + import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -184,9 +186,9 @@ public final boolean equals(Object o) { @Override public final String toString() { - return core.model.HOVerwaltung.instance().getLanguageString("Season") + return TranslationFacility.tr("Season") + " " + getSaison() + " " - + core.model.HOVerwaltung.instance().getLanguageString("Liga") + + TranslationFacility.tr("Liga") + " " + getLigaName() + " (" + getLigaId() + ")"; } diff --git a/src/main/java/module/series/promotion/PromotionInfoPanel.java b/src/main/java/module/series/promotion/PromotionInfoPanel.java index 60a0a83aa..b47ac65a2 100644 --- a/src/main/java/module/series/promotion/PromotionInfoPanel.java +++ b/src/main/java/module/series/promotion/PromotionInfoPanel.java @@ -8,11 +8,12 @@ import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.misc.Basics; import javax.swing.*; -import javax.swing.border.*; +import javax.swing.border.EmptyBorder; import java.awt.*; import java.util.Collections; import java.util.List; @@ -73,16 +74,16 @@ private void initComponents() { final Basics basics = DBManager.instance().getBasics(HOVerwaltung.instance().getId()); final JButton downloadLeagueButton = new JButton(ImageUtilities.getDownloadIcon(getColor(HOColorName.DOWNLOAD_MATCH), 14, 14)); this.add(downloadLeagueButton); - final JLabel downloadLabel = new JLabel(verwaltung.getLanguageString("pd_status.download.unavailable.data")); + final JLabel downloadLabel = new JLabel(TranslationFacility.tr("pd_status.download.unavailable.data")); downloadLabel.setFont(defaultFont); downloadLabel.setForeground(fgColor); this.add(downloadLabel); - downloadLeagueButton.setToolTipText(verwaltung.getLanguageString("pd_status.download.data")); + downloadLeagueButton.setToolTipText(TranslationFacility.tr("pd_status.download.data")); downloadLeagueButton.addActionListener(e -> { int choice = JOptionPane.showConfirmDialog(HOMainFrame.instance(), - verwaltung.getLanguageString("pd_status.download.warning.message"), - verwaltung.getLanguageString("pd_status.download.warning.title"), + TranslationFacility.tr("pd_status.download.warning.message"), + TranslationFacility.tr("pd_status.download.warning.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); @@ -90,7 +91,7 @@ private void initComponents() { promotionHandler.downloadLeagueData(basics.getLiga()); downloadLeagueButton.setEnabled(false); downloadLeagueButton.setIcon(ThemeManager.getIcon(HOIconName.SPINNER)); - downloadLabel.setText(verwaltung.getLanguageString("pd_status.download.unavailable.loading")); + downloadLabel.setText(TranslationFacility.tr("pd_status.download.unavailable.loading")); this.revalidate(); this.repaint(); } @@ -115,7 +116,7 @@ private void createBeingProcessedLabel() { this.removeAll(); final Basics basics = DBManager.instance().getBasics(HOVerwaltung.instance().getId()); - JLabel processingLabel = new JLabel(HOVerwaltung.instance().getLanguageString( + JLabel processingLabel = new JLabel(TranslationFacility.tr( "pd_status.download.pending", basics.getLiga())); processingLabel.setFont(defaultFont); @@ -143,9 +144,9 @@ private String createPromotionStatusDisplayString(LeaguePromotionInfo leagueProm } if (leagueDetails.isEmpty()) { - return HOVerwaltung.instance().getLanguageString("pd_status." + leaguePromotionInfo.status.name()); + return TranslationFacility.tr("pd_status." + leaguePromotionInfo.status.name()); } else { - return HOVerwaltung.instance().getLanguageString("pd_status." + leaguePromotionInfo.status.name(), + return TranslationFacility.tr("pd_status." + leaguePromotionInfo.status.name(), String.join(", ", leagueDetails), String.join(", ", teamDetails.stream() .map(stringStringMap -> stringStringMap.get("TeamName")) diff --git a/src/main/java/module/specialEvents/FilterPanel.java b/src/main/java/module/specialEvents/FilterPanel.java index 15efa5c76..5b0371dee 100644 --- a/src/main/java/module/specialEvents/FilterPanel.java +++ b/src/main/java/module/specialEvents/FilterPanel.java @@ -5,14 +5,13 @@ import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.IMatchDetails; import core.model.player.Player; import module.specialEvents.filter.Filter; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -20,16 +19,6 @@ import java.util.Comparator; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.ComboBoxModel; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; - public class FilterPanel extends JPanel { private static final long serialVersionUID = 6299290138063653349L; @@ -440,7 +429,7 @@ private JPanel createPlayerFilterPanel() { * @return */ private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } private void updatePlayerComboBoxData(boolean currentPlayersOnly) { diff --git a/src/main/java/module/specialEvents/SpecialEventsModule.java b/src/main/java/module/specialEvents/SpecialEventsModule.java index 81ba1ef8e..67783ac86 100644 --- a/src/main/java/module/specialEvents/SpecialEventsModule.java +++ b/src/main/java/module/specialEvents/SpecialEventsModule.java @@ -1,13 +1,11 @@ package module.specialEvents; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; +import javax.swing.*; import java.awt.event.KeyEvent; -import javax.swing.JPanel; -import javax.swing.KeyStroke; - public class SpecialEventsModule extends DefaultModule { SpecialEventsPanel specialEventsPanel; @@ -24,7 +22,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Tab_SpecialEvents"); + return TranslationFacility.tr("Tab_SpecialEvents"); } @Override diff --git a/src/main/java/module/statistics/ArenaStatistikPanel.java b/src/main/java/module/statistics/ArenaStatistikPanel.java index e1da65f88..7efb0a238 100644 --- a/src/main/java/module/statistics/ArenaStatistikPanel.java +++ b/src/main/java/module/statistics/ArenaStatistikPanel.java @@ -4,18 +4,14 @@ import core.datatype.CBItem; import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.matches.MatchesPanel; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Font; +import javax.swing.*; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.JComboBox; -import javax.swing.JScrollPane; - public class ArenaStatistikPanel extends LazyImagePanel { private static final long serialVersionUID = 2679088584924124183L; private ArenaStatistikTable arenaStatistikTable; @@ -72,20 +68,19 @@ public final void itemStateChanged(ItemEvent e) { private CBItem[] getMatchFilterItems() { CBItem[] matchFilterItems = { - new CBItem(HOVerwaltung.instance().getLanguageString("NurEigeneSpiele"), + new CBItem(TranslationFacility.tr("NurEigeneSpiele"), MatchesPanel.OWN_GAMES), - new CBItem(HOVerwaltung.instance().getLanguageString("NurEigenePflichtspiele"), + new CBItem(TranslationFacility.tr("NurEigenePflichtspiele"), MatchesPanel.OWN_OFFICIAL_GAMES), - new CBItem(HOVerwaltung.instance().getLanguageString("NurEigenePokalspiele"), + new CBItem(TranslationFacility.tr("NurEigenePokalspiele"), MatchesPanel.OWN_NATIONAL_CUP_GAMES), - new CBItem(HOVerwaltung.instance().getLanguageString("OnlySecondaryCup"), + new CBItem(TranslationFacility.tr("OnlySecondaryCup"), MatchesPanel.OWN_SECONDARY_CUP_GAMES), - new CBItem(HOVerwaltung.instance().getLanguageString("NurEigeneLigaspiele"), + new CBItem(TranslationFacility.tr("NurEigeneLigaspiele"), MatchesPanel.OWN_LEAGUE_GAMES), - new CBItem(HOVerwaltung.instance().getLanguageString("OnlyQualificationMatches"), + new CBItem(TranslationFacility.tr("OnlyQualificationMatches"), MatchesPanel.OWN_QUALIF_GAMES), - new CBItem(HOVerwaltung.instance() - .getLanguageString("NurEigeneFreundschaftsspiele"), + new CBItem(TranslationFacility.tr("NurEigeneFreundschaftsspiele"), MatchesPanel.OWN_FRIENDLY_GAMES) }; return matchFilterItems; } diff --git a/src/main/java/module/statistics/ClubStatisticsPanel.java b/src/main/java/module/statistics/ClubStatisticsPanel.java index cb17b7f86..c9b794ace 100644 --- a/src/main/java/module/statistics/ClubStatisticsPanel.java +++ b/src/main/java/module/statistics/ClubStatisticsPanel.java @@ -5,28 +5,22 @@ import core.gui.comp.ImageCheckbox; import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyImagePanel; -import core.util.chart.HOLinesChart; -import core.util.chart.LinesChartDataModel; import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.util.HOLogger; import core.util.Helper; +import core.util.chart.HOLinesChart; +import core.util.chart.LinesChartDataModel; import org.knowm.xchart.style.lines.SeriesLines; import org.knowm.xchart.style.markers.SeriesMarkers; +import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.text.NumberFormat; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; /** * Panel Club in Module Statistics @@ -401,6 +395,6 @@ private void getData() { } private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } } diff --git a/src/main/java/module/statistics/FinancesStatisticsPanel.java b/src/main/java/module/statistics/FinancesStatisticsPanel.java index ddbb90b53..8576569c3 100644 --- a/src/main/java/module/statistics/FinancesStatisticsPanel.java +++ b/src/main/java/module/statistics/FinancesStatisticsPanel.java @@ -4,21 +4,22 @@ import core.gui.HOMainFrame; import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyImagePanel; -import core.util.chart.LinesChartDataModel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.util.HOLogger; import core.util.Helper; -import core.util.chart.HOLinesChart; import core.util.chart.HODoublePieChart; +import core.util.chart.HOLinesChart; +import core.util.chart.LinesChartDataModel; import core.util.chart.PieChartDataModel; + +import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.ItemEvent; import java.text.NumberFormat; import java.util.Arrays; -import javax.swing.*; import static core.gui.theme.HOColorName.*; @@ -334,7 +335,7 @@ private void initStatistik() { } } - private String getLangStr(String key) {return HOVerwaltung.instance().getLanguageString(key);} + private String getLangStr(String key) {return TranslationFacility.tr(key);} private String getChartCode(int i) { diff --git a/src/main/java/module/statistics/MatchesStatisticsPanel.java b/src/main/java/module/statistics/MatchesStatisticsPanel.java index 933974909..1471b5b16 100644 --- a/src/main/java/module/statistics/MatchesStatisticsPanel.java +++ b/src/main/java/module/statistics/MatchesStatisticsPanel.java @@ -7,43 +7,32 @@ import core.gui.comp.ImageCheckbox; import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyImagePanel; -import core.model.match.MatchLineupPosition; -import core.util.HODateTime; -import core.util.chart.LinesChartDataModel; import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; +import core.model.match.MatchLineupPosition; import core.model.match.Matchdetails; import core.model.player.IMatchRoleID; +import core.util.HODateTime; import core.util.HOLogger; import core.util.Helper; import core.util.chart.HOLinesChart; +import core.util.chart.LinesChartDataModel; import module.matches.MatchLocation; import module.matches.MatchesPanel; import org.knowm.xchart.style.lines.SeriesLines; import org.knowm.xchart.style.markers.SeriesMarkers; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; import java.time.temporal.ChronoUnit; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; /** * Panel Matches in Module Statistics @@ -74,8 +63,8 @@ public class MatchesStatisticsPanel extends LazyImagePanel { private final String sSum = "Σ "; private final String sAvg = "Ø "; - private final String avgRating = sAvg + HOVerwaltung.instance().getLanguageString("Rating"); - private final String sumStars = sSum + HOVerwaltung.instance().getLanguageString("RecapPanel.Stars"); + private final String avgRating = sAvg + TranslationFacility.tr("Rating"); + private final String sumStars = sSum + TranslationFacility.tr("RecapPanel.Stars"); @Override protected void initialize() { @@ -617,7 +606,7 @@ private CBItem[] getMatchFilterItems() { } private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } } \ No newline at end of file diff --git a/src/main/java/module/statistics/PlayerStatisticsPanel.java b/src/main/java/module/statistics/PlayerStatisticsPanel.java index f1fcf1b88..d4f9d2dbd 100644 --- a/src/main/java/module/statistics/PlayerStatisticsPanel.java +++ b/src/main/java/module/statistics/PlayerStatisticsPanel.java @@ -8,22 +8,21 @@ import core.gui.comp.panel.LazyImagePanel; import core.gui.model.PlayerCBItem; import core.gui.model.PlayerCBItemRenderer; -import core.util.chart.LinesChartDataModel; import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.Player; import core.util.HOLogger; import core.util.Helper; import core.util.chart.HOLinesChart; +import core.util.chart.LinesChartDataModel; import org.knowm.xchart.style.lines.SeriesLines; import org.knowm.xchart.style.markers.SeriesMarkers; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; @@ -33,15 +32,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; /** * Panel Player in Module Statistics @@ -545,12 +535,10 @@ private void initStatistik() { Colors.getColor(Colors.COLOR_PLAYER_LOYALTY)); } - oChartPanel.setAllValues(models, statistikWerte[15], format, HOVerwaltung - .instance().getLanguageString("Wochen"), "", + oChartPanel.setAllValues(models, statistikWerte[15], format, TranslationFacility.tr("Wochen"), "", jcbInscribe.isSelected(), jcbHelpLines.isSelected()); } else { - oChartPanel.setAllValues(null, new double[0], format, HOVerwaltung - .instance().getLanguageString("Wochen"), "", + oChartPanel.setAllValues(null, new double[0], format, TranslationFacility.tr("Wochen"), "", jcbInscribe.isSelected(), jcbHelpLines.isSelected()); } } catch (Exception e) { @@ -559,7 +547,7 @@ private void initStatistik() { } private String getLangStr(String key) { - return HOVerwaltung.instance().getLanguageString(key); + return TranslationFacility.tr(key); } diff --git a/src/main/java/module/statistics/StatisticsModule.java b/src/main/java/module/statistics/StatisticsModule.java index 7369f87d8..c5a9c28b8 100644 --- a/src/main/java/module/statistics/StatisticsModule.java +++ b/src/main/java/module/statistics/StatisticsModule.java @@ -1,14 +1,11 @@ package module.statistics; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; -import javax.swing.KeyStroke; - - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; +import javax.swing.*; +import java.awt.event.KeyEvent; + public final class StatisticsModule extends DefaultModule { public StatisticsModule(){ @@ -22,7 +19,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Statistik"); + return TranslationFacility.tr("Statistik"); } @Override diff --git a/src/main/java/module/statistics/StatistikMainPanel.java b/src/main/java/module/statistics/StatistikMainPanel.java index fb3714d4c..da4c5c0e9 100644 --- a/src/main/java/module/statistics/StatistikMainPanel.java +++ b/src/main/java/module/statistics/StatistikMainPanel.java @@ -3,6 +3,7 @@ import core.gui.comp.panel.LazyImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import java.awt.BorderLayout; @@ -39,33 +40,33 @@ private void initComponents() { // Spielerstatistik playerStatisticsPanel = new PlayerStatisticsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Spieler"), + tabbedPane.addTab(TranslationFacility.tr("Spieler"), playerStatisticsPanel); // Team Panel teamStatisticsPanel = new TeamStatisticsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Verein"), + tabbedPane.addTab(TranslationFacility.tr("Verein"), teamStatisticsPanel); // SpieleStatistik matchesStatisticsPanel = new MatchesStatisticsPanel(); tabbedPane - .addTab(HOVerwaltung.instance().getLanguageString("Spiele"), matchesStatisticsPanel); + .addTab(TranslationFacility.tr("Spiele"), matchesStatisticsPanel); // clubStatisticsPanel clubStatisticsPanel = new ClubStatisticsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("ls.module.statistics.club"), + tabbedPane.addTab(TranslationFacility.tr("ls.module.statistics.club"), clubStatisticsPanel); // Finanzstatistik financesStatisticsPanel = new FinancesStatisticsPanel(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("Finanzen"), + tabbedPane.addTab(TranslationFacility.tr("Finanzen"), financesStatisticsPanel); // Arenastatistik arenaStatistikPanel = new ArenaStatistikPanel(); tabbedPane - .addTab(HOVerwaltung.instance().getLanguageString("Stadion"), arenaStatistikPanel); + .addTab(TranslationFacility.tr("Stadion"), arenaStatistikPanel); add(tabbedPane, java.awt.BorderLayout.CENTER); } diff --git a/src/main/java/module/statistics/TeamStatisticsPanel.java b/src/main/java/module/statistics/TeamStatisticsPanel.java index 9676deb7c..113487945 100644 --- a/src/main/java/module/statistics/TeamStatisticsPanel.java +++ b/src/main/java/module/statistics/TeamStatisticsPanel.java @@ -1,22 +1,22 @@ package module.statistics; -import static core.gui.theme.HOColorName.PANEL_BORDER; -import static core.gui.theme.HOColorName.TABLEENTRY_BG; import core.db.DBManager; import core.gui.HOMainFrame; import core.gui.comp.ImageCheckbox; import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyImagePanel; -import core.util.chart.LinesChartDataModel; import core.gui.theme.GroupTeamFactory; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.util.HOLogger; import core.util.Helper; import core.util.chart.HOLinesChart; +import core.util.chart.LinesChartDataModel; import org.knowm.xchart.style.lines.SeriesLines; import org.knowm.xchart.style.markers.SeriesMarkers; + +import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; @@ -24,7 +24,9 @@ import java.awt.event.ItemEvent; import java.io.Serial; import java.text.NumberFormat; -import javax.swing.*; + +import static core.gui.theme.HOColorName.PANEL_BORDER; +import static core.gui.theme.HOColorName.TABLEENTRY_BG; /** * The Team statistics panel @@ -59,34 +61,34 @@ public class TeamStatisticsPanel extends LazyImagePanel { private final String sSum = "\u03A3 "; private final String sAvg = "\u00D8 "; - private final String sumLeadership = sSum + HOVerwaltung.instance().getLanguageString("ls.player.leadership"); - private final String avgLeadership = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.leadership"); - private final String sumXP = sSum + HOVerwaltung.instance().getLanguageString("ls.player.experience"); - private final String avgXP = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.experience"); - private final String sumTSI = sSum + HOVerwaltung.instance().getLanguageString("ls.player.tsi"); - private final String avgTSI = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.tsi"); - private final String sumWage = sSum + HOVerwaltung.instance().getLanguageString("ls.player.wage"); - private final String avgWage = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.wage"); - private final String avgForm = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.form"); - private final String sumForm = sSum + HOVerwaltung.instance().getLanguageString("ls.player.form"); - private final String avgStamina = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina"); - private final String sumStamina = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina"); - private final String avgLoyalty = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.loyalty"); - private final String sumLoyalty = sSum + HOVerwaltung.instance().getLanguageString("ls.player.loyalty"); - private final String sumGK = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper"); - private final String avgGK = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper"); - private final String sumDE = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.defending"); - private final String avgDE = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.defending"); - private final String sumPM = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking"); - private final String avgPM = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking"); - private final String sumPS = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.passing"); - private final String avgPS = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.passing"); - private final String sumWI = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.winger"); - private final String avgWI = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.winger"); - private final String sumSC = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring"); - private final String avgSC = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring"); - private final String sumSP = sSum + HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces"); - private final String avgSP = sAvg + HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces"); + private final String sumLeadership = sSum + TranslationFacility.tr("ls.player.leadership"); + private final String avgLeadership = sAvg + TranslationFacility.tr("ls.player.leadership"); + private final String sumXP = sSum + TranslationFacility.tr("ls.player.experience"); + private final String avgXP = sAvg + TranslationFacility.tr("ls.player.experience"); + private final String sumTSI = sSum + TranslationFacility.tr("ls.player.tsi"); + private final String avgTSI = sAvg + TranslationFacility.tr("ls.player.tsi"); + private final String sumWage = sSum + TranslationFacility.tr("ls.player.wage"); + private final String avgWage = sAvg + TranslationFacility.tr("ls.player.wage"); + private final String avgForm = sAvg + TranslationFacility.tr("ls.player.form"); + private final String sumForm = sSum + TranslationFacility.tr("ls.player.form"); + private final String avgStamina = sAvg + TranslationFacility.tr("ls.player.skill.stamina"); + private final String sumStamina = sSum + TranslationFacility.tr("ls.player.skill.stamina"); + private final String avgLoyalty = sAvg + TranslationFacility.tr("ls.player.loyalty"); + private final String sumLoyalty = sSum + TranslationFacility.tr("ls.player.loyalty"); + private final String sumGK = sSum + TranslationFacility.tr("ls.player.skill.keeper"); + private final String avgGK = sAvg + TranslationFacility.tr("ls.player.skill.keeper"); + private final String sumDE = sSum + TranslationFacility.tr("ls.player.skill.defending"); + private final String avgDE = sAvg + TranslationFacility.tr("ls.player.skill.defending"); + private final String sumPM = sSum + TranslationFacility.tr("ls.player.skill.playmaking"); + private final String avgPM = sAvg + TranslationFacility.tr("ls.player.skill.playmaking"); + private final String sumPS = sSum + TranslationFacility.tr("ls.player.skill.passing"); + private final String avgPS = sAvg + TranslationFacility.tr("ls.player.skill.passing"); + private final String sumWI = sSum + TranslationFacility.tr("ls.player.skill.winger"); + private final String avgWI = sAvg + TranslationFacility.tr("ls.player.skill.winger"); + private final String sumSC = sSum + TranslationFacility.tr("ls.player.skill.scoring"); + private final String avgSC = sAvg + TranslationFacility.tr("ls.player.skill.scoring"); + private final String sumSP = sSum + TranslationFacility.tr("ls.player.skill.setpieces"); + private final String avgSP = sAvg + TranslationFacility.tr("ls.player.skill.setpieces"); @Override protected void initialize() { @@ -458,7 +460,6 @@ else if (e.getSource() == jcbSetPieces.getCheckbox()) { private void initComponents() { UserParameter gup = UserParameter.instance(); - HOVerwaltung hov = HOVerwaltung.instance(); JLabel labelWeeks, labelSquad, labelAggType; String textLabel; @@ -482,7 +483,7 @@ private void initComponents() { panel2.setLayout(layout2); int gridy = 0; - labelWeeks = new JLabel(hov.getLanguageString("Wochen")); + labelWeeks = new JLabel(TranslationFacility.tr("Wochen")); constraints2.anchor = GridBagConstraints.WEST; constraints2.gridx = 0; constraints2.gridy = ++gridy; @@ -499,25 +500,25 @@ private void initComponents() { panel2.add(jtfNumberOfHRF); constraints2.gridx = 2; - jbApply = new JButton(hov.getLanguageString("ls.button.apply")); + jbApply = new JButton(TranslationFacility.tr("ls.button.apply")); constraints2.insets = new Insets(10,20,0,0); //top padding layout2.setConstraints(jbApply, constraints2); - jbApply.setToolTipText(hov.getLanguageString("tt_Statistik_HRFAnzahluebernehmen")); + jbApply.setToolTipText(TranslationFacility.tr("tt_Statistik_HRFAnzahluebernehmen")); panel2.add(jbApply); constraints2.insets = new Insets(20,0,0,0); constraints2.gridwidth = 3; - jcbHelpLines = new JCheckBox(hov.getLanguageString("Hilflinien"), gup.statistikAlleHilfslinien); + jcbHelpLines = new JCheckBox(TranslationFacility.tr("Hilflinien"), gup.statistikAlleHilfslinien); add(jcbHelpLines, ++gridy, layout2, constraints2); constraints2.insets = new Insets(20,0,0,0); constraints2.gridwidth = 3; - jcbInscribe = new JCheckBox(hov.getLanguageString("Beschriftung"), gup.statistikAlleBeschriftung); + jcbInscribe = new JCheckBox(TranslationFacility.tr("Beschriftung"), gup.statistikAlleBeschriftung); add(jcbInscribe, ++gridy, layout2, constraints2); - labelSquad = new JLabel(hov.getLanguageString("Gruppe")); + labelSquad = new JLabel(TranslationFacility.tr("Gruppe")); constraints2.gridx = 0; constraints2.gridy = ++gridy; constraints2.gridwidth = 1; @@ -534,21 +535,21 @@ private void initComponents() { layout2.setConstraints(jcbTeam, constraints2); panel2.add(jcbTeam); - labelAggType = new JLabel(hov.getLanguageString("ls.agg")); + labelAggType = new JLabel(TranslationFacility.tr("ls.agg")); constraints2.gridx = 0; constraints2.gridy = ++gridy; constraints2.gridwidth = 1; constraints2.insets = new Insets(0,0,0,0); //top padding panel2.add(labelAggType, constraints2); - String[] sAggType = { hov.getLanguageString("Gesamt"), hov.getLanguageString("Durchschnitt")}; + String[] sAggType = { TranslationFacility.tr("Gesamt"), TranslationFacility.tr("Durchschnitt")}; jcbAggType = new JComboBox<>(sAggType); jcbAggType.setSelectedIndex(gup.statisticsTeamSumOrAverage); bSum = (gup.statisticsTeamSumOrAverage == 0); constraints2.insets = new Insets(0,5,0,0); //top padding layout2.setConstraints(jcbAggType, constraints2); - jcbAggType.setToolTipText(hov.getLanguageString("ls.module.statistic.team.choose_sum_or_average")); + jcbAggType.setToolTipText(TranslationFacility.tr("ls.module.statistic.team.choose_sum_or_average")); constraints2.gridx = 1; constraints2.gridwidth = 2; panel2.add(jcbAggType, constraints2); @@ -620,7 +621,7 @@ private void initComponents() { // TSI ============================================================================================= textLabel = bSum ? sumTSI : avgTSI; - textLabel += " (" + hov.getLanguageString("ls.chart.second_axis") + ")"; + textLabel += " (" + TranslationFacility.tr("ls.chart.second_axis") + ")"; constraints2.insets = new Insets(20,0,0,0); jcbTSI = new ImageCheckbox(textLabel, Colors.getColor(Colors.COLOR_PLAYER_TSI), gup.statistikAllTSI); add(jcbTSI, ++gridy, layout2, constraints2); @@ -628,7 +629,7 @@ private void initComponents() { // WAGE ============================================================================================ constraints2.insets = new Insets(0,0,0,0); textLabel = bSum ? sumWage : avgWage; - textLabel += " (" + hov.getLanguageString("ls.chart.second_axis") + ")"; + textLabel += " (" + TranslationFacility.tr("ls.chart.second_axis") + ")"; jcbWage = new ImageCheckbox(textLabel, Colors.getColor(Colors.COLOR_PLAYER_WAGE), gup.statistikAllWages); add(jcbWage, ++gridy, layout2, constraints2); @@ -790,8 +791,8 @@ private void initStatistik() { Colors.getColor(Colors.COLOR_PLAYER_SP)); } - mChart.setAllValues(models, statistikWerte[28], format, HOVerwaltung.instance() - .getLanguageString("Wochen"), "", jcbInscribe.isSelected(), jcbHelpLines.isSelected()); + mChart.setAllValues(models, statistikWerte[28], format, + TranslationFacility.tr("Wochen"), "", jcbInscribe.isSelected(), jcbHelpLines.isSelected()); } catch (Exception e) { HOLogger.instance().log(getClass(), e); } diff --git a/src/main/java/module/teamAnalyzer/TeamAnalyzerModule.java b/src/main/java/module/teamAnalyzer/TeamAnalyzerModule.java index 256e35e50..2bf0a46a7 100644 --- a/src/main/java/module/teamAnalyzer/TeamAnalyzerModule.java +++ b/src/main/java/module/teamAnalyzer/TeamAnalyzerModule.java @@ -3,6 +3,7 @@ import java.awt.event.KeyEvent; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; import module.teamAnalyzer.ui.TeamAnalyzerPanel; import module.teamAnalyzer.ui.component.SettingPanel; @@ -28,7 +29,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("TeamAnalyzer"); + return TranslationFacility.tr("TeamAnalyzer"); } @Override diff --git a/src/main/java/module/teamAnalyzer/manager/TeamLineupBuilder.java b/src/main/java/module/teamAnalyzer/manager/TeamLineupBuilder.java index f030b4951..61b29bccb 100644 --- a/src/main/java/module/teamAnalyzer/manager/TeamLineupBuilder.java +++ b/src/main/java/module/teamAnalyzer/manager/TeamLineupBuilder.java @@ -1,6 +1,6 @@ package module.teamAnalyzer.manager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.IMatchType; import core.model.player.IMatchRoleID; import core.prediction.engine.TeamData; @@ -10,12 +10,7 @@ import module.teamAnalyzer.report.TeamReport; import module.teamAnalyzer.vo.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.SortedSet; -import java.util.TreeSet; +import java.util.*; public class TeamLineupBuilder { //~ Instance fields ---------------------------------------------------------------------------- @@ -94,7 +89,7 @@ private PlayerAppearance getPlayer(Collection collection) { if ((appearances.length > 2) && (appearances[2].getAppearance() == appearances[0].getAppearance())) { - app.setName(HOVerwaltung.instance().getLanguageString("TeamLineupBuilder.Unknown")); //$NON-NLS-1$ + app.setName(TranslationFacility.tr("TeamLineupBuilder.Unknown")); //$NON-NLS-1$ } else { // String status1 = (appearances[0].getStatus()!=PlayerManager.AVAILABLE)? "*":""; // String status2 = (appearances[1].getStatus()!=PlayerManager.AVAILABLE)? "*":""; diff --git a/src/main/java/module/teamAnalyzer/report/TeamReport.java b/src/main/java/module/teamAnalyzer/report/TeamReport.java index b72c7fe28..935beb199 100644 --- a/src/main/java/module/teamAnalyzer/report/TeamReport.java +++ b/src/main/java/module/teamAnalyzer/report/TeamReport.java @@ -3,6 +3,7 @@ import core.db.DBManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.prediction.engine.TeamData; import core.specialevents.SpecialEventsPredictionManager; import module.lineup.Lineup; @@ -68,7 +69,7 @@ public TeamReport(int teamId, List matchDetails) { addMatch(m, squadInfo, SystemManager.isShowUnavailable.isSet()); } this.averageRatingslineup = new TeamLineupBuilder(this) - .setName(HOVerwaltung.instance().getLanguageString("Durchschnitt")).build(); + .setName(TranslationFacility.tr("Durchschnitt")).build(); if ( HOVerwaltung.instance().getModel().getBasics().isNationalTeam()){ this.averageRatingslineup.setNtTeamDetails(DBManager.instance().loadNtTeamDetails(this.teamId, null)); @@ -148,7 +149,7 @@ public void adjustRatingsLineup(TeamData newRatings) { adjustedRatingsLineup = new TeamLineupBuilder(new TeamReport(this.teamId, matchDetail, null)) .setTeamData(newRatings) .setMatchType(matchDetail.getMatch().getMatchType()) - .setName(HOVerwaltung.instance().getLanguageString("ls.teamanalyzer.Adjusted")) + .setName(TranslationFacility.tr("ls.teamanalyzer.Adjusted")) .build(); } selectLineup(1); // select the adjusted lineup diff --git a/src/main/java/module/teamAnalyzer/ui/AutoFilterPanel.java b/src/main/java/module/teamAnalyzer/ui/AutoFilterPanel.java index baad9d682..15df5f516 100644 --- a/src/main/java/module/teamAnalyzer/ui/AutoFilterPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/AutoFilterPanel.java @@ -1,18 +1,16 @@ package module.teamAnalyzer.ui; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.vo.Filter; -import java.awt.BorderLayout; -import java.awt.GridLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import javax.swing.*; - /** * Panel to automatically select games to download. */ @@ -93,72 +91,72 @@ private void jbInit() { JPanel filters = new ImagePanel(); filters.setLayout(new GridLayout(12, 2)); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.Max_Number"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.Max_Number"))); //$NON-NLS-1$ number.setText(filter.getNumber() + ""); number.addKeyListener(this); filters.add(number); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.Home_Games"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.Home_Games"))); //$NON-NLS-1$ homeGames.setSelected(filter.isHomeGames()); homeGames.setOpaque(false); homeGames.addActionListener(this); filters.add(homeGames); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.Away_Games"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.Away_Games"))); //$NON-NLS-1$ awayGames.setSelected(filter.isAwayGames()); awayGames.setOpaque(false); awayGames.addActionListener(this); filters.add(awayGames); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.Win_Games"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.Win_Games"))); //$NON-NLS-1$ win.setSelected(filter.isWin()); win.setOpaque(false); win.addActionListener(this); filters.add(win); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.Draw_Games"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.Draw_Games"))); //$NON-NLS-1$ draw.setSelected(filter.isDraw()); draw.setOpaque(false); draw.addActionListener(this); filters.add(draw); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.Defeat_Games"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.Defeat_Games"))); //$NON-NLS-1$ defeat.setSelected(filter.isDefeat()); defeat.setOpaque(false); defeat.addActionListener(this); filters.add(defeat); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.LeagueGame"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.LeagueGame"))); //$NON-NLS-1$ league.setSelected(filter.isLeague()); league.setOpaque(false); league.addActionListener(this); filters.add(league); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.CupGame"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.CupGame"))); //$NON-NLS-1$ cup.setSelected(filter.isCup()); cup.setOpaque(false); cup.addActionListener(this); filters.add(cup); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.FriendlyGame"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.FriendlyGame"))); //$NON-NLS-1$ friendly.setSelected(filter.isFriendly()); friendly.setOpaque(false); friendly.addActionListener(this); filters.add(friendly); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.QualifierGame"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.QualifierGame"))); //$NON-NLS-1$ qualifier.setSelected(filter.isQualifier()); qualifier.setOpaque(false); qualifier.addActionListener(this); filters.add(qualifier); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.MastersGame"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.MastersGame"))); //$NON-NLS-1$ masters.setSelected(filter.isQualifier()); masters.setOpaque(false); masters.addActionListener(this); filters.add(masters); - filters.add(new JLabel(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.TournamentGame"))); //$NON-NLS-1$ + filters.add(new JLabel(TranslationFacility.tr("AutoFilterPanel.TournamentGame"))); //$NON-NLS-1$ tournament.setSelected(filter.isTournament()); tournament.setOpaque(false); tournament.addActionListener(this); diff --git a/src/main/java/module/teamAnalyzer/ui/FilterPanel.java b/src/main/java/module/teamAnalyzer/ui/FilterPanel.java index 058eab9e9..27010007c 100644 --- a/src/main/java/module/teamAnalyzer/ui/FilterPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/FilterPanel.java @@ -3,7 +3,7 @@ import core.file.xml.TeamStats; import core.gui.HOMainFrame; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HOLogger; import module.teamAnalyzer.SystemManager; import module.teamAnalyzer.ht.HattrickManager; @@ -11,12 +11,12 @@ import module.teamAnalyzer.vo.Team; import org.jetbrains.annotations.NotNull; +import javax.swing.*; import java.awt.*; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import javax.swing.*; /** * Panel to filter and download opponent's matches. @@ -27,8 +27,8 @@ public class FilterPanel extends JPanel { private static final String CARD_MANUAL = "MANUAL CARD"; private static boolean teamComboUpdating = false; private AutoFilterPanel autoPanel; - private final JButton downloadButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.update")); - private final JButton analyzeButton = new JButton(HOVerwaltung.instance().getLanguageString("AutoFilterPanel.Analyze")); + private final JButton downloadButton = new JButton(TranslationFacility.tr("ls.button.update")); + private final JButton analyzeButton = new JButton(TranslationFacility.tr("AutoFilterPanel.Analyze")); private final JComboBox teamCombo = new JComboBox<>(); private final JPanel cards = new JPanel(new CardLayout()); private JRadioButton radioAutomatic; @@ -61,7 +61,7 @@ public void reload() { } downloadButton.setEnabled(true); - downloadButton.setText(HOVerwaltung.instance().getLanguageString("ls.button.update")); + downloadButton.setText(TranslationFacility.tr("ls.button.update")); analyzeButton.setEnabled(true); CardLayout cLayout = (CardLayout) (cards.getLayout()); @@ -153,7 +153,7 @@ private void jbInit() { JPanel topPanel = new ImagePanel(); topPanel.setLayout(new BorderLayout()); - radioAutomatic = new JRadioButton(HOVerwaltung.instance().getLanguageString("Option.Auto")); //$NON-NLS-1$ + radioAutomatic = new JRadioButton(TranslationFacility.tr("Option.Auto")); //$NON-NLS-1$ radioAutomatic.setSelected(true); radioAutomatic.addActionListener(e -> { final CardLayout cLayout = (CardLayout) cards.getLayout(); @@ -162,7 +162,7 @@ private void jbInit() { cLayout.show(cards, CARD_AUTOMATIC); }); radioAutomatic.setOpaque(false); - radioManual = new JRadioButton(HOVerwaltung.instance().getLanguageString("Manual")); //$NON-NLS-1$ + radioManual = new JRadioButton(TranslationFacility.tr("Manual")); //$NON-NLS-1$ radioManual.addActionListener(e -> { final CardLayout cLayout = (CardLayout) cards.getLayout(); cLayout.show(cards, CARD_MANUAL); diff --git a/src/main/java/module/teamAnalyzer/ui/PlayerInfoPanel.java b/src/main/java/module/teamAnalyzer/ui/PlayerInfoPanel.java index fd342cb48..3d5841a51 100644 --- a/src/main/java/module/teamAnalyzer/ui/PlayerInfoPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/PlayerInfoPanel.java @@ -5,19 +5,13 @@ import core.constants.player.PlayerAbility; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.manager.PlayerDataManager; import module.teamAnalyzer.vo.PlayerInfo; -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.border.EtchedBorder; +import java.awt.*; public class PlayerInfoPanel extends JPanel { @@ -30,10 +24,10 @@ public class PlayerInfoPanel extends JPanel { public PlayerInfoPanel() { this.setLayout(new GridBagLayout()); - addInfo(HOVerwaltung.instance().getLanguageString("ls.player.age"), ageLabel, 0, 0); - addInfo(HOVerwaltung.instance().getLanguageString("ls.player.tsi"), tsiLabel, 0, 1); - addInfo(HOVerwaltung.instance().getLanguageString("ls.player.form"), formLabel, 1, 0); - addInfo(HOVerwaltung.instance().getLanguageString("ls.player.short_experience"), expLabel, + addInfo(TranslationFacility.tr("ls.player.age"), ageLabel, 0, 0); + addInfo(TranslationFacility.tr("ls.player.tsi"), tsiLabel, 0, 1); + addInfo(TranslationFacility.tr("ls.player.form"), formLabel, 1, 0); + addInfo(TranslationFacility.tr("ls.player.short_experience"), expLabel, 1, 1); } diff --git a/src/main/java/module/teamAnalyzer/ui/RatingPanel.java b/src/main/java/module/teamAnalyzer/ui/RatingPanel.java index cad4f4a6d..d09e4de65 100644 --- a/src/main/java/module/teamAnalyzer/ui/RatingPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/RatingPanel.java @@ -1,20 +1,18 @@ package module.teamAnalyzer.ui; import core.gui.theme.ImageUtilities; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.Helper; import module.teamAnalyzer.SystemManager; import module.teamAnalyzer.ui.model.UiRatingTableModel; import module.teamAnalyzer.ui.renderer.RatingTableCellRenderer; import module.teamAnalyzer.vo.TeamLineup; -import java.awt.BorderLayout; + +import javax.swing.*; +import java.awt.*; import java.io.Serial; import java.util.Arrays; import java.util.Vector; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ScrollPaneConstants; public class RatingPanel extends JPanel { @Serial @@ -25,10 +23,10 @@ public class RatingPanel extends JPanel { private JTable table; private UiRatingTableModel tableModel; private final String[] columns = { - HOVerwaltung.instance().getLanguageString("RatingPanel.Area"), - HOVerwaltung.instance().getLanguageString("Rating"), - HOVerwaltung.instance().getLanguageString("Differenz_kurz"), - HOVerwaltung.instance().getLanguageString("RatingPanel.Relative") + TranslationFacility.tr("RatingPanel.Area"), + TranslationFacility.tr("Rating"), + TranslationFacility.tr("Differenz_kurz"), + TranslationFacility.tr("RatingPanel.Relative") }; //~ Constructors ------------------------------------------------------------------------------- @@ -53,19 +51,19 @@ public void reload(TeamLineup lineup) { TeamLineupData opponentTeam = SystemManager.getPlugin().getMainPanel() .getOpponentTeamLineupPanel(); - tableModel.addRow(getRow(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.midfield"), + tableModel.addRow(getRow(TranslationFacility.tr("ls.match.ratingsector.midfield"), myTeam.getMidfield(), opponentTeam.getMidfield())); - tableModel.addRow(getRow(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.rightdefence"), + tableModel.addRow(getRow(TranslationFacility.tr("ls.match.ratingsector.rightdefence"), myTeam.getRightDefence(), opponentTeam.getLeftAttack())); - tableModel.addRow(getRow(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.centraldefence"), + tableModel.addRow(getRow(TranslationFacility.tr("ls.match.ratingsector.centraldefence"), myTeam.getMiddleDefence(), opponentTeam.getMiddleAttack())); - tableModel.addRow(getRow(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.leftdefence"), + tableModel.addRow(getRow(TranslationFacility.tr("ls.match.ratingsector.leftdefence"), myTeam.getLeftDefence(), opponentTeam.getRightAttack())); - tableModel.addRow(getRow(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.rightattack"), + tableModel.addRow(getRow(TranslationFacility.tr("ls.match.ratingsector.rightattack"), myTeam.getRightAttack(), opponentTeam.getLeftDefence())); - tableModel.addRow(getRow(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.centralattack"), + tableModel.addRow(getRow(TranslationFacility.tr("ls.match.ratingsector.centralattack"), myTeam.getMiddleAttack(), opponentTeam.getMiddleDefence())); - tableModel.addRow(getRow(HOVerwaltung.instance().getLanguageString("ls.match.ratingsector.leftattack"), + tableModel.addRow(getRow(TranslationFacility.tr("ls.match.ratingsector.leftattack"), myTeam.getLeftAttack(), opponentTeam.getRightDefence())); table.getTableHeader().getColumnModel().getColumn(0).setWidth(130); diff --git a/src/main/java/module/teamAnalyzer/ui/RatingUtil.java b/src/main/java/module/teamAnalyzer/ui/RatingUtil.java index 3918a3ac2..58a21ee98 100644 --- a/src/main/java/module/teamAnalyzer/ui/RatingUtil.java +++ b/src/main/java/module/teamAnalyzer/ui/RatingUtil.java @@ -2,7 +2,7 @@ package module.teamAnalyzer.ui; import core.constants.player.PlayerAbility; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import java.util.List; import java.util.StringTokenizer; @@ -51,16 +51,16 @@ public static String getRating(int rating, boolean showNumber, subLevel = st2.nextToken(); } - if (subLevel.contains(HOVerwaltung.instance().getLanguageString("veryhigh"))) { + if (subLevel.contains(TranslationFacility.tr("veryhigh"))) { level = level + "++"; } - else if (subLevel.contains(HOVerwaltung.instance().getLanguageString("high"))) { + else if (subLevel.contains(TranslationFacility.tr("high"))) { level = level + "+"; } - else if (subLevel.contains(HOVerwaltung.instance().getLanguageString("verylow"))) { + else if (subLevel.contains(TranslationFacility.tr("verylow"))) { level = level + "--"; } - else if (subLevel.contains(HOVerwaltung.instance().getLanguageString("low"))) { + else if (subLevel.contains(TranslationFacility.tr("low"))) { level = level + "-"; } diff --git a/src/main/java/module/teamAnalyzer/ui/RecapPanelTableModel.java b/src/main/java/module/teamAnalyzer/ui/RecapPanelTableModel.java index 9aa9c2445..e8e4499cf 100644 --- a/src/main/java/module/teamAnalyzer/ui/RecapPanelTableModel.java +++ b/src/main/java/module/teamAnalyzer/ui/RecapPanelTableModel.java @@ -10,6 +10,7 @@ import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.enums.MatchType; import core.model.match.Matchdetails; import core.util.CurrencyUtils; @@ -266,9 +267,9 @@ private ColorLabelEntry getMatchTypeColumnEntry(TeamLineup lineup) { tipText.append(" - "); //$NON-NLS-1$ if (lineup.isHomeMatch()) { - tipText.append(HOVerwaltung.instance().getLanguageString("Heim")); //$NON-NLS-1$ + tipText.append(TranslationFacility.tr("Heim")); //$NON-NLS-1$ } else { - tipText.append(HOVerwaltung.instance().getLanguageString("Gast")); //$NON-NLS-1$ + tipText.append(TranslationFacility.tr("Gast")); //$NON-NLS-1$ } ret.setToolTipText(tipText.toString()); @@ -319,7 +320,7 @@ private String formatTacticColumn(TeamLineup lineup) { } if (lineup.getMatchDetail() != null && lineup.getMatchDetail().isManMarking()) { if (tactic != -1) str.append("/"); - str.append(HOVerwaltung.instance().getLanguageString("ls.teamanalyzer.manmarking")); + str.append(TranslationFacility.tr("ls.teamanalyzer.manmarking")); } if (str.isEmpty()) { diff --git a/src/main/java/module/teamAnalyzer/ui/RosterPanel.java b/src/main/java/module/teamAnalyzer/ui/RosterPanel.java index 440349bd7..8875d1091 100644 --- a/src/main/java/module/teamAnalyzer/ui/RosterPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/RosterPanel.java @@ -1,24 +1,14 @@ package module.teamAnalyzer.ui; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.ui.model.UiRosterTableModel; import module.teamAnalyzer.vo.PlayerInfo; import module.teamAnalyzer.vo.RosterPlayerData; -import java.awt.BorderLayout; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; +import javax.swing.*; +import java.awt.*; import java.util.List; -import java.util.Map; -import java.util.Vector; - -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import javax.swing.ScrollPaneConstants; +import java.util.*; public class RosterPanel extends JPanel { //~ Instance fields ---------------------------------------------------------------------------- @@ -28,19 +18,19 @@ public class RosterPanel extends JPanel { private Map players = new HashMap<>(); private UiRosterTableModel tableModel; private String[] columns = { - HOVerwaltung.instance().getLanguageString("ls.player.name"), - HOVerwaltung.instance().getLanguageString("Role"), - HOVerwaltung.instance().getLanguageString("Position"), - HOVerwaltung.instance().getLanguageString("Secondary"), - HOVerwaltung.instance().getLanguageString("ls.match.id"), - HOVerwaltung.instance().getLanguageString("ls.player.age"), - HOVerwaltung.instance().getLanguageString("ls.player.form"), - HOVerwaltung.instance().getLanguageString("ls.player.short_experience"), - HOVerwaltung.instance().getLanguageString("ls.player.tsi"), - HOVerwaltung.instance().getLanguageString("SpecialEvent"), - HOVerwaltung.instance().getLanguageString("Maximal"), - HOVerwaltung.instance().getLanguageString("Durchschnitt"), - HOVerwaltung.instance().getLanguageString("Minimal"), + TranslationFacility.tr("ls.player.name"), + TranslationFacility.tr("Role"), + TranslationFacility.tr("Position"), + TranslationFacility.tr("Secondary"), + TranslationFacility.tr("ls.match.id"), + TranslationFacility.tr("ls.player.age"), + TranslationFacility.tr("ls.player.form"), + TranslationFacility.tr("ls.player.short_experience"), + TranslationFacility.tr("ls.player.tsi"), + TranslationFacility.tr("SpecialEvent"), + TranslationFacility.tr("Maximal"), + TranslationFacility.tr("Durchschnitt"), + TranslationFacility.tr("Minimal"), "Status", "PlayerId" }; @@ -74,7 +64,7 @@ private void jbInit() { table = new JTable(tableModel); // Set up tool tips for column headers. - table.getTableHeader().setToolTipText(HOVerwaltung.instance().getLanguageString("RecapPanel.Tooltip")); //$NON-NLS-1$ + table.getTableHeader().setToolTipText(TranslationFacility.tr("RecapPanel.Tooltip")); //$NON-NLS-1$ table.getTableHeader().setReorderingAllowed(false); table.setDefaultRenderer(Object.class, new RosterTableRenderer()); diff --git a/src/main/java/module/teamAnalyzer/ui/SpecialEventsPanel.java b/src/main/java/module/teamAnalyzer/ui/SpecialEventsPanel.java index a2486e7dc..d17e40fb9 100644 --- a/src/main/java/module/teamAnalyzer/ui/SpecialEventsPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/SpecialEventsPanel.java @@ -1,7 +1,7 @@ package module.teamAnalyzer.ui; import core.gui.model.BaseTableModel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import core.model.player.Player; import core.specialevents.SpecialEventsPrediction; @@ -18,16 +18,15 @@ public class SpecialEventsPanel extends JPanel { private final JTable table; private BaseTableModel tableModel; private final JLabel resultLabel; - private static final HOVerwaltung hov = HOVerwaltung.instance(); private final String[] columns = { - hov.getLanguageString("Event"), - hov.getLanguageString("Spieler"), - hov.getLanguageString("ls.teamanalyzer.opponent_player"), - hov.getLanguageString("ls.teamanalyzer.involved_player"), - hov.getLanguageString("ls.teamanalyzer.probability"), - hov.getLanguageString("ls.teamanalyzer.scores"), - hov.getLanguageString("ls.teamanalyzer.opponent_scores") + TranslationFacility.tr("Event"), + TranslationFacility.tr("Spieler"), + TranslationFacility.tr("ls.teamanalyzer.opponent_player"), + TranslationFacility.tr("ls.teamanalyzer.involved_player"), + TranslationFacility.tr("ls.teamanalyzer.probability"), + TranslationFacility.tr("ls.teamanalyzer.scores"), + TranslationFacility.tr("ls.teamanalyzer.opponent_scores") }; public SpecialEventsPanel(){ @@ -36,14 +35,14 @@ public SpecialEventsPanel(){ tableModel = new BaseTableModel(data, new Vector<>(Arrays.asList(columns))); table = new JTable(tableModel); setLayout(new BorderLayout()); - setBorder(BorderFactory.createTitledBorder(hov.getLanguageString("ls.teamanalyzer.special_events"))); + setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr("ls.teamanalyzer.special_events"))); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); add(scrollPane); - resultLabel = new JLabel( hov.getLanguageString("ls.teamanalyzer.result") + ": 0.00 - 0.00"); + resultLabel = new JLabel( TranslationFacility.tr("ls.teamanalyzer.result") + ": 0.00 - 0.00"); add(resultLabel, BorderLayout.PAGE_END); } @@ -124,7 +123,7 @@ public void reload(TeamLineup teamLineup) { double scores = specialEventsPredictionManager.getResultScores(); double opponentScores = specialEventsPredictionManager.getOpponentResultScores(); - this.resultLabel.setText(String.format(hov.getLanguageString("ls.teamanalyzer.result") + ": %.2f : %.2f", scores, opponentScores)); + this.resultLabel.setText(String.format(TranslationFacility.tr("ls.teamanalyzer.result") + ": %.2f : %.2f", scores, opponentScores)); } private Vector getRow(String kind, Player player, Player opponentPlayer, ArrayList involved, diff --git a/src/main/java/module/teamAnalyzer/ui/TeamAnalyzerPanel.java b/src/main/java/module/teamAnalyzer/ui/TeamAnalyzerPanel.java index 31f3d9859..cce2f2e65 100644 --- a/src/main/java/module/teamAnalyzer/ui/TeamAnalyzerPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/TeamAnalyzerPanel.java @@ -1,7 +1,7 @@ package module.teamAnalyzer.ui; import core.gui.comp.panel.LazyPanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import module.teamAnalyzer.SystemManager; import module.teamAnalyzer.report.TeamReport; @@ -9,10 +9,8 @@ import module.teamAnalyzer.vo.Filter; import module.training.ui.comp.DividerListener; -import java.awt.BorderLayout; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JSplitPane; +import javax.swing.*; +import java.awt.*; /** * Base panel of the module. @@ -67,7 +65,7 @@ private void initComponents() { setLayout(new BorderLayout()); - simButton = new JButton(HOVerwaltung.instance().getLanguageString("Simulate")); + simButton = new JButton(TranslationFacility.tr("Simulate")); JSplitPane splitPane = createTopSplitPane(); diff --git a/src/main/java/module/teamAnalyzer/ui/TeamInfoPanel.kt b/src/main/java/module/teamAnalyzer/ui/TeamInfoPanel.kt index 66c1cb9d5..27bc91bce 100644 --- a/src/main/java/module/teamAnalyzer/ui/TeamInfoPanel.kt +++ b/src/main/java/module/teamAnalyzer/ui/TeamInfoPanel.kt @@ -1,6 +1,6 @@ package module.teamAnalyzer.ui -import core.model.HOVerwaltung +import core.model.TranslationFacility import core.util.HODateTime import java.awt.Font import java.awt.GridBagConstraints @@ -22,14 +22,13 @@ class TeamInfoPanel : JPanel() { fun setTeam(details: Map) { removeAll() - val hoVerwaltung = HOVerwaltung.instance() val isBot = isBot(details) // Column 1 // val infoLabel = JLabel() // infoLabel.icon = ImageIcon(details["LogoURL"]) -// infoLabel.text = hoVerwaltung.getLanguageString("ls.teamanalyzer.info") - border = BorderFactory.createTitledBorder(hoVerwaltung.getLanguageString("ls.teamanalyzer.info")) +// infoLabel.text = TranslationFacility.tr("ls.teamanalyzer.info") + border = BorderFactory.createTitledBorder(TranslationFacility.tr("ls.teamanalyzer.info")) val gbc = GridBagConstraints() layout = GridBagLayout() @@ -38,25 +37,25 @@ class TeamInfoPanel : JPanel() { gbc.anchor = GridBagConstraints.WEST gbc.gridx = 0 gbc.gridy = 0 - val managerLabel = JLabel(hoVerwaltung.getLanguageString("ls.teamanalyzer.manager")) + val managerLabel = JLabel(TranslationFacility.tr("ls.teamanalyzer.manager")) val boldFont = managerLabel.font.deriveFont(Font.BOLD) managerLabel.font = boldFont add(managerLabel, gbc) gbc.gridy++ - val lastLoginLabel = JLabel(hoVerwaltung.getLanguageString("ls.teamanalyzer.last_login")) + val lastLoginLabel = JLabel(TranslationFacility.tr("ls.teamanalyzer.last_login")) lastLoginLabel.font = boldFont add(lastLoginLabel, gbc) if (isBot) { gbc.gridy++ - val botStatusLabel = JLabel(hoVerwaltung.getLanguageString("ls.teamanalyzer.bot")) + val botStatusLabel = JLabel(TranslationFacility.tr("ls.teamanalyzer.bot")) botStatusLabel.font = boldFont add(botStatusLabel, gbc) } if (details.containsKey("LeaguePosition")) { gbc.gridy++ - val leaguePositionLabel = JLabel(hoVerwaltung.getLanguageString("ls.teamanalyzer.league_position")) + val leaguePositionLabel = JLabel(TranslationFacility.tr("ls.teamanalyzer.league_position")) leaguePositionLabel.font = boldFont add(leaguePositionLabel, gbc) } @@ -66,25 +65,25 @@ class TeamInfoPanel : JPanel() { gbc.gridy = 0 gbc.anchor = GridBagConstraints.EAST val loginValueLabel = JLabel() - loginValueLabel.text = if (details["Loginname"].isNullOrBlank()) hoVerwaltung.getLanguageString("ls.teamanalyzer.na") else details["Loginname"] + loginValueLabel.text = if (details["Loginname"].isNullOrBlank()) TranslationFacility.tr("ls.teamanalyzer.na") else details["Loginname"] add(loginValueLabel, gbc) gbc.gridy++ val lastLoginDateLabel = JLabel() val lastLoginDate = HODateTime.fromHT(details["LastLoginDate"]) - lastLoginDateLabel.text = if (details["Loginname"].isNullOrBlank()) hoVerwaltung.getLanguageString("ls.teamanalyzer.na") else lastLoginDate.toLocaleDateTime() + lastLoginDateLabel.text = if (details["Loginname"].isNullOrBlank()) TranslationFacility.tr("ls.teamanalyzer.na") else lastLoginDate.toLocaleDateTime() add(lastLoginDateLabel, gbc) if (isBot) { gbc.gridy++ val botStatusValueLabel = JLabel() val boStatusDate = details["BotSince"] - botStatusValueLabel.text = hoVerwaltung.getLanguageString("ls.teamanalyzer.bot_since", HODateTime.fromHT(boStatusDate).toLocaleDate()) + botStatusValueLabel.text = TranslationFacility.tr("ls.teamanalyzer.bot_since", HODateTime.fromHT(boStatusDate).toLocaleDate()) add(botStatusValueLabel, gbc) } if (details.containsKey("LeaguePosition")) { gbc.gridy++ - val leaguePosText = hoVerwaltung.getLanguageString("ls.teamanalyzer.league_position_val", + val leaguePosText = TranslationFacility.tr("ls.teamanalyzer.league_position_val", details["LeaguePosition"], details["LeagueLevelUnitName"], details["CountryName"]) val leaguePositionValue = JLabel(leaguePosText) add(leaguePositionValue, gbc) diff --git a/src/main/java/module/teamAnalyzer/ui/TeamPanel.java b/src/main/java/module/teamAnalyzer/ui/TeamPanel.java index 90a5cc233..e8bc588b0 100644 --- a/src/main/java/module/teamAnalyzer/ui/TeamPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/TeamPanel.java @@ -2,6 +2,7 @@ import core.gui.comp.panel.RasenPanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import core.model.player.Player; import core.rating.RatingPredictionModel; @@ -11,13 +12,13 @@ import module.teamAnalyzer.ui.lineup.FormationPanel; import module.teamAnalyzer.vo.TeamLineup; import module.teamAnalyzer.vo.UserTeamSpotLineup; + +import javax.swing.*; import java.awt.*; import java.awt.geom.AffineTransform; import java.util.ArrayList; import java.util.HashMap; -import javax.swing.*; - public class TeamPanel extends JPanel { //~ Instance fields ---------------------------------------------------------------------------- private final FormationPanel lineupPanel = new FormationPanel(); @@ -142,7 +143,7 @@ public void reload(TeamLineup teamLineup, int week, int season) { } } else { - lineupPanel.getOpponentTeam().setTeamName(HOVerwaltung.instance().getLanguageString("TeamPanel.TeamMessage")); //$NON-NLS-1$ + lineupPanel.getOpponentTeam().setTeamName(TranslationFacility.tr("TeamPanel.TeamMessage")); //$NON-NLS-1$ keeper.reload(null, 0, 0); leftBack.reload(null, 0, 0); diff --git a/src/main/java/module/teamAnalyzer/ui/component/AddPanel.java b/src/main/java/module/teamAnalyzer/ui/component/AddPanel.java index a9f90b029..5b03ab2c2 100644 --- a/src/main/java/module/teamAnalyzer/ui/component/AddPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/component/AddPanel.java @@ -2,22 +2,18 @@ package module.teamAnalyzer.ui.component; import core.db.DBManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.ht.HattrickManager; import module.teamAnalyzer.manager.TeamManager; import module.teamAnalyzer.ui.NumberTextField; import module.teamAnalyzer.ui.controller.FavoriteItemListener; import module.teamAnalyzer.vo.Team; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; - /** @@ -37,10 +33,10 @@ public class AddPanel extends JPanel { FavouriteMenu menu; /** The add button */ - JButton addButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.add")); + JButton addButton = new JButton(TranslationFacility.tr("ls.button.add")); /** The ID-Label */ - JLabel idlabel = new JLabel(HOVerwaltung.instance().getLanguageString("ls.team.id") + ": "); + JLabel idlabel = new JLabel(TranslationFacility.tr("ls.team.id") + ": "); /** A status label */ JLabel status = new JLabel(); @@ -87,14 +83,14 @@ public void actionPerformed(ActionEvent e) { team.setTeamId(teamId.getValue()); if (TeamManager.isTeamInList(teamId.getValue())) { - status.setText(HOVerwaltung.instance().getLanguageString("Favourite.InList")); + status.setText(TranslationFacility.tr("Favourite.InList")); teamId.setText(""); return; } if (DBManager.instance().isTAFavourite(teamId.getValue())) { - status.setText(HOVerwaltung.instance().getLanguageString("Favourite.Already")); + status.setText(TranslationFacility.tr("Favourite.Already")); teamId.setText(""); return; @@ -105,14 +101,14 @@ public void actionPerformed(ActionEvent e) { team.setName(teamName); } catch (Exception e1) { - status.setText(HOVerwaltung.instance().getLanguageString("Favourite.Error")); + status.setText(TranslationFacility.tr("Favourite.Error")); teamId.setText(""); return; } status.setText(team.getName() + " " - + HOVerwaltung.instance().getLanguageString("hinzugefuegt")); + + TranslationFacility.tr("hinzugefuegt")); menu.teams.add(team); JMenuItem item = new JMenuItem(team.getName()); diff --git a/src/main/java/module/teamAnalyzer/ui/component/DeletePanel.java b/src/main/java/module/teamAnalyzer/ui/component/DeletePanel.java index b1e3b1b62..002f83a34 100644 --- a/src/main/java/module/teamAnalyzer/ui/component/DeletePanel.java +++ b/src/main/java/module/teamAnalyzer/ui/component/DeletePanel.java @@ -2,19 +2,13 @@ package module.teamAnalyzer.ui.component; import core.db.DBManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.vo.Team; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Iterator; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; @@ -35,10 +29,10 @@ public class DeletePanel extends JPanel { FavouriteMenu menu; /** The add button */ - JButton addButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.add")); + JButton addButton = new JButton(TranslationFacility.tr("ls.button.add")); /** The delete button */ - JButton deletebutton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + JButton deletebutton = new JButton(TranslationFacility.tr("ls.button.delete")); /** ComboBox with the list of favourite teams */ JComboBox teams = new JComboBox(); @@ -95,7 +89,7 @@ public void actionPerformed(ActionEvent e) { Team team = (Team) teams.getSelectedItem(); if (team == null) { - status.setText(HOVerwaltung.instance().getLanguageString("Favourite.SelectTeam")); + status.setText(TranslationFacility.tr("Favourite.SelectTeam")); return; } diff --git a/src/main/java/module/teamAnalyzer/ui/component/DownloadPanel.java b/src/main/java/module/teamAnalyzer/ui/component/DownloadPanel.java index 590843eb3..c37830383 100644 --- a/src/main/java/module/teamAnalyzer/ui/component/DownloadPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/component/DownloadPanel.java @@ -2,23 +2,17 @@ package module.teamAnalyzer.ui.component; import core.db.DBManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.enums.MatchType; import core.model.match.Matchdetails; import core.net.OnlineWorker; import module.teamAnalyzer.ui.NumberTextField; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; - /** * A panel that allows the user to download a new match from HO @@ -33,12 +27,12 @@ public class DownloadPanel extends JPanel { */ private static final long serialVersionUID = -3212179990708350342L; - String[] matchTypes = {HOVerwaltung.instance().getLanguageString("NormalMatch"), - HOVerwaltung.instance().getLanguageString("TournamentMatch")}; + String[] matchTypes = {TranslationFacility.tr("NormalMatch"), + TranslationFacility.tr("TournamentMatch")}; /** Download Button */ - JButton downloadButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.download")); + JButton downloadButton = new JButton(TranslationFacility.tr("ls.button.download")); /** Description label */ JLabel jLabel1 = new JLabel(); @@ -49,8 +43,8 @@ public class DownloadPanel extends JPanel { /** The matchid text field */ NumberTextField matchId = new NumberTextField(10); - JRadioButton normal = new JRadioButton(HOVerwaltung.instance().getLanguageString("NormalMatch")); - JRadioButton tournament = new JRadioButton(HOVerwaltung.instance().getLanguageString("TournamentMatch")); + JRadioButton normal = new JRadioButton(TranslationFacility.tr("NormalMatch")); + JRadioButton tournament = new JRadioButton(TranslationFacility.tr("TournamentMatch")); ButtonGroup radioGroup = new ButtonGroup(); //~ Constructors ------------------------------------------------------------------------------- @@ -68,7 +62,7 @@ public DownloadPanel() { * Initializes the state of this instance. */ private void jbInit() { - jLabel1.setText(HOVerwaltung.instance().getLanguageString("ls.match.id")); + jLabel1.setText(TranslationFacility.tr("ls.match.id")); setLayout(new GridBagLayout()); final GridBagConstraints constraints = new GridBagConstraints(); @@ -109,7 +103,7 @@ public void actionPerformed(ActionEvent e) { } // if (id == 0) { -// status.setText(HOVerwaltung.instance().getLanguageString("ImportError")); +// status.setText(TranslationFacility.tr("ImportError")); // // return; // } @@ -119,10 +113,10 @@ public void actionPerformed(ActionEvent e) { Matchdetails md = DBManager.instance().loadMatchDetails(type.getId(), id); if (md.getFetchDatum() != null) { - status.setText(HOVerwaltung.instance().getLanguageString("ImportOK")); + status.setText(TranslationFacility.tr("ImportOK")); matchId.setText(""); } else { - status.setText(HOVerwaltung.instance().getLanguageString("ImportError")); + status.setText(TranslationFacility.tr("ImportError")); } } } diff --git a/src/main/java/module/teamAnalyzer/ui/component/FavouriteMenu.java b/src/main/java/module/teamAnalyzer/ui/component/FavouriteMenu.java index c6bac195b..0f636aa81 100644 --- a/src/main/java/module/teamAnalyzer/ui/component/FavouriteMenu.java +++ b/src/main/java/module/teamAnalyzer/ui/component/FavouriteMenu.java @@ -2,22 +2,15 @@ package module.teamAnalyzer.ui.component; import core.db.DBManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.SystemManager; import module.teamAnalyzer.ui.controller.FavoriteItemListener; import module.teamAnalyzer.vo.Team; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import javax.swing.*; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JSeparator; - /** @@ -34,10 +27,10 @@ public class FavouriteMenu extends JMenu { private static final long serialVersionUID = -3404254214435543226L; /** Add menu item */ - public JMenuItem itemAdd = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.button.add")); + public JMenuItem itemAdd = new JMenuItem(TranslationFacility.tr("ls.button.add")); /** Delete menu item */ - public JMenuItem itemDelete = new JMenuItem(HOVerwaltung.instance().getLanguageString("ls.button.delete")); + public JMenuItem itemDelete = new JMenuItem(TranslationFacility.tr("ls.button.delete")); /** List of favourite team menu items */ public List items; @@ -54,7 +47,7 @@ public class FavouriteMenu extends JMenu { * Creates a new FavouriteMenu object. */ public FavouriteMenu() { - super(HOVerwaltung.instance().getLanguageString("Favourite")); + super(TranslationFacility.tr("Favourite")); jbInit(); me = this; } @@ -87,18 +80,18 @@ private void jbInit() { itemDelete.addActionListener(arg0 -> { JOptionPane.showMessageDialog(SystemManager.getPlugin(), new DeletePanel(me), - HOVerwaltung.instance().getLanguageString("ls.button.delete") + TranslationFacility.tr("ls.button.delete") + " " - + HOVerwaltung.instance().getLanguageString("Verein"), + + TranslationFacility.tr("Verein"), JOptionPane.PLAIN_MESSAGE); }); itemAdd.addActionListener(arg0 -> { JOptionPane.showMessageDialog(SystemManager.getPlugin(), new AddPanel(me), - HOVerwaltung.instance().getLanguageString("ls.button.add") + TranslationFacility.tr("ls.button.add") + " " - + HOVerwaltung.instance().getLanguageString("Verein"), + + TranslationFacility.tr("Verein"), JOptionPane.PLAIN_MESSAGE); }); } diff --git a/src/main/java/module/teamAnalyzer/ui/component/SettingPanel.java b/src/main/java/module/teamAnalyzer/ui/component/SettingPanel.java index f305680cb..82128b603 100644 --- a/src/main/java/module/teamAnalyzer/ui/component/SettingPanel.java +++ b/src/main/java/module/teamAnalyzer/ui/component/SettingPanel.java @@ -2,15 +2,11 @@ package module.teamAnalyzer.ui.component; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.SystemManager; -import java.awt.BorderLayout; -import java.awt.GridLayout; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; + +import javax.swing.*; +import java.awt.*; @@ -144,15 +140,15 @@ private void jbInit() { mainPanel.setLayout(new GridLayout(12, 1)); mainPanel.setOpaque(false); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.MyLineup"), myLineup)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.TacticDetail"), tacticDetail)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.MixedLineup"), mixedLineup)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.NumericRatings"), numberRating)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.DescriptionRatings"), descRating)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.ShowUnavailable"), unavailable)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.Playerinformations"), playerInfo)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.CheckName"), checkName)); - mainPanel.add(createPanel(HOVerwaltung.instance().getLanguageString("SettingPanel.SpecialEventVisible"), specialEventsVisible)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.MyLineup"), myLineup)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.TacticDetail"), tacticDetail)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.MixedLineup"), mixedLineup)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.NumericRatings"), numberRating)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.DescriptionRatings"), descRating)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.ShowUnavailable"), unavailable)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.Playerinformations"), playerInfo)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.CheckName"), checkName)); + mainPanel.add(createPanel(TranslationFacility.tr("SettingPanel.SpecialEventVisible"), specialEventsVisible)); setLayout(new BorderLayout()); setOpaque(false); diff --git a/src/main/java/module/teamAnalyzer/ui/component/TAMenu.java b/src/main/java/module/teamAnalyzer/ui/component/TAMenu.java index c5d2a4d65..dafd270ca 100644 --- a/src/main/java/module/teamAnalyzer/ui/component/TAMenu.java +++ b/src/main/java/module/teamAnalyzer/ui/component/TAMenu.java @@ -1,6 +1,6 @@ package module.teamAnalyzer.ui.component; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.teamAnalyzer.SystemManager; import module.teamAnalyzer.vo.Team; @@ -10,7 +10,7 @@ public class TAMenu extends JMenu { public TAMenu() { - super(HOVerwaltung.instance().getLanguageString("TeamAnalyzer")); + super(TranslationFacility.tr("TeamAnalyzer")); initialize(); } @@ -20,12 +20,12 @@ private void initialize() { } private JMenuItem getDownloadItem() { - JMenuItem downloadItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("Menu.DownloadMatch")); + JMenuItem downloadItem = new JMenuItem(TranslationFacility.tr("Menu.DownloadMatch")); downloadItem.addActionListener(e -> { JOptionPane.showMessageDialog( SystemManager.getPlugin(), new DownloadPanel(), - HOVerwaltung.instance().getLanguageString("Menu.DownloadMatch"), + TranslationFacility.tr("Menu.DownloadMatch"), JOptionPane.PLAIN_MESSAGE ); diff --git a/src/main/java/module/teamAnalyzer/ui/controller/SimButtonListener.java b/src/main/java/module/teamAnalyzer/ui/controller/SimButtonListener.java index 6f8eda9fe..dabe270a2 100644 --- a/src/main/java/module/teamAnalyzer/ui/controller/SimButtonListener.java +++ b/src/main/java/module/teamAnalyzer/ui/controller/SimButtonListener.java @@ -2,6 +2,7 @@ import core.constants.player.PlayerAbility; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.IMatchDetails; import core.model.match.Matchdetails; import core.prediction.MatchEnginePanel; @@ -13,13 +14,10 @@ import module.teamAnalyzer.ui.RecapPanel; import module.teamAnalyzer.ui.TeamLineupData; +import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - /** @@ -63,9 +61,9 @@ public void actionPerformed(ActionEvent e) { if ((myTeam.getMidfield() < 1) || (opponentTeam.getMidfield() < 1)) { JPanel pan = new JPanel(); - pan.add(new JLabel(HOVerwaltung.instance().getLanguageString("Error.SetFormation"))); + pan.add(new JLabel(TranslationFacility.tr("Error.SetFormation"))); JOptionPane.showMessageDialog(SystemManager.getPlugin(), pan, - HOVerwaltung.instance().getLanguageString("Error"), + TranslationFacility.tr("Error"), JOptionPane.PLAIN_MESSAGE); return; diff --git a/src/main/java/module/teamAnalyzer/ui/renderer/RatingTableCellRenderer.java b/src/main/java/module/teamAnalyzer/ui/renderer/RatingTableCellRenderer.java index 18031452b..2636e0895 100644 --- a/src/main/java/module/teamAnalyzer/ui/renderer/RatingTableCellRenderer.java +++ b/src/main/java/module/teamAnalyzer/ui/renderer/RatingTableCellRenderer.java @@ -1,14 +1,10 @@ package module.teamAnalyzer.ui.renderer; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.Color; -import java.awt.Component; - -import javax.swing.ImageIcon; -import javax.swing.JTable; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; +import java.awt.*; /** @@ -35,7 +31,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, String curText = value.toString(); this.setIcon(null); this.setHorizontalAlignment(SwingConstants.TRAILING); - this.setToolTipText(HOVerwaltung.instance().getLanguageString("RatingPanel.Relative.Tooltip")); + this.setToolTipText(TranslationFacility.tr("RatingPanel.Relative.Tooltip")); if (curText != null) { if (curText.startsWith("+")) { this.setForeground(Color.GREEN.darker().darker()); diff --git a/src/main/java/module/teamAnalyzer/vo/MatchRating.java b/src/main/java/module/teamAnalyzer/vo/MatchRating.java index 5e23e3635..09dc3578a 100644 --- a/src/main/java/module/teamAnalyzer/vo/MatchRating.java +++ b/src/main/java/module/teamAnalyzer/vo/MatchRating.java @@ -1,6 +1,7 @@ package module.teamAnalyzer.vo; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.Translator; import core.model.match.IMatchDetails; @@ -49,19 +50,19 @@ public static int AttitudeStringToInt(String attitude) { HOVerwaltung hoi = HOVerwaltung.instance(); String english_attitudeType = englishBundle.getString("ls.team.teamattitude.normal").toLowerCase(); - String local_attitudeType = hoi.getLanguageString("ls.team.teamattitude.normal").toLowerCase(); + String local_attitudeType = TranslationFacility.tr("ls.team.teamattitude.normal").toLowerCase(); if ((attitude.equals(english_attitudeType)) || (attitude.equals(local_attitudeType))) { return 0; } english_attitudeType = englishBundle.getString("ls.team.teamattitude.playitcool").toLowerCase(); - local_attitudeType = hoi.getLanguageString("ls.team.teamattitude.playitcool").toLowerCase(); + local_attitudeType = TranslationFacility.tr("ls.team.teamattitude.playitcool").toLowerCase(); if ((attitude.equals(english_attitudeType)) || (attitude.equals(local_attitudeType))) { return -1; } english_attitudeType = englishBundle.getString("ls.team.teamattitude.matchoftheseason").toLowerCase(); - local_attitudeType = hoi.getLanguageString("ls.team.teamattitude.matchoftheseason").toLowerCase(); + local_attitudeType = TranslationFacility.tr("ls.team.teamattitude.matchoftheseason").toLowerCase(); if ((attitude.equals(english_attitudeType)) || (attitude.equals(local_attitudeType))) { return 1; } @@ -85,31 +86,31 @@ public static int TacticTypeStringToInt(String tacticType) { HOVerwaltung hoi = HOVerwaltung.instance(); String english_tactictype = englishBundle.getString("ls.team.tactic.normal").toLowerCase(); - String local_tactictype = hoi.getLanguageString("ls.team.tactic.normal").toLowerCase(); + String local_tactictype = TranslationFacility.tr("ls.team.tactic.normal").toLowerCase(); if ((tacticType.equals(english_tactictype)) || (tacticType.equals(local_tactictype))) {return 0;} english_tactictype = englishBundle.getString("ls.team.tactic.pressing").toLowerCase(); - local_tactictype = hoi.getLanguageString("ls.team.tactic.pressing").toLowerCase(); + local_tactictype = TranslationFacility.tr("ls.team.tactic.pressing").toLowerCase(); if ((tacticType.equals(english_tactictype)) || (tacticType.equals(local_tactictype))) {return 1;} english_tactictype = englishBundle.getString("ls.team.tactic.counter-attacks").toLowerCase(); - local_tactictype = hoi.getLanguageString("ls.team.tactic.counter-attacks").toLowerCase(); + local_tactictype = TranslationFacility.tr("ls.team.tactic.counter-attacks").toLowerCase(); if ((tacticType.equals(english_tactictype)) || (tacticType.equals(local_tactictype))) {return 2;} english_tactictype = englishBundle.getString("ls.team.tactic.attackinthemiddle").toLowerCase(); - local_tactictype = hoi.getLanguageString("ls.team.tactic.attackinthemiddle").toLowerCase(); + local_tactictype = TranslationFacility.tr("ls.team.tactic.attackinthemiddle").toLowerCase(); if ((tacticType.equals(english_tactictype)) || (tacticType.equals(local_tactictype))) {return 3;} english_tactictype = englishBundle.getString("ls.team.tactic.attackonwings").toLowerCase(); - local_tactictype = hoi.getLanguageString("ls.team.tactic.attackonwings").toLowerCase(); + local_tactictype = TranslationFacility.tr("ls.team.tactic.attackonwings").toLowerCase(); if ((tacticType.equals(english_tactictype)) || (tacticType.equals(local_tactictype))) {return 4;} english_tactictype = englishBundle.getString("ls.team.tactic.playcreatively").toLowerCase(); - local_tactictype = hoi.getLanguageString("ls.team.tactic.playcreatively").toLowerCase(); + local_tactictype = TranslationFacility.tr("ls.team.tactic.playcreatively").toLowerCase(); if ((tacticType.equals(english_tactictype)) || (tacticType.equals(local_tactictype))) {return 7;} english_tactictype = englishBundle.getString("ls.team.tactic.longshots").toLowerCase(); - local_tactictype = hoi.getLanguageString("ls.team.tactic.longshots").toLowerCase(); + local_tactictype = TranslationFacility.tr("ls.team.tactic.longshots").toLowerCase(); if ((tacticType.equals(english_tactictype)) || (tacticType.equals(local_tactictype))) {return 8;} else return ERROR; diff --git a/src/main/java/module/teamOfTheWeek/TeamOfTheWeekModule.java b/src/main/java/module/teamOfTheWeek/TeamOfTheWeekModule.java index 27b96d0f3..82799cb76 100644 --- a/src/main/java/module/teamOfTheWeek/TeamOfTheWeekModule.java +++ b/src/main/java/module/teamOfTheWeek/TeamOfTheWeekModule.java @@ -1,15 +1,12 @@ package module.teamOfTheWeek; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; -import javax.swing.KeyStroke; - - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; import module.teamOfTheWeek.gui.TeamOfTheWeekPanel; +import javax.swing.*; +import java.awt.event.KeyEvent; + public class TeamOfTheWeekModule extends DefaultModule { @Override @@ -24,7 +21,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Tab_TeamOfTheWeek"); + return TranslationFacility.tr("Tab_TeamOfTheWeek"); } @Override diff --git a/src/main/java/module/teamOfTheWeek/gui/TeamOfTheWeekPanel.java b/src/main/java/module/teamOfTheWeek/gui/TeamOfTheWeekPanel.java index e2d33234b..ebab14b03 100644 --- a/src/main/java/module/teamOfTheWeek/gui/TeamOfTheWeekPanel.java +++ b/src/main/java/module/teamOfTheWeek/gui/TeamOfTheWeekPanel.java @@ -6,20 +6,21 @@ import core.gui.comp.panel.LazyPanel; import core.gui.comp.panel.RasenPanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.match.MatchLineupPosition; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; import core.model.series.Paarung; import module.series.Spielplan; +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serial; import java.util.List; -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; public class TeamOfTheWeekPanel extends LazyPanel implements ChangeListener, ActionListener { @@ -181,7 +182,7 @@ private void initComponents() { weekSpinner.setPreferredSize(new Dimension(60, 22)); weekSpinner.setFocusable(false); - JLabel jl = new JLabel(HOVerwaltung.instance().getLanguageString("Spieltag")); + JLabel jl = new JLabel(TranslationFacility.tr("Spieltag")); JPanel north = new ImagePanel(); jl.setForeground(Color.BLACK); jl.setLabelFor(weekSpinner); @@ -194,16 +195,16 @@ private void initComponents() { JTabbedPane tab = new JTabbedPane(); bestOfWeek = new LineupPanel(); - tab.addTab(HOVerwaltung.instance().getLanguageString("bestOfWeek"), + tab.addTab(TranslationFacility.tr("bestOfWeek"), createTabPanel(bestOfWeek)); worstOfWeek = new LineupPanel(); - tab.addTab(HOVerwaltung.instance().getLanguageString("worstOfWeek"), + tab.addTab(TranslationFacility.tr("worstOfWeek"), createTabPanel(worstOfWeek)); bestOfYear = new LineupPanel(); - tab.addTab(HOVerwaltung.instance().getLanguageString("bestOfSeason"), + tab.addTab(TranslationFacility.tr("bestOfSeason"), createTabPanel(bestOfYear)); worstOfYear = new LineupPanel(); - tab.addTab(HOVerwaltung.instance().getLanguageString("worstOfSeason"), + tab.addTab(TranslationFacility.tr("worstOfSeason"), createTabPanel(worstOfYear)); m_jpPanel.add(tab, BorderLayout.CENTER); setLayout(new BorderLayout()); diff --git a/src/main/java/module/training/TrainingModule.java b/src/main/java/module/training/TrainingModule.java index 4aa2a2c61..ae4fae9ef 100644 --- a/src/main/java/module/training/TrainingModule.java +++ b/src/main/java/module/training/TrainingModule.java @@ -1,14 +1,11 @@ package module.training; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; -import javax.swing.KeyStroke; - - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; +import javax.swing.*; +import java.awt.event.KeyEvent; + public final class TrainingModule extends DefaultModule { public TrainingModule(){ @@ -22,7 +19,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Training"); + return TranslationFacility.tr("Training"); } @Override diff --git a/src/main/java/module/training/ui/AnalyzerPanel.java b/src/main/java/module/training/ui/AnalyzerPanel.java index b6d9b236f..7e81bac67 100644 --- a/src/main/java/module/training/ui/AnalyzerPanel.java +++ b/src/main/java/module/training/ui/AnalyzerPanel.java @@ -6,6 +6,7 @@ import core.gui.comp.panel.LazyPanel; import core.gui.theme.ImageUtilities; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import core.model.player.SkillChange; import core.util.GUIUtils; @@ -267,8 +268,7 @@ private void initComponents() { JPanel skillPanel = new ImagePanel(); skillPanel.setLayout(new BorderLayout()); - skillPanel.setBorder(BorderFactory.createTitledBorder(HOVerwaltung.instance() - .getLanguageString("TAB_SKILL"))); + skillPanel.setBorder(BorderFactory.createTitledBorder(TranslationFacility.tr("TAB_SKILL"))); // Add selection listener. this.changesTable = new JTable(); @@ -276,7 +276,7 @@ private void initComponents() { this.oldPlayersCheckBox = new JCheckBox(); this.oldPlayersCheckBox.setOpaque(false); - this.oldPlayersCheckBox.setText(HOVerwaltung.instance().getLanguageString("IncludeOld")); + this.oldPlayersCheckBox.setText(TranslationFacility.tr("IncludeOld")); this.oldPlayersCheckBox.setFocusable(false); this.oldPlayersCheckBox.setSelected(false); this.oldPlayersCheckBox.addActionListener(this); @@ -294,7 +294,7 @@ private void initComponents() { filterPanel.setLayout(new GridBagLayout()); JButton btnShowAll = new JButton(); - btnShowAll.setText(HOVerwaltung.instance().getLanguageString("ShowAll")); + btnShowAll.setText(TranslationFacility.tr("ShowAll")); btnShowAll.setFocusable(false); btnShowAll.addActionListener(this); btnShowAll.setActionCommand(CMD_SELECT_ALL); @@ -303,7 +303,7 @@ private void initComponents() { sidePanel.add(btnShowAll, gbc); JButton btnClearAll = new JButton(); - btnClearAll.setText(HOVerwaltung.instance().getLanguageString("ClearAll")); + btnClearAll.setText(TranslationFacility.tr("ClearAll")); btnClearAll.setFocusable(false); btnClearAll.addActionListener(this); btnClearAll.setActionCommand(CMD_CLEAR_ALL); diff --git a/src/main/java/module/training/ui/EffectPanel.java b/src/main/java/module/training/ui/EffectPanel.java index c4378140d..88875e07f 100644 --- a/src/main/java/module/training/ui/EffectPanel.java +++ b/src/main/java/module/training/ui/EffectPanel.java @@ -3,21 +3,16 @@ import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyPanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.training.EffectDAO; import module.training.TrainWeekEffect; import module.training.ui.model.EffectTableModel; import module.training.ui.renderer.SkillupsTableCellRenderer; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.util.List; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.SwingConstants; - /** * Shows a table with training effet. * @@ -74,7 +69,7 @@ private void initComponents() { p.setOpaque(false); p.setLayout(new BorderLayout()); - JLabel label = new JLabel(HOVerwaltung.instance().getLanguageString("TAB_EFFECT"), + JLabel label = new JLabel(TranslationFacility.tr("TAB_EFFECT"), SwingConstants.CENTER); label.setOpaque(false); diff --git a/src/main/java/module/training/ui/FutureTrainingPrioPopup.java b/src/main/java/module/training/ui/FutureTrainingPrioPopup.java index a16976141..4de6e4a2d 100644 --- a/src/main/java/module/training/ui/FutureTrainingPrioPopup.java +++ b/src/main/java/module/training/ui/FutureTrainingPrioPopup.java @@ -1,7 +1,7 @@ package module.training.ui; import core.gui.comp.panel.LazyImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.training.FuturePlayerTraining; import core.util.HODateTime; import core.util.HOLogger; @@ -13,10 +13,10 @@ public class FutureTrainingPrioPopup extends JPopupMenu implements ActionListener { - private final JMenuItem fullTrainingMenuItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("trainpre.fulltrain")); - private final JMenuItem partialTrainingMenuItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("trainpre.partialtrain")); - private final JMenuItem osmosisTrainingMenuItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("trainpre.osmosistrain")); - private final JMenuItem noTrainingMenuItem = new JMenuItem(HOVerwaltung.instance().getLanguageString("trainpre.notrain")); + private final JMenuItem fullTrainingMenuItem = new JMenuItem(TranslationFacility.tr("trainpre.fulltrain")); + private final JMenuItem partialTrainingMenuItem = new JMenuItem(TranslationFacility.tr("trainpre.partialtrain")); + private final JMenuItem osmosisTrainingMenuItem = new JMenuItem(TranslationFacility.tr("trainpre.osmosistrain")); + private final JMenuItem noTrainingMenuItem = new JMenuItem(TranslationFacility.tr("trainpre.notrain")); private final JMenuItem bestPositionTrainingMenuItem = new JMenuItem(""); private final LazyImagePanel panel; diff --git a/src/main/java/module/training/ui/OutputPanel.java b/src/main/java/module/training/ui/OutputPanel.java index 57a40aeb6..000ead519 100644 --- a/src/main/java/module/training/ui/OutputPanel.java +++ b/src/main/java/module/training/ui/OutputPanel.java @@ -4,7 +4,7 @@ import core.gui.RefreshManager; import core.gui.comp.NumericDocument; import core.gui.comp.panel.LazyImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.enums.MatchType; import core.model.player.Player; import core.net.OnlineWorker; @@ -16,19 +16,17 @@ import module.training.ui.model.OutputTableModel; import module.training.ui.model.TrainingModel; import module.training.ui.renderer.OutputTableRenderer; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.Point; + +import javax.swing.*; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; +import java.awt.*; import java.awt.event.AdjustmentListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; -import javax.swing.*; -import javax.swing.table.*; /** * The Panel where the main training table is shown ("Training"). @@ -84,10 +82,10 @@ private void importMatches() { JTextField tf = new JTextField(); tf.setDocument(new NumericDocument(10)); - Object[] objs = {HOVerwaltung.instance().getLanguageString("ls.match.id"), tf}; + Object[] objs = {TranslationFacility.tr("ls.match.id"), tf}; - int value = JOptionPane.showConfirmDialog(HOMainFrame.instance(), objs, HOVerwaltung - .instance().getLanguageString("ImportMatch"), JOptionPane.OK_CANCEL_OPTION); + int value = JOptionPane.showConfirmDialog(HOMainFrame.instance(), objs, + TranslationFacility.tr("ImportMatch"), JOptionPane.OK_CANCEL_OPTION); String input = tf.getText(); if (value == JOptionPane.YES_OPTION && !StringUtils.isEmpty(input)) { @@ -97,13 +95,13 @@ private void importMatches() { if (HelperWrapper.instance().isUserMatch(input, MatchType.LEAGUE)) { if (OnlineWorker.downloadMatchData(matchID, MatchType.LEAGUE, false)) { Helper.showMessage(null, - HOVerwaltung.instance().getLanguageString("MatchImported"), - HOVerwaltung.instance().getLanguageString("ImportOK"), 1); + TranslationFacility.tr("MatchImported"), + TranslationFacility.tr("ImportOK"), 1); RefreshManager.instance().doRefresh(); } } else { - Helper.showMessage(null, HOVerwaltung.instance().getLanguageString("NotUserMatch"), - HOVerwaltung.instance().getLanguageString("ImportError"), 1); + Helper.showMessage(null, TranslationFacility.tr("NotUserMatch"), + TranslationFacility.tr("ImportError"), 1); } } } @@ -246,13 +244,13 @@ private void initComponents() { JPanel buttonPanel = new JPanel(new GridBagLayout()); - this.importButton = new JButton(HOVerwaltung.instance().getLanguageString("ImportMatch")); + this.importButton = new JButton(TranslationFacility.tr("ImportMatch")); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(6, 8, 6, 4); buttonPanel.add(this.importButton, gbc); - this.calculateButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.menu.file.subskillrecalculation")); + this.calculateButton = new JButton(TranslationFacility.tr("ls.menu.file.subskillrecalculation")); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets = new Insets(6, 4, 6, 8); diff --git a/src/main/java/module/training/ui/PlayerDetailPanel.java b/src/main/java/module/training/ui/PlayerDetailPanel.java index 1c36773de..301b452b2 100644 --- a/src/main/java/module/training/ui/PlayerDetailPanel.java +++ b/src/main/java/module/training/ui/PlayerDetailPanel.java @@ -6,7 +6,7 @@ import core.gui.comp.entry.ColorLabelEntry; import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.FuturePlayer; import core.model.player.MatchRoleID; @@ -17,6 +17,7 @@ import module.training.ui.comp.HTColorBar; import module.training.ui.model.TrainingModel; +import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.FocusEvent; @@ -25,8 +26,6 @@ import java.time.temporal.ChronoUnit; import java.util.ArrayList; -import javax.swing.*; - import static core.constants.player.PlayerSkill.FORM; import static core.constants.player.PlayerSkill.STAMINA; @@ -86,7 +85,7 @@ private void loadFromModel() { select.setEnabled(false); } } - playerLabel.setText(HOVerwaltung.instance().getLanguageString("PlayerSelect")); + playerLabel.setText(TranslationFacility.tr("PlayerSelect")); m_jtaNotes.setEditable(false); m_jtaNotes.setText(""); @@ -255,7 +254,7 @@ private void initComponents() { bottom.add(trainingPlanSelection[i], gbc); // individual training } else if ( i == 0){ - bottom.add(new JLabel(HOVerwaltung.instance().getLanguageString("trainpre.plan")), gbc); + bottom.add(new JLabel(TranslationFacility.tr("trainpre.plan")), gbc); } } @@ -274,7 +273,7 @@ else if ( i == 0){ JPanel panel2 = new ImagePanel(); panel2.setLayout(new BorderLayout()); - panel2.setBorder(javax.swing.BorderFactory.createTitledBorder(HOVerwaltung.instance().getLanguageString("Notizen"))); + panel2.setBorder(javax.swing.BorderFactory.createTitledBorder(TranslationFacility.tr("Notizen"))); panel2.add(new JScrollPane(m_jtaNotes), BorderLayout.CENTER); maingbc.gridx = 0; diff --git a/src/main/java/module/training/ui/TrainingLegendPanel.java b/src/main/java/module/training/ui/TrainingLegendPanel.java index f339ebf3e..98b1f1e93 100644 --- a/src/main/java/module/training/ui/TrainingLegendPanel.java +++ b/src/main/java/module/training/ui/TrainingLegendPanel.java @@ -6,23 +6,15 @@ import core.constants.player.PlayerSkill; import core.gui.comp.panel.ImagePanel; import core.gui.theme.ImageUtilities; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.training.Skills; -import java.awt.Color; -import java.awt.GridLayout; -import java.awt.Image; -import java.awt.Toolkit; +import javax.swing.*; +import java.awt.*; import java.awt.image.FilteredImageSource; import java.awt.image.RGBImageFilter; import java.io.Serial; -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.SwingConstants; - public class TrainingLegendPanel extends ImagePanel { //~ Constructors ------------------------------------------------------------------------------- @Serial @@ -34,7 +26,7 @@ public class TrainingLegendPanel extends ImagePanel { public TrainingLegendPanel() { this.setLayout(new GridLayout(2, 5)); - JLabel title = new JLabel(HOVerwaltung.instance().getLanguageString("Legenda"), SwingConstants.LEFT); //$NON-NLS-1$ + JLabel title = new JLabel(TranslationFacility.tr("Legenda"), SwingConstants.LEFT); //$NON-NLS-1$ this.add(title); for (int i = 0; i < 4; i++) { diff --git a/src/main/java/module/training/ui/TrainingPanel.java b/src/main/java/module/training/ui/TrainingPanel.java index b6b0fa1ec..c893423e3 100644 --- a/src/main/java/module/training/ui/TrainingPanel.java +++ b/src/main/java/module/training/ui/TrainingPanel.java @@ -3,28 +3,28 @@ import core.gui.theme.HOColorName; import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.constants.TrainingConstants; import core.training.TrainingManager; import core.training.TrainingPerWeek; import core.util.Helper; -import module.training.ui.comp.DividerListener; import module.training.ui.comp.FutureTrainingsEditionPanel; -import module.training.ui.comp.trainingParametersEditor; import module.training.ui.comp.TrainingComboBox; +import module.training.ui.comp.trainingParametersEditor; import module.training.ui.model.FutureTrainingsTableModel; import module.training.ui.model.ModelChange; import module.training.ui.model.PastTrainingsTableModel; import module.training.ui.model.TrainingModel; -import java.awt.*; -import java.awt.event.MouseEvent; -import java.util.Map; + import javax.swing.*; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableModel; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.util.Map; import static core.gui.theme.HOIconName.TRAINING_ICON; import static module.lineup.LineupPanel.TITLE_FG; @@ -127,7 +127,7 @@ private void initComponents() { uGbc.insets = new Insets(3, 3, 3, 3); JLabel pastTrainingsLabel = new JLabel(); - pastTrainingsLabel.setText(HOVerwaltung.instance().getLanguageString("PastTrainings")); + pastTrainingsLabel.setText(TranslationFacility.tr("PastTrainings")); pastTrainingsLabel.setForeground(TITLE_FG); pastTrainingsLabel.setFont(getFont().deriveFont(Font.BOLD)); uGbc.gridx = 0; diff --git a/src/main/java/module/training/ui/TrainingPredictionPanel.java b/src/main/java/module/training/ui/TrainingPredictionPanel.java index 256aa481c..db24e7868 100644 --- a/src/main/java/module/training/ui/TrainingPredictionPanel.java +++ b/src/main/java/module/training/ui/TrainingPredictionPanel.java @@ -2,12 +2,13 @@ import core.gui.RefreshManager; import core.gui.comp.panel.LazyImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import module.training.ui.model.ModelChange; import module.training.ui.model.TrainingModel; -import java.awt.*; + import javax.swing.*; +import java.awt.*; public class TrainingPredictionPanel extends LazyImagePanel { @@ -63,7 +64,7 @@ private void initComponents() { setOpaque(false); - JLabel title = new JLabel(HOVerwaltung.instance().getLanguageString("ls.module.training.training_prediction"), + JLabel title = new JLabel(TranslationFacility.tr("ls.module.training.training_prediction"), SwingConstants.CENTER); title.setOpaque(false); diff --git a/src/main/java/module/training/ui/TrainingRecapTable.java b/src/main/java/module/training/ui/TrainingRecapTable.java index 5a8f81fd0..71f1647e8 100644 --- a/src/main/java/module/training/ui/TrainingRecapTable.java +++ b/src/main/java/module/training/ui/TrainingRecapTable.java @@ -5,16 +5,22 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.MatchRoleID; import core.model.player.Player; -import core.training.FutureTrainingManager; import core.model.player.SkillChange; +import core.training.FutureTrainingManager; import core.training.TrainingPreviewPlayers; import module.training.ui.model.TrainingModel; import module.training.ui.renderer.TrainingRecapRenderer; -import java.awt.Color; -import java.awt.Component; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumnModel; +import javax.swing.table.TableModel; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.time.temporal.ChronoUnit; @@ -22,11 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Vector; -import javax.swing.*; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; public class TrainingRecapTable extends JScrollPane { @@ -45,11 +46,11 @@ public class TrainingRecapTable extends JScrollPane { */ Vector getColumns() { var columns = new Vector(); - columns.add(HOVerwaltung.instance().getLanguageString("Spieler")); - columns.add(HOVerwaltung.instance().getLanguageString("ls.player.age")); - columns.add(HOVerwaltung.instance().getLanguageString("BestePosition")); + columns.add(TranslationFacility.tr("Spieler")); + columns.add(TranslationFacility.tr("ls.player.age")); + columns.add(TranslationFacility.tr("BestePosition")); columns.add("Speed"); - columns.add(HOVerwaltung.instance().getLanguageString("ls.player.id")); + columns.add(TranslationFacility.tr("ls.player.id")); var actualWeek = HOVerwaltung.instance().getModel().getBasics().getHattrickWeek(); //.getSpieltag(); @@ -69,7 +70,7 @@ Vector getColumns() { actualWeek = actualWeek.plus(7, ChronoUnit.DAYS); } - columns.add(HOVerwaltung.instance().getLanguageString("ls.player.id")); + columns.add(TranslationFacility.tr("ls.player.id")); return columns; } diff --git a/src/main/java/module/training/ui/comp/FutureTrainingsEditionPanel.java b/src/main/java/module/training/ui/comp/FutureTrainingsEditionPanel.java index 47878f529..b8be898c0 100644 --- a/src/main/java/module/training/ui/comp/FutureTrainingsEditionPanel.java +++ b/src/main/java/module/training/ui/comp/FutureTrainingsEditionPanel.java @@ -2,7 +2,7 @@ import core.datatype.CBItem; import core.gui.RefreshManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.constants.TrainingConstants; import core.model.enums.DBDataSource; import core.training.TrainingPerWeek; @@ -10,13 +10,15 @@ import core.util.Helper; import module.training.ui.model.FutureTrainingsTableModel; import module.training.ui.model.TrainingModel; + +import javax.swing.*; import java.awt.*; -import static module.lineup.LineupPanel.TITLE_FG; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.swing.*; + +import static module.lineup.LineupPanel.TITLE_FG; /** @@ -220,7 +222,7 @@ private void initComponents() { add(m_jcbAssitantsTotalLevelEditor, gbc); - JButton button = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.apply")); + JButton button = new JButton(TranslationFacility.tr("ls.button.apply")); button.addActionListener(arg0 -> updateFutureTrainings()); gbc.gridx = 5; add(button, gbc); diff --git a/src/main/java/module/training/ui/comp/StateBar.java b/src/main/java/module/training/ui/comp/StateBar.java index 26c2b5e8f..37a357443 100644 --- a/src/main/java/module/training/ui/comp/StateBar.java +++ b/src/main/java/module/training/ui/comp/StateBar.java @@ -1,13 +1,10 @@ // %1126721451073:hoplugins.trainingExperience.ui.bar% package module.training.ui.comp; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; - -import javax.swing.JComponent; +import javax.swing.*; +import java.awt.*; @@ -66,11 +63,11 @@ public void change(int lvl1, int lvl2) { String desc = ""; if (lvl1 > 0) { - desc = desc + HOVerwaltung.instance().getLanguageString("Aktuell") + lvl1 + "% "; + desc = desc + TranslationFacility.tr("Aktuell") + lvl1 + "% "; } if (lvl2 > 0) { - desc = desc + HOVerwaltung.instance().getLanguageString("Final") + lvl2 + "% "; + desc = desc + TranslationFacility.tr("Final") + lvl2 + "% "; } setToolTipText(desc); diff --git a/src/main/java/module/training/ui/model/ChangesTableModel.java b/src/main/java/module/training/ui/model/ChangesTableModel.java index b79621a8f..f3618f621 100644 --- a/src/main/java/module/training/ui/model/ChangesTableModel.java +++ b/src/main/java/module/training/ui/model/ChangesTableModel.java @@ -1,15 +1,13 @@ -// %2597556203:hoplugins.trainingExperience.ui.model% package module.training.ui.model; import core.constants.player.PlayerAbility; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.training.PlayerSkillChange; +import javax.swing.table.AbstractTableModel; import java.io.Serial; import java.util.List; -import javax.swing.table.AbstractTableModel; - /** * TableModel representing skill changes for individual players. * @@ -31,12 +29,11 @@ public class ChangesTableModel extends AbstractTableModel { */ public ChangesTableModel(List values) { super(); - HOVerwaltung hoV = HOVerwaltung.instance(); - this.colNames[0] = hoV.getLanguageString("Week"); - this.colNames[1] = hoV.getLanguageString("Season"); - this.colNames[2] = hoV.getLanguageString("Spieler"); - this.colNames[3] = hoV.getLanguageString("ls.player.skill"); - this.colNames[4] = hoV.getLanguageString("TO"); + this.colNames[0] = TranslationFacility.tr("Week"); + this.colNames[1] = TranslationFacility.tr("Season"); + this.colNames[2] = TranslationFacility.tr("Spieler"); + this.colNames[3] = TranslationFacility.tr("ls.player.skill"); + this.colNames[4] = TranslationFacility.tr("TO"); this.colNames[5] = "isOld"; this.colNames[COL_PLAYER_ID] = "playerId"; diff --git a/src/main/java/module/training/ui/model/EffectTableModel.java b/src/main/java/module/training/ui/model/EffectTableModel.java index 7506dcfb1..c08847762 100644 --- a/src/main/java/module/training/ui/model/EffectTableModel.java +++ b/src/main/java/module/training/ui/model/EffectTableModel.java @@ -1,14 +1,13 @@ package module.training.ui.model; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.training.TrainWeekEffect; +import javax.swing.table.AbstractTableModel; import java.io.Serial; import java.text.NumberFormat; import java.util.List; -import javax.swing.table.AbstractTableModel; - /** @@ -43,16 +42,15 @@ public EffectTableModel(List values) { super(); FORMATTER.setMaximumFractionDigits(2); FORMATTER.setMinimumFractionDigits(2); - HOVerwaltung hoV = HOVerwaltung.instance(); - this.colNames[0] = hoV.getLanguageString("Week"); //$NON-NLS-1$ - this.colNames[1] = hoV.getLanguageString("Season"); //$NON-NLS-1$ - this.colNames[2] = hoV.getLanguageString("TotalTSI"); //$NON-NLS-1$ - this.colNames[3] = hoV.getLanguageString("AverageTSI"); //$NON-NLS-1$ - this.colNames[4] = hoV.getLanguageString("ls.player.tsi") + " +/-"; //$NON-NLS-1$ //$NON-NLS-2$ - this.colNames[5] = hoV.getLanguageString("DurchschnittForm"); //$NON-NLS-1$ - this.colNames[6] = hoV.getLanguageString("ls.player.form") + " +/-"; //$NON-NLS-1$ //$NON-NLS-2$ - this.colNames[7] = hoV.getLanguageString("Skillups"); //$NON-NLS-1$ - this.colNames[8] = hoV.getLanguageString("ls.player.skill"); //$NON-NLS-1$ + this.colNames[0] = TranslationFacility.tr("Week"); //$NON-NLS-1$ + this.colNames[1] = TranslationFacility.tr("Season"); //$NON-NLS-1$ + this.colNames[2] = TranslationFacility.tr("TotalTSI"); //$NON-NLS-1$ + this.colNames[3] = TranslationFacility.tr("AverageTSI"); //$NON-NLS-1$ + this.colNames[4] = TranslationFacility.tr("ls.player.tsi") + " +/-"; //$NON-NLS-1$ //$NON-NLS-2$ + this.colNames[5] = TranslationFacility.tr("DurchschnittForm"); //$NON-NLS-1$ + this.colNames[6] = TranslationFacility.tr("ls.player.form") + " +/-"; //$NON-NLS-1$ //$NON-NLS-2$ + this.colNames[7] = TranslationFacility.tr("Skillups"); //$NON-NLS-1$ + this.colNames[8] = TranslationFacility.tr("ls.player.skill"); //$NON-NLS-1$ this.values = values; } diff --git a/src/main/java/module/training/ui/model/OutputTableModel.java b/src/main/java/module/training/ui/model/OutputTableModel.java index 42454b781..7a25ec441 100644 --- a/src/main/java/module/training/ui/model/OutputTableModel.java +++ b/src/main/java/module/training/ui/model/OutputTableModel.java @@ -3,20 +3,21 @@ import core.constants.player.PlayerSkill; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import core.training.FutureTrainingManager; import core.training.WeeklyTrainingType; import core.util.HODateTime; import core.util.Helper; import module.training.Skills; -import module.training.ui.comp.TrainingPriorityCell; import module.training.ui.comp.PlayerNameCell; +import module.training.ui.comp.TrainingPriorityCell; import module.training.ui.comp.VerticalIndicator; -import java.util.*; - import javax.swing.*; import javax.swing.table.AbstractTableModel; +import java.util.ArrayList; +import java.util.List; /** * Table Model for the main table showing training results @@ -80,18 +81,18 @@ public int getColumnCount() { @Override public String getColumnName(int columnIndex) { return switch (columnIndex) { - case COL_PLAYER_ID -> HOVerwaltung.instance().getLanguageString("ls.player.id"); - case 0 -> HOVerwaltung.instance().getLanguageString("Spieler"); - case 1 -> HOVerwaltung.instance().getLanguageString("ls.player.age"); - case 2 -> HOVerwaltung.instance().getLanguageString("trainpre.priority"); - case 3 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper"); - case 4 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.defending"); - case 5 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking"); - case 6 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.passing"); - case 7 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.winger"); - case 8 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring"); - case 9 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces"); - case 10 -> HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina"); + case COL_PLAYER_ID -> TranslationFacility.tr("ls.player.id"); + case 0 -> TranslationFacility.tr("Spieler"); + case 1 -> TranslationFacility.tr("ls.player.age"); + case 2 -> TranslationFacility.tr("trainpre.priority"); + case 3 -> TranslationFacility.tr("ls.player.skill.keeper"); + case 4 -> TranslationFacility.tr("ls.player.skill.defending"); + case 5 -> TranslationFacility.tr("ls.player.skill.playmaking"); + case 6 -> TranslationFacility.tr("ls.player.skill.passing"); + case 7 -> TranslationFacility.tr("ls.player.skill.winger"); + case 8 -> TranslationFacility.tr("ls.player.skill.scoring"); + case 9 -> TranslationFacility.tr("ls.player.skill.setpieces"); + case 10 -> TranslationFacility.tr("ls.player.skill.stamina"); default -> ""; }; } diff --git a/src/main/java/module/training/ui/model/SkillupTableModel.java b/src/main/java/module/training/ui/model/SkillupTableModel.java index 67540f66e..2010e5d4a 100644 --- a/src/main/java/module/training/ui/model/SkillupTableModel.java +++ b/src/main/java/module/training/ui/model/SkillupTableModel.java @@ -1,13 +1,13 @@ package module.training.ui.model; import core.constants.player.PlayerAbility; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import core.model.player.SkillChange; +import javax.swing.table.AbstractTableModel; import java.io.Serial; import java.util.List; -import javax.swing.table.AbstractTableModel; public class SkillupTableModel extends AbstractTableModel { @@ -49,10 +49,10 @@ public Object getValueAt(int rowIndex, int columnIndex) { @Override public String getColumnName(int column) { return switch (column) { - case 0 -> HOVerwaltung.instance().getLanguageString("ls.player.skill"); - case 1 -> HOVerwaltung.instance().getLanguageString("Week"); - case 2 -> HOVerwaltung.instance().getLanguageString("Season"); - case 3 -> HOVerwaltung.instance().getLanguageString("ls.player.age"); + case 0 -> TranslationFacility.tr("ls.player.skill"); + case 1 -> TranslationFacility.tr("Week"); + case 2 -> TranslationFacility.tr("Season"); + case 3 -> TranslationFacility.tr("ls.player.age"); default -> ""; }; } diff --git a/src/main/java/module/training/ui/renderer/TrainingRecapRenderer.java b/src/main/java/module/training/ui/renderer/TrainingRecapRenderer.java index 146a05e94..8e92d3a1e 100644 --- a/src/main/java/module/training/ui/renderer/TrainingRecapRenderer.java +++ b/src/main/java/module/training/ui/renderer/TrainingRecapRenderer.java @@ -5,19 +5,17 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import core.training.WeeklyTrainingType; import core.util.HOLogger; import module.training.ui.TrainingLegendPanel; import module.training.ui.model.TrainingModel; -import java.awt.Color; -import java.awt.Component; -import java.io.Serial; - -import javax.swing.Icon; -import javax.swing.JTable; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; +import java.awt.*; +import java.io.Serial; /** @@ -123,9 +121,9 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole int calcPlayerAgeThisCol = (int) (realPlayerAge + (column+1)*7d/112d); // Birthday in this week! Set BG color if (calcPlayerAgePrevCol < calcPlayerAgeThisCol) { - String ageText = HOVerwaltung.instance().getLanguageString("ls.player.age.birthday") + String ageText = TranslationFacility.tr("ls.player.age.birthday") + " (" + calcPlayerAgeThisCol + " " - + HOVerwaltung.instance().getLanguageString("ls.player.age.years") + + TranslationFacility.tr("ls.player.age.years") + ")"; if (text == null || text.isEmpty()) { diff --git a/src/main/java/module/transfer/TransferType.java b/src/main/java/module/transfer/TransferType.java index f78c2c57f..029176687 100644 --- a/src/main/java/module/transfer/TransferType.java +++ b/src/main/java/module/transfer/TransferType.java @@ -2,7 +2,7 @@ package module.transfer; import core.db.AbstractTable; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; /** @@ -75,27 +75,27 @@ public TransferType() { * @return Transfer type */ public static int getTransferCode(String type) { - if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Trained_on_Roster"))) { //$NON-NLS-1$ + if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Trained_on_Roster"))) { //$NON-NLS-1$ return TRAINED_ROSTER; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Starter_on_Roster"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Starter_on_Roster"))) { //$NON-NLS-1$ return STARTER_ROSTER; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Backup_on_Roster"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Backup_on_Roster"))) { //$NON-NLS-1$ return BACKUP_ROSTER; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Youth_Pull"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Youth_Pull"))) { //$NON-NLS-1$ return YOUTH_PULL; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Original_Player"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Original_Player"))) { //$NON-NLS-1$ return ORIGINAL_ROSTER; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Day_Trading"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Day_Trading"))) { //$NON-NLS-1$ return DAY_TRADING; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Skill_Trading"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Skill_Trading"))) { //$NON-NLS-1$ return SKILL_TRADING; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Future_Trainer"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Future_Trainer"))) { //$NON-NLS-1$ return FUTURE_TRAINER; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Old_Trained_Player"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Old_Trained_Player"))) { //$NON-NLS-1$ return OLD_TRAINED; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Old_Starter_Player"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Old_Starter_Player"))) { //$NON-NLS-1$ return OLD_STARTER; - } else if (type.equalsIgnoreCase(HOVerwaltung.instance().getLanguageString("TransferTypes.Old_Backup_Player"))) { //$NON-NLS-1$ + } else if (type.equalsIgnoreCase(TranslationFacility.tr("TransferTypes.Old_Backup_Player"))) { //$NON-NLS-1$ return OLD_BACKUP; } else { return FIRED_PLAYER; @@ -112,37 +112,37 @@ public static int getTransferCode(String type) { public static String getTransferDesc(int type) { return switch (type) { case TRAINED_ROSTER -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Trained_on_Roster"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Trained_on_Roster"); //$NON-NLS-1$ case STARTER_ROSTER -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Starter_on_Roster"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Starter_on_Roster"); //$NON-NLS-1$ case BACKUP_ROSTER -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Backup_on_Roster"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Backup_on_Roster"); //$NON-NLS-1$ - case YOUTH_PULL -> HOVerwaltung.instance().getLanguageString("TransferTypes.Youth_Pull"); //$NON-NLS-1$ + case YOUTH_PULL -> TranslationFacility.tr("TransferTypes.Youth_Pull"); //$NON-NLS-1$ case ORIGINAL_ROSTER -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Original_Player"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Original_Player"); //$NON-NLS-1$ - case DAY_TRADING -> HOVerwaltung.instance().getLanguageString("TransferTypes.Day_Trading"); //$NON-NLS-1$ + case DAY_TRADING -> TranslationFacility.tr("TransferTypes.Day_Trading"); //$NON-NLS-1$ case SKILL_TRADING -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Skill_Trading"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Skill_Trading"); //$NON-NLS-1$ case FUTURE_TRAINER -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Future_Trainer"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Future_Trainer"); //$NON-NLS-1$ case OLD_TRAINED -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Old_Trained_Player"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Old_Trained_Player"); //$NON-NLS-1$ case OLD_STARTER -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Old_Starter_Player"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Old_Starter_Player"); //$NON-NLS-1$ case OLD_BACKUP -> - HOVerwaltung.instance().getLanguageString("TransferTypes.Old_Backup_Player"); //$NON-NLS-1$ + TranslationFacility.tr("TransferTypes.Old_Backup_Player"); //$NON-NLS-1$ - case FIRED_PLAYER -> HOVerwaltung.instance().getLanguageString("FiredPlayer"); //$NON-NLS-1$ + case FIRED_PLAYER -> TranslationFacility.tr("FiredPlayer"); //$NON-NLS-1$ default -> ""; //$NON-NLS-1$ }; diff --git a/src/main/java/module/transfer/TransfersModule.java b/src/main/java/module/transfer/TransfersModule.java index b3c373622..48296c151 100644 --- a/src/main/java/module/transfer/TransfersModule.java +++ b/src/main/java/module/transfer/TransfersModule.java @@ -1,14 +1,11 @@ package module.transfer; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; -import javax.swing.KeyStroke; - - -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; +import javax.swing.*; +import java.awt.event.KeyEvent; + public final class TransfersModule extends DefaultModule { private TransfersPanel panel; @@ -23,7 +20,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Transfers"); + return TranslationFacility.tr("Transfers"); } @Override diff --git a/src/main/java/module/transfer/TransfersPanel.java b/src/main/java/module/transfer/TransfersPanel.java index 12089272b..c25d14ea6 100644 --- a/src/main/java/module/transfer/TransfersPanel.java +++ b/src/main/java/module/transfer/TransfersPanel.java @@ -4,16 +4,17 @@ import core.gui.IRefreshable; import core.gui.RefreshManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import module.transfer.history.HistoryPane; import module.transfer.scout.TransferScoutPanel; import module.transfer.transfertype.TransferTypePane; -import java.awt.BorderLayout; + +import javax.swing.*; +import java.awt.*; import java.io.Serial; import java.util.List; import java.util.Vector; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; public class TransfersPanel extends JPanel implements IRefreshable { @@ -37,13 +38,13 @@ private void initialize() { final JTabbedPane tabPane = new JTabbedPane(); historyPane = new HistoryPane(); - tabPane.add(HOVerwaltung.instance().getLanguageString("History"), historyPane); //$NON-NLS-1$ + tabPane.add(TranslationFacility.tr("History"), historyPane); //$NON-NLS-1$ transferTypePane = new TransferTypePane(); - tabPane.add(HOVerwaltung.instance().getLanguageString("TransferTypes"), transferTypePane); + tabPane.add(TranslationFacility.tr("TransferTypes"), transferTypePane); scoutPanel = new TransferScoutPanel(); - tabPane.add(HOVerwaltung.instance().getLanguageString("TransferScout"), scoutPanel); + tabPane.add(TranslationFacility.tr("TransferScout"), scoutPanel); // this.overviewPanel = new OverviewPanel(); // tabPane.add("Financial", this.overviewPanel); diff --git a/src/main/java/module/transfer/history/HistoryPane.java b/src/main/java/module/transfer/history/HistoryPane.java index 1fd5cbc95..03374b9c9 100644 --- a/src/main/java/module/transfer/history/HistoryPane.java +++ b/src/main/java/module/transfer/history/HistoryPane.java @@ -6,31 +6,19 @@ import core.gui.comp.panel.ImagePanel; import core.gui.theme.ImageUtilities; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; -import core.util.Helper; import core.util.CurrencyUtils; +import core.util.Helper; import module.training.ui.comp.DividerListener; import module.transfer.PlayerTransfer; import module.transfer.XMLParser; import module.transfer.ui.layout.TableLayout; import module.transfer.ui.layout.TableLayoutConstants; -import java.awt.BorderLayout; + +import javax.swing.*; +import java.awt.*; import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.ButtonModel; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JSpinner; -import javax.swing.JSplitPane; -import javax.swing.ScrollPaneConstants; -import javax.swing.SpinnerNumberModel; -import javax.swing.SwingConstants; /** * Pane to show transfer history information for your own team. @@ -77,11 +65,11 @@ public HistoryPane() { {10, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED,TableLayoutConstants.PREFERRED} })); - final JRadioButton rb1 = new JRadioButton(hoV.getLanguageString("AllSeasons")); //$NON-NLS-1$ + final JRadioButton rb1 = new JRadioButton(TranslationFacility.tr("AllSeasons")); //$NON-NLS-1$ rb1.setFocusable(false); rb1.setOpaque(false); - final JRadioButton rb2 = new JRadioButton(hoV.getLanguageString("Season")); //$NON-NLS-1$ + final JRadioButton rb2 = new JRadioButton(TranslationFacility.tr("Season")); //$NON-NLS-1$ spinSeason = rb2.getModel(); rb2.setFocusable(false); rb2.setOpaque(false); @@ -115,21 +103,21 @@ public HistoryPane() { } }); - JButton button = new JButton(HOVerwaltung.instance().getLanguageString("Menu.refreshData")); + JButton button = new JButton(TranslationFacility.tr("Menu.refreshData")); button.addActionListener(e -> { HOVerwaltung hoV1 = HOVerwaltung.instance(); int teamId = hoV1.getModel().getBasics().getTeamId(); if (teamId != 0 && !hoV1.getModel().getBasics().isNationalTeam()) { - String sBuffer = hoV1.getLanguageString("UpdConfirmMsg.0") + - "\n" + hoV1.getLanguageString("UpdConfirmMsg.1") + - "\n" + hoV1.getLanguageString("UpdConfirmMsg.2") + - "\n\n" + hoV1.getLanguageString("UpdConfirmMsg.3"); + String sBuffer = TranslationFacility.tr("UpdConfirmMsg.0") + + "\n" + TranslationFacility.tr("UpdConfirmMsg.1") + + "\n" + TranslationFacility.tr("UpdConfirmMsg.2") + + "\n\n" + TranslationFacility.tr("UpdConfirmMsg.3"); final int choice = JOptionPane.showConfirmDialog(HOMainFrame.instance(), sBuffer, - HOVerwaltung.instance().getLanguageString("confirmation.title"), + TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); if (choice == JOptionPane.YES_OPTION) { @@ -144,7 +132,7 @@ public HistoryPane() { refresh(); } } else { - Helper.showMessage(HOMainFrame.instance(), hoV1.getLanguageString("UpdMsg"), "", 1); + Helper.showMessage(HOMainFrame.instance(), TranslationFacility.tr("UpdMsg"), "", 1); } }); @@ -166,11 +154,11 @@ public HistoryPane() { {10, 20, 20} })); - final JLabel amTrans = new JLabel(hoV.getLanguageString("Transfers") + ":", SwingConstants.LEFT); - final JLabel amTransIn = new JLabel(hoV.getLanguageString("In") + ":", SwingConstants.LEFT); + final JLabel amTrans = new JLabel(TranslationFacility.tr("Transfers") + ":", SwingConstants.LEFT); + final JLabel amTransIn = new JLabel(TranslationFacility.tr("In") + ":", SwingConstants.LEFT); amTransIn.setIcon(ImageUtilities.getTransferInIcon()); - final JLabel amTransOut = new JLabel(hoV.getLanguageString("Out") + ":", SwingConstants.LEFT); + final JLabel amTransOut = new JLabel(TranslationFacility.tr("Out") + ":", SwingConstants.LEFT); amTransOut.setIcon(ImageUtilities.getTransferOutIcon()); amountPanel.add(amTrans, "1, 1"); amountPanel.add(amountTransfers, "2, 1"); @@ -178,9 +166,9 @@ public HistoryPane() { amountPanel.add(amountTransfersIn, "5, 1"); amountPanel.add(amTransOut, "4, 2"); amountPanel.add(amountTransfersOut, "5, 2"); - pricePanel = new TotalsPanel(hoV.getLanguageString("Price"), + pricePanel = new TotalsPanel(TranslationFacility.tr("Price"), CurrencyUtils.CURRENCYSYMBOL); - tsiPanel = new TotalsPanel(hoV.getLanguageString("ls.player.tsi")); //$NON-NLS-1$ + tsiPanel = new TotalsPanel(TranslationFacility.tr("ls.player.tsi")); //$NON-NLS-1$ sidePanel.add(filterPanel, "0, 0"); sidePanel.add(new JSeparator(), "0, 2"); diff --git a/src/main/java/module/transfer/history/PlayerDetailPanel.java b/src/main/java/module/transfer/history/PlayerDetailPanel.java index 889d6c973..19ab426c3 100644 --- a/src/main/java/module/transfer/history/PlayerDetailPanel.java +++ b/src/main/java/module/transfer/history/PlayerDetailPanel.java @@ -1,8 +1,5 @@ -// %1126721330604:hoplugins.transfers.ui% package module.transfer.history; - - import core.constants.player.PlayerSkill; import core.db.DBManager; import core.gui.comp.panel.ImagePanel; @@ -10,6 +7,7 @@ import core.gui.model.UserColumnController; import core.gui.theme.ImageUtilities; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import core.util.HODateTime; import core.util.Helper; @@ -19,21 +17,15 @@ import module.transfer.ui.layout.TableLayout; import module.transfer.ui.layout.TableLayoutConstants; import module.transfer.ui.sorter.DefaultTableSorter; -import java.awt.BorderLayout; -import java.awt.Color; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serial; import java.util.List; import java.util.Vector; -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.SwingConstants; + import static core.util.CurrencyUtils.convertCurrency; /** @@ -44,16 +36,15 @@ public class PlayerDetailPanel extends JPanel implements ActionListener { @Serial private static final long serialVersionUID = -6855218725568752692L; - private static final HOVerwaltung hov = HOVerwaltung.instance(); - private static final String SKILL_PLAYMAKING = hov.getLanguageString("ls.player.skill.playmaking"); - private static final String SKILL_PASSING = hov.getLanguageString("ls.player.skill.passing"); - private static final String SKILL_WING = hov.getLanguageString("ls.player.skill.winger"); - private static final String SKILL_DEFENSE = hov.getLanguageString("ls.player.skill.defending"); - private static final String SKILL_SCORING = hov.getLanguageString("ls.player.skill.scoring"); - private static final String SKILL_SETPIECES = hov.getLanguageString("ls.player.skill.setpieces"); - private static final String SKILL_STAMINA = hov.getLanguageString("ls.player.skill.stamina"); - private static final String SKILL_KEEPER = hov.getLanguageString("ls.player.skill.keeper"); - private static final String SKILL_EXPERIENCE = hov.getLanguageString("ls.player.experience"); + private static final String SKILL_PLAYMAKING = TranslationFacility.tr("ls.player.skill.playmaking"); + private static final String SKILL_PASSING = TranslationFacility.tr("ls.player.skill.passing"); + private static final String SKILL_WING = TranslationFacility.tr("ls.player.skill.winger"); + private static final String SKILL_DEFENSE = TranslationFacility.tr("ls.player.skill.defending"); + private static final String SKILL_SCORING = TranslationFacility.tr("ls.player.skill.scoring"); + private static final String SKILL_SETPIECES = TranslationFacility.tr("ls.player.skill.setpieces"); + private static final String SKILL_STAMINA = TranslationFacility.tr("ls.player.skill.stamina"); + private static final String SKILL_KEEPER = TranslationFacility.tr("ls.player.skill.keeper"); + private static final String SKILL_EXPERIENCE = TranslationFacility.tr("ls.player.experience"); private Player player; private final JButton updBtn = new JButton(); @@ -61,11 +52,11 @@ public class PlayerDetailPanel extends JPanel implements ActionListener { private final JLabel lengthOfStayInTeam = new JLabel("", SwingConstants.LEFT); //$NON-NLS-1$ private final JLabel totalCostOfOwnership = new JLabel("", SwingConstants.LEFT); //$NON-NLS-1$ private final JLabel sumOfWage = new JLabel("", SwingConstants.LEFT); - private final JLabel currTSI = new JLabel(HOVerwaltung.instance().getLanguageString("PlayerDetail.NotAvail"), + private final JLabel currTSI = new JLabel(TranslationFacility.tr("PlayerDetail.NotAvail"), SwingConstants.LEFT); private final JLabel income = new JLabel("", SwingConstants.LEFT); //$NON-NLS-1$ private final JLabel name = new JLabel("", SwingConstants.LEFT); //$NON-NLS-1$ - private final JLabel fired = new JLabel(HOVerwaltung.instance().getLanguageString("FiredPlayer"), SwingConstants.LEFT); + private final JLabel fired = new JLabel(TranslationFacility.tr("FiredPlayer"), SwingConstants.LEFT); private final JLabel skill_defense = new JLabel("", SwingConstants.LEFT); private final JLabel skill_experience = new JLabel("", SwingConstants.LEFT); @@ -118,7 +109,7 @@ public PlayerDetailPanel() { final JPanel detailPanel = new ImagePanel(); detailPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.GRAY), - HOVerwaltung.instance().getLanguageString("SpielerDetails"))); //$NON-NLS-1$ + TranslationFacility.tr("SpielerDetails"))); //$NON-NLS-1$ detailPanel.setOpaque(false); final TableLayout layout = new TableLayout(sizes); @@ -165,8 +156,8 @@ public PlayerDetailPanel() { detailPanel.add(skill_experience, "13, 2"); //$NON-NLS-1$ updBtn.setEnabled(false); - updBtn.setText(HOVerwaltung.instance().getLanguageString("ls.button.update")); - updBtn.setToolTipText(HOVerwaltung.instance().getLanguageString("UpdTooltip")); + updBtn.setText(TranslationFacility.tr("ls.button.update")); + updBtn.setToolTipText(TranslationFacility.tr("UpdTooltip")); updBtn.addActionListener(this); updBtn.setFocusable(false); @@ -178,7 +169,7 @@ public PlayerDetailPanel() { } private JLabel createPlayerDetailLabel(String s) { - var languageString = HOVerwaltung.instance().getLanguageString(s); + var languageString = TranslationFacility.tr(s); var ret = new JLabel(languageString, SwingConstants.LEFT); ret.setToolTipText(languageString); return ret; @@ -242,7 +233,7 @@ public final void clearPanel() { lengthOfStayInTeam.setText(""); totalCostOfOwnership.setText(""); income.setText(""); - currTSI.setText(HOVerwaltung.instance().getLanguageString("PlayerDetail.NotAvail")); + currTSI.setText(TranslationFacility.tr("PlayerDetail.NotAvail")); skill_keeper.setText(SKILL_KEEPER); skill_playmaking.setText(SKILL_PLAYMAKING); diff --git a/src/main/java/module/transfer/history/TotalsPanel.java b/src/main/java/module/transfer/history/TotalsPanel.java index e852d2c8f..a6f4a6ae0 100644 --- a/src/main/java/module/transfer/history/TotalsPanel.java +++ b/src/main/java/module/transfer/history/TotalsPanel.java @@ -3,18 +3,13 @@ import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.transfer.ui.layout.TableLayout; -import java.awt.BorderLayout; -import java.awt.Color; +import javax.swing.*; +import java.awt.*; import java.text.NumberFormat; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - /** @@ -76,23 +71,23 @@ public TotalsPanel(String titel, String currency) { panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.GRAY), titel)); - panel.add(new JLabel(HOVerwaltung.instance().getLanguageString("Total"), SwingConstants.CENTER), "3, 0"); //$NON-NLS-1$ //$NON-NLS-2$ - panel.add(new JLabel(HOVerwaltung.instance().getLanguageString("Durchschnitt"), + panel.add(new JLabel(TranslationFacility.tr("Total"), SwingConstants.CENTER), "3, 0"); //$NON-NLS-1$ //$NON-NLS-2$ + panel.add(new JLabel(TranslationFacility.tr("Durchschnitt"), SwingConstants.CENTER), "5, 0"); //$NON-NLS-1$ - panel.add(new JLabel(HOVerwaltung.instance().getLanguageString("Purchases"), SwingConstants.LEFT), "1, 1"); //$NON-NLS-1$ //$NON-NLS-2$ + panel.add(new JLabel(TranslationFacility.tr("Purchases"), SwingConstants.LEFT), "1, 1"); //$NON-NLS-1$ //$NON-NLS-2$ panel.add(new JLabel(currency, SwingConstants.RIGHT), "2, 1"); //$NON-NLS-1$ panel.add(buyTotPrice, "3, 1"); //$NON-NLS-1$ panel.add(new JLabel(currency, SwingConstants.RIGHT), "4, 1"); //$NON-NLS-1$ panel.add(buyAvgPrice, "5, 1"); //$NON-NLS-1$ - panel.add(new JLabel(HOVerwaltung.instance().getLanguageString("Sales"), SwingConstants.LEFT), "1, 2"); //$NON-NLS-1$ //$NON-NLS-2$ + panel.add(new JLabel(TranslationFacility.tr("Sales"), SwingConstants.LEFT), "1, 2"); //$NON-NLS-1$ //$NON-NLS-2$ panel.add(new JLabel(currency, SwingConstants.RIGHT), "2, 2"); //$NON-NLS-1$ panel.add(sellTotPrice, "3, 2"); //$NON-NLS-1$ panel.add(new JLabel(currency, SwingConstants.RIGHT), "4, 2"); //$NON-NLS-1$ panel.add(sellAvgPrice, "5, 2"); //$NON-NLS-1$ - panel.add(new JLabel(HOVerwaltung.instance().getLanguageString("Difference"), SwingConstants.LEFT), "1, 4"); //$NON-NLS-1$ //$NON-NLS-2$ + panel.add(new JLabel(TranslationFacility.tr("Difference"), SwingConstants.LEFT), "1, 4"); //$NON-NLS-1$ //$NON-NLS-2$ panel.add(new JLabel(currency, SwingConstants.RIGHT), "2, 4"); //$NON-NLS-1$ panel.add(diffTotPrice, "3, 4"); //$NON-NLS-1$ diff --git a/src/main/java/module/transfer/history/TransferTableModel.java b/src/main/java/module/transfer/history/TransferTableModel.java index aff9f076c..8bafc3bac 100644 --- a/src/main/java/module/transfer/history/TransferTableModel.java +++ b/src/main/java/module/transfer/history/TransferTableModel.java @@ -6,14 +6,15 @@ import core.gui.comp.table.HOTableModel; import core.gui.comp.table.UserColumn; import core.gui.model.UserColumnController; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import core.util.CurrencyUtils; import core.util.HODateTime; import module.transfer.PlayerTransfer; + +import javax.swing.*; import java.util.ArrayList; import java.util.List; -import javax.swing.*; /** * TableModel representing the transfers for your own team. @@ -57,7 +58,7 @@ public IHOTableEntry getTableEntry(PlayerTransfer transfer) { if ((transfer.getPlayerName() != null) && (!transfer.getPlayerName().isEmpty())) { text = transfer.getPlayerName(); } else { - text = "< " + HOVerwaltung.instance().getLanguageString("FiredPlayer") + " >"; + text = "< " + TranslationFacility.tr("FiredPlayer") + " >"; } return new ColorLabelEntry(text, ColorLabelEntry.FG_STANDARD, ColorLabelEntry.BG_STANDARD, SwingConstants.LEFT); diff --git a/src/main/java/module/transfer/scout/MiniScoutDialog.java b/src/main/java/module/transfer/scout/MiniScoutDialog.java index c173f4d61..0195ef52b 100644 --- a/src/main/java/module/transfer/scout/MiniScoutDialog.java +++ b/src/main/java/module/transfer/scout/MiniScoutDialog.java @@ -6,45 +6,21 @@ import core.gui.HOMainFrame; import core.gui.comp.HyperLinkLabel; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; -import core.model.player.Player; import core.model.player.MatchRoleID; +import core.model.player.Player; import core.util.HOLogger; import core.util.Helper; -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; import java.io.Serial; import java.util.Calendar; import java.util.Date; import java.util.List; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSpinner; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.SpinnerDateModel; -import javax.swing.SwingConstants; - /** * MiniScout dialog * @@ -56,9 +32,9 @@ class MiniScoutDialog extends JFrame implements ItemListener, ActionListener, Fo private static final long serialVersionUID = -2092930481559683730L; //~ Instance fields ---------------------------------------------------------------------------- - private final JButton jbApply = new JButton(core.model.HOVerwaltung.instance().getLanguageString("ls.button.ok")); - private final JButton jbApplyScout = new JButton(core.model.HOVerwaltung.instance().getLanguageString("ls.button.apply")); - private final JButton jbCancel = new JButton(core.model.HOVerwaltung.instance().getLanguageString("ls.button.cancel")); + private final JButton jbApply = new JButton(TranslationFacility.tr("ls.button.ok")); + private final JButton jbApplyScout = new JButton(TranslationFacility.tr("ls.button.apply")); + private final JButton jbCancel = new JButton(TranslationFacility.tr("ls.button.cancel")); private final JComboBox jcbAttacking = new JComboBox(core.constants.player.PlayerAbility.ITEMS); private final JComboBox jcbDefense = new JComboBox(core.constants.player.PlayerAbility.ITEMS); private final JComboBox jcbLeadership = new JComboBox(core.constants.player.PlayerAbility.ITEMS); @@ -73,8 +49,8 @@ class MiniScoutDialog extends JFrame implements ItemListener, ActionListener, Fo private final JComboBox jcbWinger = new JComboBox(core.constants.player.PlayerAbility.ITEMS); private final JComboBox jcbLoyalty = new JComboBox(core.constants.player.PlayerAbility.ITEMS); private final JCheckBox jchHomegrown = new JCheckBox(); - private final JLabel jlRating = new JLabel(core.model.HOVerwaltung.instance().getLanguageString("Unbestimmt") + ": 0.0"); - private final JLabel jlStatus = new JLabel("

" + HOVerwaltung.instance().getLanguageString("scout_status") + ": 
 
 

"); + private final JLabel jlRating = new JLabel(TranslationFacility.tr("Unbestimmt") + ": 0.0"); + private final JLabel jlStatus = new JLabel("

" + TranslationFacility.tr("scout_status") + ": 
 
 

"); private final JTextArea jtaCopyPaste = new JTextArea(5, 20); private final JTextArea jtaNotes = new JTextArea(5, 20); private final JTextField jtfAge = new JTextField("17.0"); @@ -95,7 +71,7 @@ class MiniScoutDialog extends JFrame implements ItemListener, ActionListener, Fo * @param owner the parent control holding this dialog */ MiniScoutDialog(TransferEingabePanel owner) { - super(HOVerwaltung.instance().getLanguageString("ScoutMini")); + super(TranslationFacility.tr("ScoutMini")); this.setIconImage(HOMainFrame.instance().getIconImage()); clOwner = owner; initComponents(); @@ -253,8 +229,8 @@ private void copyPaste() { } } catch (Exception e) { HOLogger.instance().debug(getClass(), e); - message = core.model.HOVerwaltung.instance().getLanguageString("scout_error"); - message += "
" + HOVerwaltung.instance().getLanguageString("bug_ticket"); + message = TranslationFacility.tr("scout_error"); + message += "
" + TranslationFacility.tr("bug_ticket"); } jtaCopyPaste.setText(""); @@ -262,29 +238,29 @@ private void copyPaste() { if (message.isEmpty()) { switch (pc.getStatus()) { case PlayerConverter.WARNING -> { - message = HOVerwaltung.instance().getLanguageString("scout_warning"); + message = TranslationFacility.tr("scout_warning"); message += " " + getFieldsTextList(pc.getErrorFields()); - message += "
" + HOVerwaltung.instance().getLanguageString("bug_ticket"); + message += "
" + TranslationFacility.tr("bug_ticket"); if (!pc.getNotSupportedFields().isEmpty()) { - message += "
" + HOVerwaltung.instance().getLanguageString("scout_not_supported_fields"); + message += "
" + TranslationFacility.tr("scout_not_supported_fields"); message += " " + getFieldsTextList(pc.getNotSupportedFields()); } } case PlayerConverter.ERROR -> { - message = HOVerwaltung.instance().getLanguageString("scout_error"); - message += "
" + HOVerwaltung.instance().getLanguageString("bug_ticket"); + message = TranslationFacility.tr("scout_error"); + message += "
" + TranslationFacility.tr("bug_ticket"); } - case PlayerConverter.EMPTY_INPUT_ERROR -> message = HOVerwaltung.instance().getLanguageString("scout_error_input_empty"); + case PlayerConverter.EMPTY_INPUT_ERROR -> message = TranslationFacility.tr("scout_error_input_empty"); default -> { - message = HOVerwaltung.instance().getLanguageString("scout_success"); + message = TranslationFacility.tr("scout_success"); if (!pc.getNotSupportedFields().isEmpty()) { - message += "
" + HOVerwaltung.instance().getLanguageString("scout_not_supported_fields"); + message += "
" + TranslationFacility.tr("scout_not_supported_fields"); message += " " + getFieldsTextList(pc.getNotSupportedFields()); } } } } - jlStatus.setText("

" + HOVerwaltung.instance().getLanguageString("scout_status") + ": " + message + "

"); + jlStatus.setText("

" + TranslationFacility.tr("scout_status") + ": " + message + "

"); } private String getFieldsTextList(List fields){ @@ -376,41 +352,41 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(new GridLayout(13, 4, 4, 4)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.id")); + label = new JLabel(TranslationFacility.tr("ls.player.id")); panel.add(label); jtfPlayerID.setHorizontalAlignment(SwingConstants.RIGHT); jtfPlayerID.addFocusListener(this); panel.add(jtfPlayerID); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.name")); + label = new JLabel(TranslationFacility.tr("ls.player.name")); panel.add(label); jtfName.addFocusListener(this); panel.add(jtfName); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.age")); + label = new JLabel(TranslationFacility.tr("ls.player.age")); panel.add(label); jtfAge.setHorizontalAlignment(SwingConstants.RIGHT); jtfAge.addFocusListener(this); panel.add(jtfAge); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.tsi")); + label = new JLabel(TranslationFacility.tr("ls.player.tsi")); panel.add(label); jtfTSI.setHorizontalAlignment(SwingConstants.RIGHT); jtfTSI.addFocusListener(this); panel.add(jtfTSI); - label = new JLabel(HOVerwaltung.instance().getLanguageString("scout_price")); + label = new JLabel(TranslationFacility.tr("scout_price")); panel.add(label); jtfPrice.setHorizontalAlignment(SwingConstants.RIGHT); jtfPrice.addFocusListener(this); panel.add(jtfPrice); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Ablaufdatum")); + label = new JLabel(TranslationFacility.tr("Ablaufdatum")); panel.add(label); jsSpinner.addFocusListener(this); panel.add(jsSpinner); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.speciality")); + label = new JLabel(TranslationFacility.tr("ls.player.speciality")); panel.add(label); jcbSpeciality.addItemListener(this); panel.add(jcbSpeciality); @@ -419,67 +395,67 @@ private void initComponents() { panel.add(label); panel.add(jtfEPV); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.leadership")); + label = new JLabel(TranslationFacility.tr("ls.player.leadership")); panel.add(label); jcbLeadership.addItemListener(this); panel.add(jcbLeadership); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.experience")); + label = new JLabel(TranslationFacility.tr("ls.player.experience")); panel.add(label); jcbExperience.addItemListener(this); panel.add(jcbExperience); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.form")); + label = new JLabel(TranslationFacility.tr("ls.player.form")); panel.add(label); jcbForm.addItemListener(this); panel.add(jcbForm); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.stamina")); panel.add(label); jcbStamina.addItemListener(this); panel.add(jcbStamina); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.keeper")); panel.add(label); jcbKeeper.addItemListener(this); panel.add(jcbKeeper); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.playmaking")); panel.add(label); jcbPlaymaking.addItemListener(this); panel.add(jcbPlaymaking); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.passing")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.passing")); panel.add(label); jcbPassing.addItemListener(this); panel.add(jcbPassing); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.winger")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.winger")); panel.add(label); jcbWinger.addItemListener(this); panel.add(jcbWinger); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.defending")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.defending")); panel.add(label); jcbDefense.addItemListener(this); panel.add(jcbDefense); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.scoring")); panel.add(label); jcbAttacking.addItemListener(this); panel.add(jcbAttacking); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.setpieces")); panel.add(label); jcbStandards.addItemListener(this); panel.add(jcbStandards); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.loyalty")); + label = new JLabel(TranslationFacility.tr("ls.player.loyalty")); panel.add(label); jcbLoyalty.addItemListener(this); panel.add(jcbLoyalty); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.motherclub")); + label = new JLabel(TranslationFacility.tr("ls.player.motherclub")); panel.add(label); jchHomegrown.addItemListener(this); panel.add(jchHomegrown); @@ -492,7 +468,7 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(new GridLayout(1, 3, 4, 4)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("BestePosition") + label = new JLabel(TranslationFacility.tr("BestePosition") + ":"); label.setFont(new Font(label.getFont().getName(), Font.BOLD, label.getFont().getSize() + 2)); label.setHorizontalAlignment(SwingConstants.CENTER); @@ -512,7 +488,7 @@ private void initComponents() { // Notes panel = new ImagePanel(); panel.setLayout(new BorderLayout()); - panel.setBorder(javax.swing.BorderFactory.createTitledBorder(HOVerwaltung.instance().getLanguageString("Notizen"))); + panel.setBorder(javax.swing.BorderFactory.createTitledBorder(TranslationFacility.tr("Notizen"))); panel.add(new JScrollPane(jtaNotes), BorderLayout.CENTER); constraints.fill = GridBagConstraints.BOTH; @@ -525,12 +501,12 @@ private void initComponents() { // Copy & Paste panel = new ImagePanel(); panel.setLayout(new BorderLayout()); - panel.setBorder(javax.swing.BorderFactory.createTitledBorder(HOVerwaltung.instance().getLanguageString("CopyPaste"))); - jtaCopyPaste.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_CopyPaste")); + panel.setBorder(javax.swing.BorderFactory.createTitledBorder(TranslationFacility.tr("CopyPaste"))); + jtaCopyPaste.setToolTipText(TranslationFacility.tr("tt_Transferscout_CopyPaste")); copyPastePanel = new ImagePanel(); copyPastePanel.setLayout(new BorderLayout()); - jlExplainGuide = new JLabel(HOVerwaltung.instance().getLanguageString("ExplainHowToUseTransferScout")); + jlExplainGuide = new JLabel(TranslationFacility.tr("ExplainHowToUseTransferScout")); copyPastePanel.add(jlExplainGuide ,BorderLayout.NORTH); JLabel linkLabel = new HyperLinkLabel("https://github.com/ho-dev/HattrickOrganizer/wiki/Transfer-Scout", "https://github.com/ho-dev/HattrickOrganizer/wiki/Transfer-Scout"); copyPastePanel.add(linkLabel, BorderLayout.CENTER); @@ -539,7 +515,7 @@ private void initComponents() { buttonPanel = new ImagePanel(); buttonPanel.setLayout(new GridLayout(1,2)); - jbApplyScout.setToolTipText(HOVerwaltung.instance().getLanguageString("ls.button.apply")); + jbApplyScout.setToolTipText(TranslationFacility.tr("ls.button.apply")); jbApplyScout.addActionListener(this); layout.setConstraints(jbApplyScout, constraints); buttonPanel.add(jbApplyScout, BorderLayout.WEST); @@ -558,10 +534,10 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(new GridLayout(1, 2, 4, 4)); - jbApply.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_uebernehmen")); + jbApply.setToolTipText(TranslationFacility.tr("tt_Transferscout_uebernehmen")); jbApply.addActionListener(this); panel.add(jbApply); - jbCancel.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_abbrechen")); + jbCancel.setToolTipText(TranslationFacility.tr("tt_Transferscout_abbrechen")); jbCancel.addActionListener(this); panel.add(jbCancel); diff --git a/src/main/java/module/transfer/scout/Player.java b/src/main/java/module/transfer/scout/Player.java index f731e7ed8..45c1ab0a4 100644 --- a/src/main/java/module/transfer/scout/Player.java +++ b/src/main/java/module/transfer/scout/Player.java @@ -1,5 +1,6 @@ // %3800124443:de.hattrickorganizer.gui.transferscout% package module.transfer.scout; +import core.model.TranslationFacility; import core.util.HODateTime; /** @@ -200,7 +201,7 @@ public final String getInfo() { String info = ""; if (getInjury() > 0) { - final String tmp = core.model.HOVerwaltung.instance().getLanguageString("scout_injury"); + final String tmp = TranslationFacility.tr("scout_injury"); info = info + tmp.replaceAll("%weeks%", String.valueOf(getInjury())) + "\r\n"; } diff --git a/src/main/java/module/transfer/scout/PlayerConverter.java b/src/main/java/module/transfer/scout/PlayerConverter.java index a9a2f20b3..ee68746f1 100644 --- a/src/main/java/module/transfer/scout/PlayerConverter.java +++ b/src/main/java/module/transfer/scout/PlayerConverter.java @@ -3,6 +3,7 @@ import core.constants.player.PlayerSpeciality; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HODateTime; import core.util.HOLogger; @@ -66,27 +67,27 @@ public PlayerConverter() { try{ // Get all skills for active language // This should be the same language as in Hattrick - skills.add(homodel.getLanguageString("ls.player.skill.value.non-existent").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.disastrous").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.wretched").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.poor").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.weak").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.inadequate").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.passable").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.solid").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.excellent").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.formidable").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.outstanding").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.brilliant").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.magnificent").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.worldclass").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.supernatural").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.titanic").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.extra-terrestrial").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.mythical").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.magical").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.utopian").toLowerCase(Locale.ENGLISH)); - skills.add(homodel.getLanguageString("ls.player.skill.value.divine").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.non-existent").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.disastrous").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.wretched").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.poor").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.weak").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.inadequate").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.passable").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.solid").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.excellent").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.formidable").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.outstanding").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.brilliant").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.magnificent").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.worldclass").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.supernatural").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.titanic").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.extra-terrestrial").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.mythical").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.magical").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.utopian").toLowerCase(Locale.ENGLISH)); + skills.add(TranslationFacility.tr("ls.player.skill.value.divine").toLowerCase(Locale.ENGLISH)); for (int k = 0; k < skills.size(); k++) { skillvalues.add(k); @@ -116,13 +117,13 @@ public PlayerConverter() { // Get all specialities for active language // This should be the same language as in Hattrick specialities.add(""); // No speciality - specialities.add(homodel.getLanguageString("ls.player.speciality.technical").toLowerCase(Locale.ENGLISH)); - specialities.add(homodel.getLanguageString("ls.player.speciality.quick").toLowerCase(Locale.ENGLISH)); - specialities.add(homodel.getLanguageString("ls.player.speciality.powerful").toLowerCase(Locale.ENGLISH)); - specialities.add(homodel.getLanguageString("ls.player.speciality.unpredictable").toLowerCase(Locale.ENGLISH)); - specialities.add(homodel.getLanguageString("ls.player.speciality.head").toLowerCase(Locale.ENGLISH)); - specialities.add(homodel.getLanguageString("ls.player.speciality.regainer").toLowerCase(Locale.ENGLISH)); - specialities.add(homodel.getLanguageString("ls.player.speciality.support").toLowerCase(Locale.ENGLISH)); + specialities.add(TranslationFacility.tr("ls.player.speciality.technical").toLowerCase(Locale.ENGLISH)); + specialities.add(TranslationFacility.tr("ls.player.speciality.quick").toLowerCase(Locale.ENGLISH)); + specialities.add(TranslationFacility.tr("ls.player.speciality.powerful").toLowerCase(Locale.ENGLISH)); + specialities.add(TranslationFacility.tr("ls.player.speciality.unpredictable").toLowerCase(Locale.ENGLISH)); + specialities.add(TranslationFacility.tr("ls.player.speciality.head").toLowerCase(Locale.ENGLISH)); + specialities.add(TranslationFacility.tr("ls.player.speciality.regainer").toLowerCase(Locale.ENGLISH)); + specialities.add(TranslationFacility.tr("ls.player.speciality.support").toLowerCase(Locale.ENGLISH)); for (int i = 0; i=0) { + if (!TranslationFacility.tr("ls.player.motherclub.bonus").isEmpty() && row.indexOf(TranslationFacility.tr("ls.player.motherclub.bonus").toLowerCase(java.util.Locale.ENGLISH))>=0) { player.setHomeGrown(true); - }else if (!HOVerwaltung.instance().getLanguageString("ls.player.motherclub").isEmpty() && row.indexOf(HOVerwaltung.instance().getLanguageString("ls.player.motherclub").toLowerCase(java.util.Locale.ENGLISH))>=0) { + }else if (!TranslationFacility.tr("ls.player.motherclub").isEmpty() && row.indexOf(TranslationFacility.tr("ls.player.motherclub").toLowerCase(java.util.Locale.ENGLISH))>=0) { player.setHomeGrown(true); } */ @@ -402,7 +403,7 @@ public final Player buildHTCopyButton(String text) { if (!txtTmp.toString().isEmpty()) { player.setTSI(Integer.parseInt(txtTmp.toString())); } else { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.tsi")); + addErrorField(TranslationFacility.tr("ls.player.tsi")); } sc.close(); @@ -442,7 +443,7 @@ public final Player buildHTCopyButton(String text) { if (!txtTmp.toString().isEmpty()) { player.setBooked(row.trim()); } else { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.warningstatus")); + addErrorField(TranslationFacility.tr("ls.player.warningstatus")); } // Injure row = rows.get(indexRowInjure); @@ -482,7 +483,7 @@ public final Player buildHTCopyButton(String text) { if (!txtTmp.toString().isEmpty()) { player.setForm(Integer.parseInt(txtTmp.toString())); } else { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.form")); + addErrorField(TranslationFacility.tr("ls.player.form")); } txtTmp = new StringBuilder(); findValue = false; @@ -500,20 +501,20 @@ public final Player buildHTCopyButton(String text) { if (!txtTmp.toString().isEmpty()) { player.setStamina(Integer.parseInt(txtTmp.toString())); } else { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina")); + addErrorField(TranslationFacility.tr("ls.player.skill.stamina")); } // scan skills row = rows.get(indexRowSkills); sc = new Scanner(row); sc.useDelimiter(""); - player.setGoalKeeping(scanSkill(sc, HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper"))); - player.setDefense(scanSkill(sc, HOVerwaltung.instance().getLanguageString("ls.player.skill.defending"))); - player.setPlayMaking(scanSkill(sc, HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking"))); - player.setWing(scanSkill(sc, HOVerwaltung.instance().getLanguageString("ls.player.skill.winger"))); - player.setPassing(scanSkill(sc, HOVerwaltung.instance().getLanguageString("ls.player.skill.passing"))); - player.setAttack(scanSkill(sc, HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring"))); - player.setSetPieces(scanSkill(sc, HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces"))); + player.setGoalKeeping(scanSkill(sc, TranslationFacility.tr("ls.player.skill.keeper"))); + player.setDefense(scanSkill(sc, TranslationFacility.tr("ls.player.skill.defending"))); + player.setPlayMaking(scanSkill(sc, TranslationFacility.tr("ls.player.skill.playmaking"))); + player.setWing(scanSkill(sc, TranslationFacility.tr("ls.player.skill.winger"))); + player.setPassing(scanSkill(sc, TranslationFacility.tr("ls.player.skill.passing"))); + player.setAttack(scanSkill(sc, TranslationFacility.tr("ls.player.skill.scoring"))); + player.setSetPieces(scanSkill(sc, TranslationFacility.tr("ls.player.skill.setpieces"))); if ( rows.size() > indexRowDeadline) { // scan deadline @@ -730,7 +731,7 @@ public final Player buildClassicPage(String text) { if (!age.isEmpty()) { player.setAge(Integer.parseInt(age)); } else { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.age")); + addErrorField(TranslationFacility.tr("ls.player.age")); } //-- get ageDays @@ -767,7 +768,7 @@ public final Player buildClassicPage(String text) { if (!ageDays.isEmpty()) { player.setAgeDays(Integer.parseInt(ageDays)); } else { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.age.days")); + addErrorField(TranslationFacility.tr("ls.player.age.days")); } // clean lines till here @@ -823,7 +824,7 @@ public final Player buildClassicPage(String text) { if (!tsi.toString().isEmpty()) { player.setTSI(Integer.parseInt(tsi.toString())); } else { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.tsi")); + addErrorField(TranslationFacility.tr("ls.player.tsi")); } // -- check for line wage / season (since FoxTrick 0.4.8.2) @@ -965,7 +966,7 @@ public final Player buildClassicPage(String text) { player.setExpiryDate(parseLocalDateTime(new SimpleDateFormat("dd.MM.yyyy").format(new Date()), new SimpleDateFormat("HH:mm").format(new Date()))); if (status == 0) { - addErrorField(HOVerwaltung.instance().getLanguageString("Ablaufdatum")); + addErrorField(TranslationFacility.tr("Ablaufdatum")); } } @@ -1019,7 +1020,7 @@ public final Player buildClassicPage(String text) { } if ((foundskills.size() < 11) && (status == 0)) { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.skill")); + addErrorField(TranslationFacility.tr("ls.player.skill")); } // Sort skills by location @@ -1055,7 +1056,7 @@ public final Player buildClassicPage(String text) { setSkillsBarStyle(player, foundskills); } } catch (Exception e) { - addErrorField(HOVerwaltung.instance().getLanguageString("ls.player.skill")); + addErrorField(TranslationFacility.tr("ls.player.skill")); } // We can search the speciality in text now diff --git a/src/main/java/module/transfer/scout/TransferEingabePanel.java b/src/main/java/module/transfer/scout/TransferEingabePanel.java index 0119f1c24..20f14cf98 100644 --- a/src/main/java/module/transfer/scout/TransferEingabePanel.java +++ b/src/main/java/module/transfer/scout/TransferEingabePanel.java @@ -10,6 +10,7 @@ import core.gui.comp.entry.DoubleLabelEntries; import core.gui.comp.panel.ImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; @@ -18,22 +19,14 @@ import core.util.HOLogger; import core.util.Helper; +import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; +import java.awt.event.*; import java.io.Serial; import java.util.Calendar; import java.util.Date; import java.util.List; -import javax.swing.*; - import static core.model.player.IMatchRoleID.*; import static core.util.Helper.formatCurrency; import static core.util.Helper.parseCurrency; @@ -76,12 +69,12 @@ public class TransferEingabePanel extends ImagePanel implements ItemListener, Ac private final DoubleLabelEntries jpRatingForwardTowardsWing = new DoubleLabelEntries(ColorLabelEntry.BG_PLAYERSSUBPOSITIONVALUES); private final DoubleLabelEntries jpRatingForwardDefensive = new DoubleLabelEntries(ColorLabelEntry.BG_PLAYERSSUBPOSITIONVALUES); private final DoubleLabelEntries jpRatingKeeper = new DoubleLabelEntries(ColorLabelEntry.BG_PLAYERSPOSITIONVALUES); - private final JButton jbAddTempSpieler = new JButton(HOVerwaltung.instance().getLanguageString("AddTempspieler")); - private final JButton jbRemove = new JButton(HOVerwaltung.instance().getLanguageString("ScoutEntfernen")); - private final JButton jbAdd = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.add")); - private final JButton jbMiniScout = new JButton(HOVerwaltung.instance().getLanguageString("ScoutMini")); - private final JButton jbApply = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.apply")); - private final JButton jbRemoveAll = new JButton(HOVerwaltung.instance().getLanguageString("Scout.RemoveAll")); + private final JButton jbAddTempSpieler = new JButton(TranslationFacility.tr("AddTempspieler")); + private final JButton jbRemove = new JButton(TranslationFacility.tr("ScoutEntfernen")); + private final JButton jbAdd = new JButton(TranslationFacility.tr("ls.button.add")); + private final JButton jbMiniScout = new JButton(TranslationFacility.tr("ScoutMini")); + private final JButton jbApply = new JButton(TranslationFacility.tr("ls.button.apply")); + private final JButton jbRemoveAll = new JButton(TranslationFacility.tr("Scout.RemoveAll")); private final JComboBox jcbExperience = new JComboBox(PlayerAbility.ITEMS); private final JComboBox jcbWinger = new JComboBox(PlayerAbility.ITEMS); private final JComboBox jcbForm = new JComboBox(Helper.EINSTUFUNG_FORM); @@ -96,7 +89,7 @@ public class TransferEingabePanel extends ImagePanel implements ItemListener, Ac private final JComboBox jcbLoyalty = new JComboBox(PlayerAbility.ITEMS); private final JComboBox jcbLeadership = new JComboBox(PlayerAbility.ITEMS); private final JCheckBox jchHomegrown = new JCheckBox(); - private final JLabel jlStatus = new JLabel("

" + HOVerwaltung.instance().getLanguageString("scout_status") + ":

"); + private final JLabel jlStatus = new JLabel("

" + TranslationFacility.tr("scout_status") + ":

"); private final JTextArea jtaCopyPaste = new JTextArea(5, 20); private final JTextArea jtaNotes = new JTextArea(); private final JTextField jtfAge = new JTextField("17.0"); @@ -144,18 +137,18 @@ public final void setScoutEintrag(ScoutEintrag scoutEintrag) { // If scout entry already exists if (clOwner.getTransferTable().getTransferTableModel() .getScoutEintrag(clScoutEntry.getPlayerID()) != null) { - jbAdd.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_ersetzen")); - jbAdd.setText(HOVerwaltung.instance().getLanguageString("ScoutErsetzen")); + jbAdd.setToolTipText(TranslationFacility.tr("tt_Transferscout_ersetzen")); + jbAdd.setText(TranslationFacility.tr("ScoutErsetzen")); jbRemove.setEnabled(true); } else { - jbAdd.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_hinzufuegen")); - jbAdd.setText(HOVerwaltung.instance().getLanguageString("ls.button.add")); + jbAdd.setToolTipText(TranslationFacility.tr("tt_Transferscout_hinzufuegen")); + jbAdd.setText(TranslationFacility.tr("ls.button.add")); jbRemove.setEnabled(false); } jbAdd.setEnabled(true); } else { clScoutEntry = new ScoutEintrag(); - jbAdd.setText(HOVerwaltung.instance().getLanguageString("ls.button.add")); + jbAdd.setText(TranslationFacility.tr("ls.button.add")); jbRemove.setEnabled(false); jbAdd.setEnabled(false); } @@ -459,11 +452,11 @@ private void checkFields() { if (valid && (clOwner.getTransferTable().getTransferTableModel().getScoutEintrag(id) != null)) { jbAdd.setEnabled(true); - jbAdd.setText(HOVerwaltung.instance().getLanguageString("ScoutErsetzen")); + jbAdd.setText(TranslationFacility.tr("ScoutErsetzen")); jbRemove.setEnabled(true); } else { jbAdd.setEnabled(true); - jbAdd.setText(HOVerwaltung.instance().getLanguageString("ls.button.add")); + jbAdd.setText(TranslationFacility.tr("ls.button.add")); jbRemove.setEnabled(false); } } @@ -545,8 +538,8 @@ private void copyPaste() { } } catch (Exception e) { HOLogger.instance().debug(getClass(), e); - message = HOVerwaltung.instance().getLanguageString("scout_error"); - message += "
" + HOVerwaltung.instance().getLanguageString("bug_ticket"); + message = TranslationFacility.tr("scout_error"); + message += "
" + TranslationFacility.tr("bug_ticket"); } jtaCopyPaste.setText(""); @@ -554,29 +547,29 @@ private void copyPaste() { if (message.isEmpty()) { switch (pc.getStatus()) { case PlayerConverter.WARNING -> { - message = HOVerwaltung.instance().getLanguageString("scout_warning"); + message = TranslationFacility.tr("scout_warning"); message += " " + getFieldsTextList(pc.getErrorFields()); - message += "
" + HOVerwaltung.instance().getLanguageString("bug_ticket"); + message += "
" + TranslationFacility.tr("bug_ticket"); if (!pc.getNotSupportedFields().isEmpty()) { - message += "
" + HOVerwaltung.instance().getLanguageString("scout_not_supported_fields"); + message += "
" + TranslationFacility.tr("scout_not_supported_fields"); message += " " + getFieldsTextList(pc.getNotSupportedFields()); } } case PlayerConverter.ERROR -> { - message = HOVerwaltung.instance().getLanguageString("scout_error"); - message += "
" + HOVerwaltung.instance().getLanguageString("bug_ticket"); + message = TranslationFacility.tr("scout_error"); + message += "
" + TranslationFacility.tr("bug_ticket"); } - case PlayerConverter.EMPTY_INPUT_ERROR -> message = HOVerwaltung.instance().getLanguageString("scout_error_input_empty"); + case PlayerConverter.EMPTY_INPUT_ERROR -> message = TranslationFacility.tr("scout_error_input_empty"); default -> { - message = HOVerwaltung.instance().getLanguageString("scout_success"); + message = TranslationFacility.tr("scout_success"); if (!pc.getNotSupportedFields().isEmpty()) { - message += "
" + HOVerwaltung.instance().getLanguageString("scout_not_supported_fields"); + message += "
" + TranslationFacility.tr("scout_not_supported_fields"); message += " " + getFieldsTextList(pc.getNotSupportedFields()); } } } } - jlStatus.setText("

" + HOVerwaltung.instance().getLanguageString("scout_status") + ": " + message + "

"); + jlStatus.setText("

" + TranslationFacility.tr("scout_status") + ": " + message + "

"); } private String getFieldsTextList(List fields){ @@ -617,31 +610,31 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(new GridLayout(11, 4, 4, 4)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.id")); + label = new JLabel(TranslationFacility.tr("ls.player.id")); panel.add(label); jtfPlayerID.setHorizontalAlignment(JLabel.RIGHT); jtfPlayerID.addFocusListener(this); jtfPlayerID.addKeyListener(this); panel.add(jtfPlayerID); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.name")); + label = new JLabel(TranslationFacility.tr("ls.player.name")); panel.add(label); jtfName.addFocusListener(this); panel.add(jtfName); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.age")); + label = new JLabel(TranslationFacility.tr("ls.player.age")); panel.add(label); jtfAge.setHorizontalAlignment(JLabel.RIGHT); jtfAge.addFocusListener(this); panel.add(jtfAge); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.tsi")); + label = new JLabel(TranslationFacility.tr("ls.player.tsi")); panel.add(label); jtfTSI.setHorizontalAlignment(JLabel.RIGHT); jtfTSI.addFocusListener(this); panel.add(jtfTSI); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.wage")); + label = new JLabel(TranslationFacility.tr("ls.player.wage")); panel.add(label); jtfWage.setHorizontalAlignment(JLabel.RIGHT); jtfWage.addFocusListener(this); @@ -649,83 +642,83 @@ private void initComponents() { - label = new JLabel(HOVerwaltung.instance().getLanguageString("scout_price")); + label = new JLabel(TranslationFacility.tr("scout_price")); panel.add(label); jtfPrice.setHorizontalAlignment(JLabel.RIGHT); jtfPrice.addFocusListener(this); panel.add(jtfPrice); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.speciality")); + label = new JLabel(TranslationFacility.tr("ls.player.speciality")); panel.add(label); jcbSpeciality.addItemListener(this); panel.add(jcbSpeciality); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Ablaufdatum")); + label = new JLabel(TranslationFacility.tr("Ablaufdatum")); panel.add(label); jsSpinner.addFocusListener(this); panel.add(jsSpinner); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.leadership")); + label = new JLabel(TranslationFacility.tr("ls.player.leadership")); panel.add(label); jcbLeadership.addItemListener(this); panel.add(jcbLeadership); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.experience")); + label = new JLabel(TranslationFacility.tr("ls.player.experience")); panel.add(label); jcbExperience.addItemListener(this); panel.add(jcbExperience); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.form")); + label = new JLabel(TranslationFacility.tr("ls.player.form")); panel.add(label); jcbForm.addItemListener(this); panel.add(jcbForm); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.stamina")); panel.add(label); jcbStamina.addItemListener(this); panel.add(jcbStamina); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.keeper")); panel.add(label); jcbKeeper.addItemListener(this); panel.add(jcbKeeper); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.playmaking")); panel.add(label); jcbPlaymaking.addItemListener(this); panel.add(jcbPlaymaking); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.passing")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.passing")); panel.add(label); jcbPassing.addItemListener(this); panel.add(jcbPassing); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.winger")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.winger")); panel.add(label); jcbWinger.addItemListener(this); panel.add(jcbWinger); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.defending")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.defending")); panel.add(label); jcbDefending.addItemListener(this); panel.add(jcbDefending); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.scoring")); panel.add(label); jcbScoring.addItemListener(this); panel.add(jcbScoring); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces")); + label = new JLabel(TranslationFacility.tr("ls.player.skill.setpieces")); panel.add(label); jcbSetPieces.addItemListener(this); panel.add(jcbSetPieces); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.loyalty")); + label = new JLabel(TranslationFacility.tr("ls.player.loyalty")); panel.add(label); jcbLoyalty.addItemListener(this); panel.add(jcbLoyalty); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.motherclub")); + label = new JLabel(TranslationFacility.tr("ls.player.motherclub")); panel.add(label); jchHomegrown.addItemListener(this); panel.add(jchHomegrown); @@ -739,7 +732,7 @@ private void initComponents() { // Notes panel = new ImagePanel(); panel.setLayout(new BorderLayout()); - panel.setBorder(javax.swing.BorderFactory.createTitledBorder(HOVerwaltung.instance().getLanguageString("Notizen"))); + panel.setBorder(javax.swing.BorderFactory.createTitledBorder(TranslationFacility.tr("Notizen"))); jtaNotes.addFocusListener(this); panel.add(new JScrollPane(jtaNotes), BorderLayout.CENTER); @@ -753,12 +746,12 @@ private void initComponents() { // Copy & Paste panel = new ImagePanel(); panel.setLayout(new BorderLayout()); - panel.setBorder(javax.swing.BorderFactory.createTitledBorder(HOVerwaltung.instance().getLanguageString("CopyPaste"))); - jtaCopyPaste.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_CopyPaste")); + panel.setBorder(javax.swing.BorderFactory.createTitledBorder(TranslationFacility.tr("CopyPaste"))); + jtaCopyPaste.setToolTipText(TranslationFacility.tr("tt_Transferscout_CopyPaste")); copyPastePanel = new ImagePanel(); copyPastePanel.setLayout(new BorderLayout()); - jlExplainGuide = new JLabel(HOVerwaltung.instance().getLanguageString("ExplainHowToUseTransferScout")); + jlExplainGuide = new JLabel(TranslationFacility.tr("ExplainHowToUseTransferScout")); copyPastePanel.add(jlExplainGuide ,BorderLayout.NORTH); JLabel linkLabel = new HyperLinkLabel("https://github.com/ho-dev/HattrickOrganizer/wiki/Transfer-Scout", "https://github.com/ho-dev/HattrickOrganizer/wiki/Transfer-Scout"); copyPastePanel.add(linkLabel, BorderLayout.CENTER); @@ -767,7 +760,7 @@ private void initComponents() { buttonPanel = new ImagePanel(); buttonPanel.setLayout(new GridLayout(1,2)); - jbApply.setToolTipText(HOVerwaltung.instance().getLanguageString("ls.button.apply")); + jbApply.setToolTipText(TranslationFacility.tr("ls.button.apply")); jbApply.addActionListener(this); layout.setConstraints(jbApply, constraints); buttonPanel.add(jbApply, BorderLayout.WEST); @@ -788,83 +781,83 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(new GridLayout(20, 2, 4, 4)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("BestePosition")); + label = new JLabel(TranslationFacility.tr("BestePosition")); panel.add(label); panel.add(jpBestPosition.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.keeper")); + label = new JLabel(TranslationFacility.tr("ls.player.position.keeper")); panel.add(label); panel.add(jpRatingKeeper.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.centraldefender")); + label = new JLabel(TranslationFacility.tr("ls.player.position.centraldefender")); panel.add(label); panel.add(jpRatingDefender.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.centraldefendertowardswing")); + label = new JLabel(TranslationFacility.tr("ls.player.position.centraldefendertowardswing")); panel.add(label); panel.add(jpRatingDefenderTowardsWing.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.centraldefenderoffensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.centraldefenderoffensive")); panel.add(label); panel.add(jpRatingDefenderOffensive.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.wingback")); + label = new JLabel(TranslationFacility.tr("ls.player.position.wingback")); panel.add(label); panel.add(jpRatingWingback.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.wingbacktowardsmiddle")); + label = new JLabel(TranslationFacility.tr("ls.player.position.wingbacktowardsmiddle")); panel.add(label); panel.add(jpRatingWingbackTowardsMiddle.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.wingbackoffensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.wingbackoffensive")); panel.add(label); panel.add(jpRatingWingbackOffensive.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.wingbackdefensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.wingbackdefensive")); panel.add(label); panel.add(jpRatingWingbackDefensive.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfielder")); + label = new JLabel(TranslationFacility.tr("ls.player.position.innermidfielder")); panel.add(label); panel.add(jpRatingMidfielder.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfieldertowardswing")); + label = new JLabel(TranslationFacility.tr("ls.player.position.innermidfieldertowardswing")); panel.add(label); panel.add(jpRatingMidfielderTowardsWing.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfielderoffensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.innermidfielderoffensive")); panel.add(label); panel.add(jpRatingMidfielderOffensive.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfielderdefensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.innermidfielderdefensive")); panel.add(label); panel.add(jpRatingMidfielderDefensive.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.winger")); + label = new JLabel(TranslationFacility.tr("ls.player.position.winger")); panel.add(label); panel.add(jpRatingWinger.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.wingertowardsmiddle")); + label = new JLabel(TranslationFacility.tr("ls.player.position.wingertowardsmiddle")); panel.add(label); panel.add(jpRatingWingerTowardsMiddle.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.wingeroffensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.wingeroffensive")); panel.add(label); panel.add(jpRatingWingerOffensive.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.wingerdefensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.wingerdefensive")); panel.add(label); panel.add(jpRatingWingerDefensive.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.forward")); + label = new JLabel(TranslationFacility.tr("ls.player.position.forward")); panel.add(label); panel.add(jpRatingForward.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.forwardtowardswing")); + label = new JLabel(TranslationFacility.tr("ls.player.position.forwardtowardswing")); panel.add(label); panel.add(jpRatingForwardTowardsWing.getComponent(false)); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.player.position.forwarddefensive")); + label = new JLabel(TranslationFacility.tr("ls.player.position.forwarddefensive")); panel.add(label); panel.add(jpRatingForwardDefensive.getComponent(false)); @@ -879,20 +872,20 @@ private void initComponents() { panel = new ImagePanel(); panel.setLayout(new GridLayout(6, 1, 4, 4)); - jbAdd.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_hinzufuegen")); + jbAdd.setToolTipText(TranslationFacility.tr("tt_Transferscout_hinzufuegen")); jbAdd.addActionListener(this); panel.add(jbAdd); - jbRemove.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_entfernen")); + jbRemove.setToolTipText(TranslationFacility.tr("tt_Transferscout_entfernen")); jbRemove.addActionListener(this); jbRemove.setEnabled(false); panel.add(jbRemove); jbRemoveAll.addActionListener(this); - jbRemoveAll.setToolTipText(HOVerwaltung.instance().getLanguageString("Scout.tt_RemoveAll")); + jbRemoveAll.setToolTipText(TranslationFacility.tr("Scout.tt_RemoveAll")); panel.add(jbRemoveAll); - jbMiniScout.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_Transferscout_Miniscout")); + jbMiniScout.setToolTipText(TranslationFacility.tr("tt_Transferscout_Miniscout")); jbMiniScout.addActionListener(this); panel.add(jbMiniScout); - jbAddTempSpieler.setToolTipText(HOVerwaltung.instance().getLanguageString("tt_add_tempspieler")); + jbAddTempSpieler.setToolTipText(TranslationFacility.tr("tt_add_tempspieler")); jbAddTempSpieler.addActionListener(this); panel.add(jbAddTempSpieler); diff --git a/src/main/java/module/transfer/scout/TransferTableModel.java b/src/main/java/module/transfer/scout/TransferTableModel.java index 456e7399e..09f78cb9c 100644 --- a/src/main/java/module/transfer/scout/TransferTableModel.java +++ b/src/main/java/module/transfer/scout/TransferTableModel.java @@ -4,18 +4,18 @@ import core.gui.comp.entry.HomegrownEntry; import core.gui.comp.entry.PlayerLabelEntry; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.IMatchRoleID; import core.model.player.MatchRoleID; import core.model.player.Player; import core.util.Helper; +import javax.swing.*; +import javax.swing.table.AbstractTableModel; import java.io.Serial; import java.util.Objects; import java.util.Vector; -import javax.swing.JLabel; -import javax.swing.SwingConstants; -import javax.swing.table.AbstractTableModel; import static core.model.player.IMatchRoleID.*; @@ -35,87 +35,87 @@ public class TransferTableModel extends AbstractTableModel { */ public String[] m_sToolTipStrings = { - HOVerwaltung.instance().getLanguageString("ls.player.id"), + TranslationFacility.tr("ls.player.id"), //Name - HOVerwaltung.instance().getLanguageString("ls.player.name"), + TranslationFacility.tr("ls.player.name"), //Current price - HOVerwaltung.instance().getLanguageString("scout_price"), + TranslationFacility.tr("scout_price"), //Ablaufdatum - HOVerwaltung.instance().getLanguageString("Ablaufdatum"), + TranslationFacility.tr("Ablaufdatum"), //Beste Position - HOVerwaltung.instance().getLanguageString("BestePosition"), + TranslationFacility.tr("BestePosition"), //Age - HOVerwaltung.instance().getLanguageString("ls.player.age"), + TranslationFacility.tr("ls.player.age"), //TSI - HOVerwaltung.instance().getLanguageString("ls.player.tsi"), + TranslationFacility.tr("ls.player.tsi"), // Homegrown - HOVerwaltung.instance().getLanguageString("ls.player.motherclub"), + TranslationFacility.tr("ls.player.motherclub"), //Leadership - HOVerwaltung.instance().getLanguageString("ls.player.leadership"), + TranslationFacility.tr("ls.player.leadership"), //Erfahrung - HOVerwaltung.instance().getLanguageString("ls.player.experience"), + TranslationFacility.tr("ls.player.experience"), //Form - HOVerwaltung.instance().getLanguageString("ls.player.form"), + TranslationFacility.tr("ls.player.form"), //Kondition - HOVerwaltung.instance().getLanguageString("ls.player.skill.stamina"), + TranslationFacility.tr("ls.player.skill.stamina"), //Loyalty - HOVerwaltung.instance().getLanguageString("ls.player.loyalty"), + TranslationFacility.tr("ls.player.loyalty"), //Torwart - HOVerwaltung.instance().getLanguageString("ls.player.skill.keeper"), + TranslationFacility.tr("ls.player.skill.keeper"), //Verteidigung - HOVerwaltung.instance().getLanguageString("ls.player.skill.defending"), + TranslationFacility.tr("ls.player.skill.defending"), //Spielaufbau - HOVerwaltung.instance().getLanguageString("ls.player.skill.playmaking"), + TranslationFacility.tr("ls.player.skill.playmaking"), //Passpiel - HOVerwaltung.instance().getLanguageString("ls.player.skill.passing"), + TranslationFacility.tr("ls.player.skill.passing"), //Flügelspiel - HOVerwaltung.instance().getLanguageString("ls.player.skill.winger"), + TranslationFacility.tr("ls.player.skill.winger"), //Torschuss - HOVerwaltung.instance().getLanguageString("ls.player.skill.scoring"), + TranslationFacility.tr("ls.player.skill.scoring"), //Standards - HOVerwaltung.instance().getLanguageString("ls.player.skill.setpieces"), + TranslationFacility.tr("ls.player.skill.setpieces"), //Torwart - HOVerwaltung.instance().getLanguageString("ls.player.position.keeper"), + TranslationFacility.tr("ls.player.position.keeper"), //Innenverteidiger - HOVerwaltung.instance().getLanguageString("ls.player.position.centraldefender"), + TranslationFacility.tr("ls.player.position.centraldefender"), //Innenverteidiger Nach Aussen - HOVerwaltung.instance().getLanguageString("ls.player.position.centraldefendertowardswing"), + TranslationFacility.tr("ls.player.position.centraldefendertowardswing"), //Innenverteidiger Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.centraldefenderoffensive"), + TranslationFacility.tr("ls.player.position.centraldefenderoffensive"), //Aussenverteidiger - HOVerwaltung.instance().getLanguageString("ls.player.position.wingback"), + TranslationFacility.tr("ls.player.position.wingback"), //Aussenverteidiger Nach Innen - HOVerwaltung.instance().getLanguageString("ls.player.position.wingbacktowardsmiddle"), + TranslationFacility.tr("ls.player.position.wingbacktowardsmiddle"), //Aussenverteidiger Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.wingbackoffensive"), + TranslationFacility.tr("ls.player.position.wingbackoffensive"), //Aussenverteidiger Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.wingbackdefensive"), + TranslationFacility.tr("ls.player.position.wingbackdefensive"), //Mittelfeld - HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfielder"), + TranslationFacility.tr("ls.player.position.innermidfielder"), //Mittelfeld Nach Aussen - HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfieldertowardswing"), + TranslationFacility.tr("ls.player.position.innermidfieldertowardswing"), //Mittelfeld Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfielderoffensive"), + TranslationFacility.tr("ls.player.position.innermidfielderoffensive"), //Mittelfeld Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.innermidfielderdefensive"), + TranslationFacility.tr("ls.player.position.innermidfielderdefensive"), //Flügel - HOVerwaltung.instance().getLanguageString("ls.player.position.winger"), + TranslationFacility.tr("ls.player.position.winger"), //Flügel Nach Innen - HOVerwaltung.instance().getLanguageString("ls.player.position.wingertowardsmiddle"), + TranslationFacility.tr("ls.player.position.wingertowardsmiddle"), //Flügel Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.wingeroffensive"), + TranslationFacility.tr("ls.player.position.wingeroffensive"), //Flügel Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.wingerdefensive"), + TranslationFacility.tr("ls.player.position.wingerdefensive"), //Sturm - HOVerwaltung.instance().getLanguageString("ls.player.position.forward"), + TranslationFacility.tr("ls.player.position.forward"), //Sturm Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position.forwarddefensive"), + TranslationFacility.tr("ls.player.position.forwarddefensive"), //Sturm Nach Aussen - HOVerwaltung.instance().getLanguageString("ls.player.position.forwardtowardswing"), + TranslationFacility.tr("ls.player.position.forwardtowardswing"), //Notes - HOVerwaltung.instance().getLanguageString("Notizen"), + TranslationFacility.tr("Notizen"), //Notes - HOVerwaltung.instance().getLanguageString("ls.player.wage") + TranslationFacility.tr("ls.player.wage") }; protected Object[][] m_clData; @@ -125,88 +125,88 @@ public class TransferTableModel extends AbstractTableModel { */ protected String[] m_sColumnNames = { - HOVerwaltung.instance().getLanguageString("ls.player.id"), + TranslationFacility.tr("ls.player.id"), //Name - HOVerwaltung.instance().getLanguageString("ls.player.name"), + TranslationFacility.tr("ls.player.name"), //Current price - HOVerwaltung.instance().getLanguageString("scout_price"), + TranslationFacility.tr("scout_price"), //Ablaufdatum - HOVerwaltung.instance().getLanguageString("Ablaufdatum"), + TranslationFacility.tr("Ablaufdatum"), //Beste Position - HOVerwaltung.instance().getLanguageString("BestePosition"), + TranslationFacility.tr("BestePosition"), //Age - HOVerwaltung.instance().getLanguageString("ls.player.age"), + TranslationFacility.tr("ls.player.age"), //TSI - HOVerwaltung.instance().getLanguageString("ls.player.tsi"), + TranslationFacility.tr("ls.player.tsi"), // Homegrown - HOVerwaltung.instance().getLanguageString("ls.player.short_motherclub"), + TranslationFacility.tr("ls.player.short_motherclub"), //Leadership - HOVerwaltung.instance().getLanguageString("ls.player.leadership"), + TranslationFacility.tr("ls.player.leadership"), //Erfahrung - HOVerwaltung.instance().getLanguageString("ls.player.short_experience"), + TranslationFacility.tr("ls.player.short_experience"), //Form - HOVerwaltung.instance().getLanguageString("ls.player.short_form"), + TranslationFacility.tr("ls.player.short_form"), //Kondition - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.stamina"), + TranslationFacility.tr("ls.player.skill_short.stamina"), // Loyalty - HOVerwaltung.instance().getLanguageString("ls.player.short_loyalty"), + TranslationFacility.tr("ls.player.short_loyalty"), //Torwart - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.keeper"), + TranslationFacility.tr("ls.player.skill_short.keeper"), //Verteidigung - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.defending"), + TranslationFacility.tr("ls.player.skill_short.defending"), //Spielaufbau - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.playmaking"), + TranslationFacility.tr("ls.player.skill_short.playmaking"), //Passpiel - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.passing"), + TranslationFacility.tr("ls.player.skill_short.passing"), //Flügelspiel - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.winger"), + TranslationFacility.tr("ls.player.skill_short.winger"), //Torschuss - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.scoring"), + TranslationFacility.tr("ls.player.skill_short.scoring"), //Standards - HOVerwaltung.instance().getLanguageString("ls.player.skill_short.setpieces"), + TranslationFacility.tr("ls.player.skill_short.setpieces"), //Torwart - HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper"), + TranslationFacility.tr("ls.player.position_short.keeper"), //Innenverteidiger - HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender"), + TranslationFacility.tr("ls.player.position_short.centraldefender"), //Innenverteidiger Nach Aussen - HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefendertowardswing"), + TranslationFacility.tr("ls.player.position_short.centraldefendertowardswing"), //Innenverteidiger Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefenderoffensive"), + TranslationFacility.tr("ls.player.position_short.centraldefenderoffensive"), //Aussenverteidiger - HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback"), + TranslationFacility.tr("ls.player.position_short.wingback"), //Aussenverteidiger Zur Mitte - HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbacktowardsmiddle"), + TranslationFacility.tr("ls.player.position_short.wingbacktowardsmiddle"), //Aussenverteidiger Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackoffensive"), + TranslationFacility.tr("ls.player.position_short.wingbackoffensive"), //Aussenverteidiger Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackdefensive"), + TranslationFacility.tr("ls.player.position_short.wingbackdefensive"), //Mittelfeld - HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder"), + TranslationFacility.tr("ls.player.position_short.innermidfielder"), //Mittelfeld Nach Aussen - HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfieldertowardswing"), + TranslationFacility.tr("ls.player.position_short.innermidfieldertowardswing"), //Mittelfeld Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderoffensive"), + TranslationFacility.tr("ls.player.position_short.innermidfielderoffensive"), //Mittelfeld Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderdefensive"), + TranslationFacility.tr("ls.player.position_short.innermidfielderdefensive"), //Flügel - HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger"), + TranslationFacility.tr("ls.player.position_short.winger"), //Flügel Nach Innen - HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingertowardsmiddle"), + TranslationFacility.tr("ls.player.position_short.wingertowardsmiddle"), //Flügel Offensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingeroffensive"), + TranslationFacility.tr("ls.player.position_short.wingeroffensive"), //Flügel Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingerdefensive"), + TranslationFacility.tr("ls.player.position_short.wingerdefensive"), //Sturm - HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward"), + TranslationFacility.tr("ls.player.position_short.forward"), //Sturm Defensiv - HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwarddefensive"), + TranslationFacility.tr("ls.player.position_short.forwarddefensive"), //Sturm Nach Aussen - HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwardtowardswing"), + TranslationFacility.tr("ls.player.position_short.forwardtowardswing"), //Notes - HOVerwaltung.instance().getLanguageString("Notizen"), + TranslationFacility.tr("Notizen"), //Notes - HOVerwaltung.instance().getLanguageString("ls.player.wage") + TranslationFacility.tr("ls.player.wage") }; private Vector m_vScoutEintraege; diff --git a/src/main/java/module/transfer/scout/Wecker.java b/src/main/java/module/transfer/scout/Wecker.java index c728caa3a..3f7a9925f 100644 --- a/src/main/java/module/transfer/scout/Wecker.java +++ b/src/main/java/module/transfer/scout/Wecker.java @@ -1,10 +1,9 @@ package module.transfer.scout; import core.gui.HOMainFrame; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import javax.swing.JButton; -import javax.swing.JTextArea; +import javax.swing.*; /** * @author thomas.werth @@ -25,11 +24,11 @@ class Wecker extends javax.swing.JFrame implements java.awt.event.ActionListener ta.setEditable(false); ta.setText(text); - m_jbOK.setText(HOVerwaltung.instance().getLanguageString("ls.button.ok")); + m_jbOK.setText(TranslationFacility.tr("ls.button.ok")); m_jbOK.addActionListener(this); setDefaultCloseOperation(DISPOSE_ON_CLOSE); - setTitle(HOVerwaltung.instance().getLanguageString("TransferScout")); + setTitle(TranslationFacility.tr("TransferScout")); this.setIconImage(HOMainFrame.instance().getIconImage()); //this.setContentPane(temp); diff --git a/src/main/java/module/transfer/transfertype/TransferTypePane.java b/src/main/java/module/transfer/transfertype/TransferTypePane.java index 91fc0e49f..6f8fb2b1e 100644 --- a/src/main/java/module/transfer/transfertype/TransferTypePane.java +++ b/src/main/java/module/transfer/transfertype/TransferTypePane.java @@ -4,6 +4,7 @@ import core.db.DBManager; import core.gui.comp.panel.ImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.player.Player; import core.util.CurrencyUtils; @@ -184,7 +185,7 @@ public final void refresh(List transfers) { c.col2 = c.col1; c.hAlign = TableLayoutConstants.LEFT; - final JLabel type = new JLabel(HOVerwaltung.instance().getLanguageString("Type")); + final JLabel type = new JLabel(TranslationFacility.tr("Type")); type.setFont(new Font(type.getFont().getName(), Font.BOLD, type.getFont().getSize())); this.sidePanel.add(type, c); @@ -193,7 +194,7 @@ public final void refresh(List transfers) { c.col2 = c.col1; c.hAlign = TableLayoutConstants.LEFT; - final JLabel income = new JLabel(HOVerwaltung.instance().getLanguageString("Income")); + final JLabel income = new JLabel(TranslationFacility.tr("Income")); income.setFont(new Font(income.getFont().getName(), Font.BOLD, income.getFont().getSize())); this.sidePanel.add(income, c); @@ -241,7 +242,7 @@ public final void refresh(List transfers) { c.col2 = c.col1; c.hAlign = TableLayoutConstants.CENTER; - final JLabel total = new JLabel(HOVerwaltung.instance().getLanguageString("Total")); + final JLabel total = new JLabel(TranslationFacility.tr("Total")); total.setFont(new Font(total.getFont().getName(), Font.BOLD, total.getFont().getSize())); this.sidePanel.add(total, c); diff --git a/src/main/java/module/transfer/transfertype/TransferTypeTableModel.java b/src/main/java/module/transfer/transfertype/TransferTypeTableModel.java index d619f9d79..061dc85fe 100644 --- a/src/main/java/module/transfer/transfertype/TransferTypeTableModel.java +++ b/src/main/java/module/transfer/transfertype/TransferTypeTableModel.java @@ -2,14 +2,13 @@ package module.transfer.transfertype; import core.db.DBManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import module.transfer.TransferType; +import javax.swing.table.AbstractTableModel; import java.io.Serial; import java.util.List; -import javax.swing.table.AbstractTableModel; - /** @@ -38,12 +37,12 @@ class TransferTypeTableModel extends AbstractTableModel { TransferTypeTableModel(List values) { super(); - this.colNames[0] = HOVerwaltung.instance().getLanguageString("ls.player.id"); - this.colNames[1] = HOVerwaltung.instance().getLanguageString("ls.player.name"); - this.colNames[2] = HOVerwaltung.instance().getLanguageString("Type"); - this.colNames[3] = HOVerwaltung.instance().getLanguageString("Income"); + this.colNames[0] = TranslationFacility.tr("ls.player.id"); + this.colNames[1] = TranslationFacility.tr("ls.player.name"); + this.colNames[2] = TranslationFacility.tr("Type"); + this.colNames[3] = TranslationFacility.tr("Income"); - //this.colNames[2] = HOVerwaltung.instance().getLanguageString("Week"); //$NON-NLS-1$ + //this.colNames[2] = TranslationFacility.tr("Week"); //$NON-NLS-1$ this.values = values; } diff --git a/src/main/java/module/tsforecast/ForecastCurve.java b/src/main/java/module/tsforecast/ForecastCurve.java index df6fee8ba..dd2bf2dec 100644 --- a/src/main/java/module/tsforecast/ForecastCurve.java +++ b/src/main/java/module/tsforecast/ForecastCurve.java @@ -22,19 +22,21 @@ import core.db.DBManager; import core.model.HOVerwaltung; -import core.model.match.IMatchDetails; +import core.model.TranslationFacility; import core.model.enums.MatchType; +import core.model.match.IMatchDetails; import core.model.match.MatchKurzInfo; import core.model.misc.Basics; import core.model.series.Liga; import core.util.HODateTime; -import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Timestamp; import java.text.DateFormat; import java.time.temporal.ChronoUnit; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Properties; import static java.lang.Integer.parseInt; @@ -207,8 +209,7 @@ private void readFutureMatches() throws SQLException { IMatchDetails.EINSTELLUNG_NORMAL, ibasics.getSpieltag() + s, MatchType.QUALIFICATION); - point.m_strTooltip = HOVerwaltung - .instance().getLanguageString( + point.m_strTooltip = TranslationFacility.tr( "ls.match.matchtype.qualification"); } default -> { @@ -217,8 +218,7 @@ private void readFutureMatches() throws SQLException { ibasics.getSpieltag() + s, MatchType.LEAGUE); point.m_strTooltip = (ibasics.getSpieltag() + s) + ". " - + HOVerwaltung.instance() - .getLanguageString( + + TranslationFacility.tr( "ls.match.matchtype.league"); } } @@ -232,7 +232,7 @@ private void readFutureMatches() throws SQLException { ibasics.getSpieltag() + s, MatchType.CUP); point.m_strTooltip = (ibasics.getSpieltag() + s) + ". " - + HOVerwaltung.instance().getLanguageString( + + TranslationFacility.tr( "ls.match.matchtype.cup"); m_clPoints.add(point); addUpdatePoints(point); diff --git a/src/main/java/module/tsforecast/FutureMatchBox.java b/src/main/java/module/tsforecast/FutureMatchBox.java index 4211580d6..0b26b6d0d 100644 --- a/src/main/java/module/tsforecast/FutureMatchBox.java +++ b/src/main/java/module/tsforecast/FutureMatchBox.java @@ -20,19 +20,14 @@ import core.gui.comp.panel.ImagePanel; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; -import core.model.match.IMatchDetails; +import core.model.TranslationFacility; import core.model.enums.MatchType; +import core.model.match.IMatchDetails; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionListener; -import javax.swing.ButtonGroup; -import javax.swing.JLabel; -import javax.swing.JRadioButton; -import javax.swing.SwingConstants; - final class FutureMatchBox extends ImagePanel { private static final long serialVersionUID = 1L; @@ -43,16 +38,16 @@ final class FutureMatchBox extends ImagePanel { public FutureMatchBox(String text, String tooltip, int iCmd, int iSelected, MatchType iType) { m_rbPIC = new JRadioButton(); m_rbPIC.setActionCommand("P" + iCmd); - m_rbPIC.setToolTipText(HOVerwaltung.instance().getLanguageString("ls.team.teamattitude.playitcool")); + m_rbPIC.setToolTipText(TranslationFacility.tr("ls.team.teamattitude.playitcool")); m_rbNORM = new JRadioButton(); m_rbNORM.setActionCommand("N" + iCmd); - m_rbNORM.setToolTipText(HOVerwaltung.instance().getLanguageString( + m_rbNORM.setToolTipText(TranslationFacility.tr( "ls.team.teamattitude.normal")); m_rbMOTS = new JRadioButton(); m_rbMOTS.setActionCommand("M" + iCmd); - m_rbMOTS.setToolTipText(HOVerwaltung.instance().getLanguageString( + m_rbMOTS.setToolTipText(TranslationFacility.tr( "ls.team.teamattitude.matchoftheseason")); ButtonGroup buttongroup = new ButtonGroup(); diff --git a/src/main/java/module/tsforecast/TSForecast.java b/src/main/java/module/tsforecast/TSForecast.java index 564f9d11d..0701a5fde 100644 --- a/src/main/java/module/tsforecast/TSForecast.java +++ b/src/main/java/module/tsforecast/TSForecast.java @@ -4,29 +4,21 @@ import core.gui.comp.panel.ImagePanel; import core.gui.comp.panel.LazyImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; +import core.model.enums.MatchType; import core.model.match.IMatchDetails; import core.model.match.MatchKurzInfo; -import core.model.enums.MatchType; import core.module.config.ModuleConfig; import core.util.HOLogger; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.math.BigDecimal; -import javax.swing.BoxLayout; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; - public class TSForecast extends LazyImagePanel implements ActionListener, ItemListener { private final DBManager dbManager; @@ -240,16 +232,16 @@ public void itemStateChanged(ItemEvent itemevent) { private void createSettingsPanel(JPanel jpanel) { ModuleConfig config = ModuleConfig.instance(); - m_jtCupMatches = new JCheckBox(HOVerwaltung.instance().getLanguageString("CupMatches"), + m_jtCupMatches = new JCheckBox(TranslationFacility.tr("CupMatches"), config.getBoolean(TS_SHOWCUPMATCHES)); - m_jtCupMatches.setToolTipText(HOVerwaltung.instance().getLanguageString("ShowCupMatches")); + m_jtCupMatches.setToolTipText(TranslationFacility.tr("ShowCupMatches")); m_jtCupMatches.setAlignmentX(0.0F); m_jtCupMatches.addItemListener(this); jpanel.add(m_jtCupMatches); - m_jtRelegationMatch = new JCheckBox(HOVerwaltung.instance().getLanguageString( + m_jtRelegationMatch = new JCheckBox(TranslationFacility.tr( "ls.match.matchtype.qualification"), config.getBoolean(TS_SHOWQUALIFICATIONMATCH)); - m_jtRelegationMatch.setToolTipText(HOVerwaltung.instance().getLanguageString("ShowQMatch")); + m_jtRelegationMatch.setToolTipText(TranslationFacility.tr("ShowQMatch")); m_jtRelegationMatch.setAlignmentX(0.0F); m_jtRelegationMatch.addItemListener(this); jpanel.add(m_jtRelegationMatch); @@ -263,25 +255,25 @@ private void createCurvesPanel(JPanel jpanel) { throw new RuntimeException(e); } - m_jtHistory = new CheckBox(HOVerwaltung.instance().getLanguageString("ls.team.teamspirit"), + m_jtHistory = new CheckBox(TranslationFacility.tr("ls.team.teamspirit"), m_History.getColor(), config.getBoolean(TS_HISTORY)); m_jtHistory.setAlignmentX(0.0F); m_jtHistory.addItemListener(this); jpanel.add(m_jtHistory); - m_jtConfidence = new CheckBox(HOVerwaltung.instance().getLanguageString( + m_jtConfidence = new CheckBox(TranslationFacility.tr( "ls.team.confidence"), m_Confidence.getColor(), config.getBoolean(TS_CONFIDENCE)); m_jtConfidence.setAlignmentX(0.0F); m_jtConfidence.addItemListener(this); jpanel.add(m_jtConfidence); - m_jtLoepiHist = new CheckBox(HOVerwaltung.instance().getLanguageString("LoepiCurve"), + m_jtLoepiHist = new CheckBox(TranslationFacility.tr("LoepiCurve"), m_LoepiHist.getColor(), config.getBoolean(TS_LOEPIHISTORY)); m_jtLoepiHist.setAlignmentX(0.0F); m_jtLoepiHist.addItemListener(this); jpanel.add(m_jtLoepiHist); - m_jtLoepiFore = new CheckBox(HOVerwaltung.instance().getLanguageString("TSForecast"), + m_jtLoepiFore = new CheckBox(TranslationFacility.tr("TSForecast"), m_LoepiForecast.getColor(), config.getBoolean(TS_LOEPIFORECAST)); m_jtLoepiFore.setAlignmentX(0.0F); m_jtLoepiFore.addItemListener(this); @@ -329,7 +321,7 @@ private void createGamesPanel(JPanel jpanel) { gridbagconstraints.gridy++; m_jpGamesPanel.add( new JLabel(" " - + HOVerwaltung.instance().getLanguageString("EndOFSeason")), + + TranslationFacility.tr("EndOFSeason")), gridbagconstraints); } } diff --git a/src/main/java/module/tsforecast/TSForecastModule.java b/src/main/java/module/tsforecast/TSForecastModule.java index 549f48072..127d80d2a 100644 --- a/src/main/java/module/tsforecast/TSForecastModule.java +++ b/src/main/java/module/tsforecast/TSForecastModule.java @@ -1,13 +1,11 @@ package module.tsforecast; -import java.awt.event.KeyEvent; - import core.db.DBManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; -import javax.swing.JPanel; -import javax.swing.KeyStroke; +import javax.swing.*; +import java.awt.event.KeyEvent; public final class TSForecastModule extends DefaultModule { @@ -18,7 +16,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("Tab_TSForecast"); + return TranslationFacility.tr("Tab_TSForecast"); } @Override diff --git a/src/main/java/module/tsforecast/TSPanel.java b/src/main/java/module/tsforecast/TSPanel.java index 270e886d9..f6361c874 100644 --- a/src/main/java/module/tsforecast/TSPanel.java +++ b/src/main/java/module/tsforecast/TSPanel.java @@ -32,18 +32,13 @@ import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.match.IMatchDetails; import core.util.HODateTime; -import core.util.HelperWrapper; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.awt.RenderingHints; + +import javax.swing.*; +import java.awt.*; import java.awt.font.FontRenderContext; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; @@ -53,8 +48,6 @@ import java.util.ArrayList; import java.util.Calendar; -import javax.swing.*; - class TSPanel extends JPanel { @@ -201,7 +194,7 @@ private void drawIndicators( Graphics2D graphics2d, Curve curve) { graphics2d.drawImage(ImageUtilities.getImageIcon4Change(-1, true).getImage(), (int) (xCoord * m_dFactor + (double) m_iCoordX0), (m_iMaxY + 10) - 2 - yCoord, ImageUtilities.getImageIcon4Change(-1, true).getImageObserver()); - graphics2d.drawString(HOVerwaltung.instance().getLanguageString("trainer_down"), + graphics2d.drawString(TranslationFacility.tr("trainer_down"), (int) (xCoord * m_dFactor + (double) m_iCoordX0), (m_iMaxY + 10) - 2 - yCoord - 2); graphics2d.drawString(PlayerAbility.getNameForSkill((int) curve.getSpirit(), true), (int) (xCoord * m_dFactor + (double) m_iCoordX0), ((m_iMaxY + 10) - 2 - yCoord) + 24); @@ -210,7 +203,7 @@ private void drawIndicators( Graphics2D graphics2d, Curve curve) { graphics2d.drawImage(ImageUtilities.iconToImage(m_newImage), (int) (xCoord * m_dFactor + (double) m_iCoordX0), (m_iMaxY + 10) - 2 - yCoord, ((ImageIcon) m_newImage).getImageObserver()); - graphics2d.drawString(HOVerwaltung.instance().getLanguageString("trainer_exchange"), + graphics2d.drawString(TranslationFacility.tr("trainer_exchange"), (int) (xCoord * m_dFactor + (double) m_iCoordX0), (m_iMaxY + 10) - 2 - yCoord - 2); graphics2d.drawString(PlayerAbility.getNameForSkill((int) curve.getSpirit(), true), (int) (xCoord * m_dFactor + (double) m_iCoordX0), ((m_iMaxY + 10) - 2 - yCoord) + 24); @@ -219,7 +212,7 @@ private void drawIndicators( Graphics2D graphics2d, Curve curve) { graphics2d.drawImage(ImageUtilities.iconToImage(m_startImage), (int) (xCoord * m_dFactor + (double) m_iCoordX0), (m_iMaxY + 10) - 2 - yCoord, ((ImageIcon) m_startImage).getImageObserver()); - graphics2d.drawString(HOVerwaltung.instance().getLanguageString("ls.team.coachingskill"), + graphics2d.drawString(TranslationFacility.tr("ls.team.coachingskill"), (int) (xCoord * m_dFactor + (double) m_iCoordX0), (m_iMaxY + 10) - 2 - yCoord - 2); graphics2d.drawString(PlayerAbility.getNameForSkill((int) curve.getSpirit(), true), (int) (xCoord * m_dFactor + (double) m_iCoordX0), ((m_iMaxY + 10) - 2 - yCoord) + 24); @@ -311,7 +304,7 @@ private void drawSeason( Graphics2D graphics2d) { graphics2d.setColor( lightBlue); graphics2d.fillRect( iXX2, DYFrame, iXX3-iXX2, m_iMaxY); graphics2d.setColor(ThemeManager.getColor(HOColorName.TSFORECAST_ALT_COLOR)); - graphics2d.drawString( HOVerwaltung.instance().getLanguageString( "Season") + " " + iSeason, + graphics2d.drawString( TranslationFacility.tr( "Season") + " " + iSeason, iXX2 + (iXX3-iXX2)/2, iYText); // previous seasons @@ -321,7 +314,7 @@ private void drawSeason( Graphics2D graphics2d) { // season -1 graphics2d.fillRect( iXX1, DYFrame, iXX2-iXX1, m_iMaxY); graphics2d.setColor( darkGreen); - graphics2d.drawString( HOVerwaltung.instance().getLanguageString("Season") + " " + (iSeason - 1), + graphics2d.drawString( TranslationFacility.tr("Season") + " " + (iSeason - 1), iXX1 + (iXX2-iXX1)/2, iYText); // season -2 graphics2d.setColor( lightYellow); @@ -330,7 +323,7 @@ private void drawSeason( Graphics2D graphics2d) { // season -1 graphics2d.fillRect( iXX1, DYFrame, iXX2-iXX1, m_iMaxY); graphics2d.setColor( darkGreen); - graphics2d.drawString( HOVerwaltung.instance().getLanguageString("Season") + " " + (iSeason - 1), + graphics2d.drawString( TranslationFacility.tr("Season") + " " + (iSeason - 1), iXX1 + (iXX2-iXX1)/2, iYText); } } diff --git a/src/main/java/module/youth/YouthModule.java b/src/main/java/module/youth/YouthModule.java index 0845141e9..1bb3db5fe 100644 --- a/src/main/java/module/youth/YouthModule.java +++ b/src/main/java/module/youth/YouthModule.java @@ -1,6 +1,6 @@ package module.youth; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.DefaultModule; import javax.swing.*; @@ -20,7 +20,7 @@ public int getModuleId() { @Override public String getDescription() { - return HOVerwaltung.instance().getLanguageString("ls.youth"); + return TranslationFacility.tr("ls.youth"); } @Override diff --git a/src/main/java/module/youth/YouthPanel.java b/src/main/java/module/youth/YouthPanel.java index e309f026d..dab22b83e 100644 --- a/src/main/java/module/youth/YouthPanel.java +++ b/src/main/java/module/youth/YouthPanel.java @@ -1,7 +1,6 @@ package module.youth; -import core.model.HOVerwaltung; -import core.module.config.ModuleConfig; +import core.model.TranslationFacility; import javax.swing.*; import java.awt.*; @@ -15,9 +14,9 @@ public YouthPanel() { setLayout(new BorderLayout()); youthPlayerView = new YouthPlayerView(); var tabbedPane = new JTabbedPane(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("ls.youth.player"), this.youthPlayerView); + tabbedPane.addTab(TranslationFacility.tr("ls.youth.player"), this.youthPlayerView); youthTrainingView = new YouthTrainingView(); - tabbedPane.addTab(HOVerwaltung.instance().getLanguageString("ls.youth.training"), this.youthTrainingView); + tabbedPane.addTab(TranslationFacility.tr("ls.youth.training"), this.youthTrainingView); add(tabbedPane, BorderLayout.CENTER); } diff --git a/src/main/java/module/youth/YouthPlayer.java b/src/main/java/module/youth/YouthPlayer.java index 0fe54096b..016a08090 100644 --- a/src/main/java/module/youth/YouthPlayer.java +++ b/src/main/java/module/youth/YouthPlayer.java @@ -4,15 +4,18 @@ import core.db.AbstractTable; import core.db.DBManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.CommentType; import core.model.player.Specialty; import core.util.HODateTime; import core.util.HOLogger; import module.training.Skills.ScoutCommentSkillTypeID; + import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.*; + import static java.lang.Math.max; import static java.lang.Math.min; @@ -675,7 +678,7 @@ public double adjustSkill(PlayerSkill skillID, double adjustment, HODateTime bef public String getSpecialtyString() { this.getTrainingDevelopment(); // may add specialties from highlights if (this.specialty != Specialty.NoSpecialty) { - return HOVerwaltung.instance().getLanguageString("ls.player.speciality." + this.specialty.toString().toLowerCase()); + return TranslationFacility.tr("ls.player.speciality." + this.specialty.toString().toLowerCase()); } return ""; } diff --git a/src/main/java/module/youth/YouthPlayerView.java b/src/main/java/module/youth/YouthPlayerView.java index 0b59fba75..671399766 100644 --- a/src/main/java/module/youth/YouthPlayerView.java +++ b/src/main/java/module/youth/YouthPlayerView.java @@ -7,11 +7,13 @@ import core.gui.comp.renderer.HODefaultTableCellRenderer; import core.gui.model.UserColumnController; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.module.config.ModuleConfig; import core.util.Helper; import core.util.chart.HOLinesChart; import core.util.chart.LinesChartDataModel; import module.statistics.Colors; + import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -67,7 +69,7 @@ public YouthPlayerView() { var developmentPanel = new JPanel(new BorderLayout()); var topLinePanel = new JPanel(new BorderLayout()); topLinePanel.add(playerNameLabel, BorderLayout.NORTH); - topLinePanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("ls.youth.player.trainingdevelopment"))); + topLinePanel.add(new JLabel(TranslationFacility.tr("ls.youth.player.trainingdevelopment"))); developmentPanel.add(topLinePanel, BorderLayout.NORTH); developmentPanel.add(new JScrollPane(playerDetailsTable)); split1.setRightComponent(developmentPanel); @@ -84,11 +86,11 @@ public YouthPlayerView() { scoutAndChartPanelConstraints.weighty=0; scoutAndChartPanelConstraints.weightx=1; scoutAndChartPanelConstraints.fill = GridBagConstraints.HORIZONTAL; - scoutAndChartPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("ls.youth.player.scoutcomment")+":"), scoutAndChartPanelConstraints); + scoutAndChartPanel.add(new JLabel(TranslationFacility.tr("ls.youth.player.scoutcomment")+":"), scoutAndChartPanelConstraints); scoutAndChartPanelConstraints.gridy++; scoutAndChartPanel.add(playerScoutCommentField, scoutAndChartPanelConstraints); scoutAndChartPanelConstraints.gridy++; - scoutAndChartPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("ls.youth.player.development")+":"), scoutAndChartPanelConstraints); + scoutAndChartPanel.add(new JLabel(TranslationFacility.tr("ls.youth.player.development")+":"), scoutAndChartPanelConstraints); youthSkillChart = new HOLinesChart(false, "skill", null,null, null, 0., 9. ); var panel = new ImagePanel(); panel.setLayout(new BorderLayout()); @@ -107,7 +109,7 @@ public YouthPlayerView() { skillEditorPanelConstraints.gridy=0; skillEditorPanelConstraints.gridwidth=1; skillEditorPanelConstraints.anchor=GridBagConstraints.WEST; - skillEditorPanel.add(new JLabel(HOVerwaltung.instance().getLanguageString("ls.youth.player.skilleditors")), skillEditorPanelConstraints); + skillEditorPanel.add(new JLabel(TranslationFacility.tr("ls.youth.player.skilleditors")), skillEditorPanelConstraints); for ( int i=0; i" + - hov.getLanguageString("ls.youth.player."+skillName) + "
" + - String.format(hov.getLanguageString("ls.youth.skill.start") + ": %.2f
", this.skillInfo.getStartValue()) + - String.format(hov.getLanguageString("ls.youth.skill.current") + ": %.2f
", this.skillInfo.getCurrentValue()) + - (this.skillInfo.getPotential17Value() != null ? String.format(hov.getLanguageString("ls.youth.skill.17") + ": %.2f
", this.skillInfo.getPotential17Value()) : "") + - hov.getLanguageString("ls.youth.skill.max") + ": " + (this.skillInfo.getMax() != null ? this.skillInfo.getMax() : unknown) + "
" + - (this.skillInfo.isMaxReached() ? hov.getLanguageString("ls.youth.skill.ismaxreached") + "
" : "") + - hov.getLanguageString("ls.youth.skill.startlevel") + ": " + (this.skillInfo.getStartLevel() != null ? this.skillInfo.getStartLevel() : unknown) + "
" + - hov.getLanguageString("ls.youth.skill.currentlevel") + ": " + (this.skillInfo.getCurrentLevel() != null ? this.skillInfo.getCurrentLevel() : unknown) + - (this.skillInfo.isTop3() != null && this.skillInfo.isTop3() ? "
" + hov.getLanguageString("ls.youth.skill.istop3") : "") + + TranslationFacility.tr("ls.youth.player."+skillName) + "
" + + String.format(TranslationFacility.tr("ls.youth.skill.start") + ": %.2f
", this.skillInfo.getStartValue()) + + String.format(TranslationFacility.tr("ls.youth.skill.current") + ": %.2f
", this.skillInfo.getCurrentValue()) + + (this.skillInfo.getPotential17Value() != null ? String.format(TranslationFacility.tr("ls.youth.skill.17") + ": %.2f
", this.skillInfo.getPotential17Value()) : "") + + TranslationFacility.tr("ls.youth.skill.max") + ": " + (this.skillInfo.getMax() != null ? this.skillInfo.getMax() : unknown) + "
" + + (this.skillInfo.isMaxReached() ? TranslationFacility.tr("ls.youth.skill.ismaxreached") + "
" : "") + + TranslationFacility.tr("ls.youth.skill.startlevel") + ": " + (this.skillInfo.getStartLevel() != null ? this.skillInfo.getStartLevel() : unknown) + "
" + + TranslationFacility.tr("ls.youth.skill.currentlevel") + ": " + (this.skillInfo.getCurrentLevel() != null ? this.skillInfo.getCurrentLevel() : unknown) + + (this.skillInfo.isTop3() != null && this.skillInfo.isTop3() ? "
" + TranslationFacility.tr("ls.youth.skill.istop3") : "") + ""; } diff --git a/src/main/java/module/youth/YouthSkillInfoEditor.java b/src/main/java/module/youth/YouthSkillInfoEditor.java index 241dad8f1..920644f56 100644 --- a/src/main/java/module/youth/YouthSkillInfoEditor.java +++ b/src/main/java/module/youth/YouthSkillInfoEditor.java @@ -1,6 +1,7 @@ package module.youth; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; + import javax.swing.*; import javax.swing.border.BevelBorder; import javax.swing.event.ChangeListener; @@ -92,8 +93,8 @@ public void addChangeListener(ChangeListener l){ } private JLabel skillLabel = new JLabel(); - private final SkillInfoSlider skillStartValue = new SkillInfoSlider(HOVerwaltung.instance().getLanguageString("ls.youth.player.skillstartvalue") + ": "); - private final SkillInfoSlider skillCurrentValue = new SkillInfoSlider(HOVerwaltung.instance().getLanguageString("ls.youth.player.skillcurrentvalue") + ": "); + private final SkillInfoSlider skillStartValue = new SkillInfoSlider(TranslationFacility.tr("ls.youth.player.skillstartvalue") + ": "); + private final SkillInfoSlider skillCurrentValue = new SkillInfoSlider(TranslationFacility.tr("ls.youth.player.skillcurrentvalue") + ": "); private ImageIcon getImageIcon4Color(Color color) { final BufferedImage bufferedImage = new BufferedImage(14, 14, BufferedImage.TYPE_INT_ARGB); @@ -119,7 +120,7 @@ public YouthSkillInfoEditor(Color color) { public void setSkillInfo(YouthSkillInfo skillInfo) { this.skillInfo = skillInfo; - skillLabel.setText(HOVerwaltung.instance().getLanguageString("ls.youth.player." + getSkillName(skillInfo.getSkillID())) + ": "); + skillLabel.setText(TranslationFacility.tr("ls.youth.player." + getSkillName(skillInfo.getSkillID())) + ": "); skillStartValue.set(skillInfo, skillInfo.getStartValue(), skillInfo.getStartValueRange()); skillCurrentValue.set(skillInfo, skillInfo.getCurrentValue(), skillInfo.getCurrentValueRange()); } diff --git a/src/main/java/module/youth/YouthTraining.java b/src/main/java/module/youth/YouthTraining.java index 9aebe0b13..318699ff3 100644 --- a/src/main/java/module/youth/YouthTraining.java +++ b/src/main/java/module/youth/YouthTraining.java @@ -4,10 +4,15 @@ import core.db.AbstractTable; import core.db.DBManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.model.enums.MatchType; -import core.model.match.*; +import core.model.match.MatchLineup; +import core.model.match.MatchLineupPosition; +import core.model.match.MatchLineupTeam; +import core.model.match.Matchdetails; import core.util.HODateTime; + import java.util.Map; import java.util.Vector; @@ -222,7 +227,7 @@ public String getPlayerTrainedSectors(int playerId) { var lineupTeam = this.getTeam(hov.getModel().getBasics().getYouthTeamId()); var sectors = lineupTeam.getTrainMinutesPlayedInSectors(playerId); for ( var s : sectors.entrySet()){ - ret.append(hov.getLanguageString("ls.youth.training.sector." + s.getKey())) + ret.append(TranslationFacility.tr("ls.youth.training.sector." + s.getKey())) .append(":") .append(s.getValue()) .append(" "); diff --git a/src/main/java/module/youth/YouthTrainingDevelopmentEntry.java b/src/main/java/module/youth/YouthTrainingDevelopmentEntry.java index 77c632746..142e64232 100644 --- a/src/main/java/module/youth/YouthTrainingDevelopmentEntry.java +++ b/src/main/java/module/youth/YouthTrainingDevelopmentEntry.java @@ -1,9 +1,9 @@ package module.youth; import core.constants.player.PlayerSkill; -import core.model.HOVerwaltung; -import core.model.match.MatchLineupTeam; +import core.model.TranslationFacility; import core.model.enums.MatchType; +import core.model.match.MatchLineupTeam; import core.model.player.Player; import core.model.player.Specialty; import core.util.HODateTime; @@ -229,7 +229,7 @@ public double getRating() { * @return String */ public String getSpecialtyString() { - if ( this.specialty != null ) return HOVerwaltung.instance().getLanguageString("ls.player.speciality." + this.specialty.toString().toLowerCase()); + if ( this.specialty != null ) return TranslationFacility.tr("ls.player.speciality." + this.specialty.toString().toLowerCase()); return ""; } @@ -242,7 +242,7 @@ public void setIsSuspended(boolean suspended) { } public String getSupendedAsString() { - if ( isSuspended ) return HOVerwaltung.instance().getLanguageString("ls.youth.isSuspended"); + if ( isSuspended ) return TranslationFacility.tr("ls.youth.isSuspended"); return ""; } diff --git a/src/main/java/module/youth/YouthTrainingType.java b/src/main/java/module/youth/YouthTrainingType.java index c24cc7815..eb3f29897 100644 --- a/src/main/java/module/youth/YouthTrainingType.java +++ b/src/main/java/module/youth/YouthTrainingType.java @@ -1,10 +1,11 @@ package module.youth; import core.constants.player.PlayerSkill; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.MatchRoleID; import core.training.WeeklyTrainingType; import core.training.type.*; + import java.util.ArrayList; import java.util.List; @@ -61,9 +62,8 @@ public enum YouthTrainingType { } public static String StringValueOf(YouthTrainingType value) { - var hov = HOVerwaltung.instance(); - if ( value == null) return hov.getLanguageString("ls.youth.trainingtype.undefined"); - return hov.getLanguageString("ls.youth.trainingtype."+value._toString()); + if ( value == null) return TranslationFacility.tr("ls.youth.trainingtype.undefined"); + return TranslationFacility.tr("ls.youth.trainingtype."+value._toString()); } private String _toString() { diff --git a/src/main/java/tool/ToolManager.java b/src/main/java/tool/ToolManager.java index 7315c6b37..c3663a49a 100644 --- a/src/main/java/tool/ToolManager.java +++ b/src/main/java/tool/ToolManager.java @@ -2,6 +2,7 @@ import core.gui.HOMainFrame; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import tool.arenasizer.ArenaSizerDialog; import tool.export.CsvPlayerExport; import tool.hrfExplorer.HrfExplorerDialog; @@ -13,14 +14,13 @@ public class ToolManager { - private static final HOVerwaltung m_hov = HOVerwaltung.instance(); - private final JMenu m_jmToolsMenu = new JMenu(m_hov.getLanguageString("ls.menu.tools")); - private final JMenuItem m_jmiInjuryCalculator = new JMenuItem(m_hov.getLanguageString("InjuryCalculator")); - private final JMenuItem m_jmiKeeperTool = new JMenuItem(m_hov.getLanguageString("KeeperTool")); - private final JMenuItem m_jmiNotepad = new JMenuItem(m_hov.getLanguageString("Notizen")); - private final JMenuItem m_jmiCsvPlayerExporter = new JMenuItem(m_hov.getLanguageString("CSVExporter")); - private final JMenuItem m_jmiArenaSizer = new JMenuItem(m_hov.getLanguageString("ArenaSizer")); - private final JMenuItem m_jmiHrfExplorer = new JMenuItem(m_hov.getLanguageString("Tab_HRF-Explorer")); + private final JMenu m_jmToolsMenu = new JMenu(TranslationFacility.tr("ls.menu.tools")); + private final JMenuItem m_jmiInjuryCalculator = new JMenuItem(TranslationFacility.tr("InjuryCalculator")); + private final JMenuItem m_jmiKeeperTool = new JMenuItem(TranslationFacility.tr("KeeperTool")); + private final JMenuItem m_jmiNotepad = new JMenuItem(TranslationFacility.tr("Notizen")); + private final JMenuItem m_jmiCsvPlayerExporter = new JMenuItem(TranslationFacility.tr("CSVExporter")); + private final JMenuItem m_jmiArenaSizer = new JMenuItem(TranslationFacility.tr("ArenaSizer")); + private final JMenuItem m_jmiHrfExplorer = new JMenuItem(TranslationFacility.tr("Tab_HRF-Explorer")); public JMenu getToolMenu() { m_jmiArenaSizer.addActionListener(e -> new ArenaSizerDialog(HOMainFrame.instance()).setVisible(true)); @@ -39,7 +39,7 @@ public JMenu getToolMenu() { m_jmToolsMenu.add(m_jmiCsvPlayerExporter); m_jmiNotepad.addActionListener(e -> { - NotepadDialog notepad = new NotepadDialog(HOMainFrame.instance(), m_hov.getLanguageString("Notizen")); + NotepadDialog notepad = new NotepadDialog(HOMainFrame.instance(), TranslationFacility.tr("Notizen")); notepad.setVisible(true); }); m_jmToolsMenu.add(m_jmiNotepad); diff --git a/src/main/java/tool/arenasizer/ArenaPanel.java b/src/main/java/tool/arenasizer/ArenaPanel.java index 2d63aacb3..61b81cdb6 100644 --- a/src/main/java/tool/arenasizer/ArenaPanel.java +++ b/src/main/java/tool/arenasizer/ArenaPanel.java @@ -7,6 +7,7 @@ import core.gui.comp.renderer.HODefaultTableCellRenderer; import core.model.HOModel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.Helper; import tool.updater.TableModel; @@ -35,8 +36,8 @@ final class ArenaPanel extends JPanel { //Teststadium private Stadium m_clStadium; - private String[] UEBERSCHRIFT = {"", HOVerwaltung.instance().getLanguageString("Aktuell"), HOVerwaltung.instance().getLanguageString("Maximal"), - HOVerwaltung.instance().getLanguageString("Durchschnitt"), HOVerwaltung.instance().getLanguageString("Minimal")}; + private String[] UEBERSCHRIFT = {"", TranslationFacility.tr("Aktuell"), TranslationFacility.tr("Maximal"), + TranslationFacility.tr("Durchschnitt"), TranslationFacility.tr("Minimal")}; private Stadium[] m_clStadien; private IHOTableEntry[][] values; @@ -63,11 +64,10 @@ public void reInit() { private void initTabelle() { //Tablewerte setzen values = new IHOTableEntry[9][5]; - HOVerwaltung hoV = HOVerwaltung.instance(); String[] columnText = {"ls.club.arena.terraces","ls.club.arena.basicseating","ls.club.arena.seatsunderroof","ls.club.arena.seatsinvipboxes","Gesamt","Einnahmen","Unterhalt","Gewinn","Baukosten"}; for (int i = 0; i < columnText.length; i++) { - values[i][0] = new ColorLabelEntry(hoV.getLanguageString(columnText[i]), + values[i][0] = new ColorLabelEntry(TranslationFacility.tr(columnText[i]), ColorLabelEntry.FG_STANDARD, ColorLabelEntry.BG_PLAYERSPOSITIONVALUES, SwingConstants.LEFT); } diff --git a/src/main/java/tool/arenasizer/ArenaSizerDialog.java b/src/main/java/tool/arenasizer/ArenaSizerDialog.java index cf2097163..411aaed07 100644 --- a/src/main/java/tool/arenasizer/ArenaSizerDialog.java +++ b/src/main/java/tool/arenasizer/ArenaSizerDialog.java @@ -1,19 +1,13 @@ package tool.arenasizer; import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; - public class ArenaSizerDialog extends JDialog implements ActionListener { @@ -24,7 +18,7 @@ public class ArenaSizerDialog extends JDialog implements ActionListener { private ArenaPanel infoPanel; private ControlPanel controlPanel; private JPanel toolbar; - private JButton refreshButton = new JButton(HOVerwaltung.instance().getLanguageString("ls.button.apply")); + private JButton refreshButton = new JButton(TranslationFacility.tr("ls.button.apply")); public ArenaSizerDialog(JFrame owner){ super(owner,true); @@ -35,7 +29,7 @@ public ArenaSizerDialog(JFrame owner){ private void initialize() { setSize(900,430); setLayout(new BorderLayout()); - setTitle(HOVerwaltung.instance().getLanguageString("ArenaSizer")); + setTitle(TranslationFacility.tr("ArenaSizer")); add(getToolbar(), BorderLayout.NORTH); JPanel centerPanel = new JPanel(new BorderLayout()); @@ -92,9 +86,9 @@ private JTabbedPane getTabbedPane(){ if(tabbedPane == null){ tabbedPane = new JTabbedPane(); HOVerwaltung hoV = HOVerwaltung.instance(); - tabbedPane.addTab(hoV.getLanguageString("Stadion"), getArenaPanel()); + tabbedPane.addTab(TranslationFacility.tr("Stadion"), getArenaPanel()); tabbedPane.addTab(hoV.getModel().getStadium().getStadienname(), getInfoPanel()); - tabbedPane.addTab(hoV.getLanguageString("Statistik"), getHistoryPanel()); + tabbedPane.addTab(TranslationFacility.tr("Statistik"), getHistoryPanel()); } return tabbedPane; } diff --git a/src/main/java/tool/arenasizer/ControlPanel.java b/src/main/java/tool/arenasizer/ControlPanel.java index 82a10217c..0f183d06a 100644 --- a/src/main/java/tool/arenasizer/ControlPanel.java +++ b/src/main/java/tool/arenasizer/ControlPanel.java @@ -3,31 +3,21 @@ import core.gui.theme.HOColorName; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.HOLogger; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionListener; import java.math.BigDecimal; import java.text.DecimalFormat; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JFormattedTextField; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; - class ControlPanel extends JPanel implements ActionListener{ private static final long serialVersionUID = 1L; private static final BigDecimal HUNDRED = new BigDecimal(100); - private JButton m_jbUbernehmenGesamt = new JButton(HOVerwaltung.instance().getLanguageString("Calculate")); + private JButton m_jbUbernehmenGesamt = new JButton(TranslationFacility.tr("Calculate")); private JTextField m_jtfFans = new JTextField(7); private JTextField m_jtfGesamtgroesse = new JTextField(7); @@ -59,29 +49,29 @@ private void initialize() { setLayout(layout2); JLabel label; - label = new JLabel(HOVerwaltung.instance().getLanguageString("Gesamtgroesse")); + label = new JLabel(TranslationFacility.tr("Gesamtgroesse")); addToLayout(label,0,0); setFieldProperties(m_jtfGesamtgroesse); // m_jtfGesamtgroesse.addFocusListener(this); addToLayout(m_jtfGesamtgroesse, 1, 0); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.club.arena.terraces")); + label = new JLabel(TranslationFacility.tr("ls.club.arena.terraces")); addToLayout(label,2,0); setFieldProperties(terracesPercentField); addToLayout(terracesPercentField,3,0); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.club.arena.basicseating")); + label = new JLabel(TranslationFacility.tr("ls.club.arena.basicseating")); addToLayout(label,4,0); setFieldProperties(basicPercentField); addToLayout(basicPercentField,5,0); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.club.arena.seatsunderroof")); + label = new JLabel(TranslationFacility.tr("ls.club.arena.seatsunderroof")); addToLayout(label,6,0); setFieldProperties(roofPercentField); addToLayout(roofPercentField,7,0); - label = new JLabel(HOVerwaltung.instance().getLanguageString("ls.club.arena.seatsinvipboxes")); + label = new JLabel(TranslationFacility.tr("ls.club.arena.seatsinvipboxes")); addToLayout(label,8,0); setFieldProperties(vipPercentField); addToLayout(vipPercentField,9,0); @@ -100,19 +90,19 @@ private void initialize() { vipField.setHorizontalAlignment(SwingConstants.RIGHT); addToLayout(vipField,9,1); - m_jbUbernehmenGesamt.setToolTipText(HOVerwaltung.instance().getLanguageString("Calculate")); + m_jbUbernehmenGesamt.setToolTipText(TranslationFacility.tr("Calculate")); m_jbUbernehmenGesamt.addActionListener(this); addToLayout (m_jbUbernehmenGesamt,1,1); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Fans")); + label = new JLabel(TranslationFacility.tr("Fans")); addToLayout(label,0,2); m_jtfFans.setHorizontalAlignment(SwingConstants.RIGHT); addToLayout(m_jtfFans,1,2); - label = new JLabel(HOVerwaltung.instance().getLanguageString("Durchschnitt")); + label = new JLabel(TranslationFacility.tr("Durchschnitt")); addToLayout(label,2,2); setFieldProperties(factorNormalField); addToLayout(factorNormalField,3,2); @@ -163,7 +153,7 @@ private void initStadium() { vipPercentField.setValue(ArenaSizer.VIP_PERCENT); factorNormalField.setValue(ArenaSizer.SUPPORTER_NORMAL); - exampleLabel.setText("=> " + fans+" * "+((Number)factorNormalField.getValue()).intValue()+" = "+(fans*((Number)factorNormalField.getValue()).intValue())+" ("+ HOVerwaltung.instance().getLanguageString("Zuschauer")+" )"); + exampleLabel.setText("=> " + fans+" * "+((Number)factorNormalField.getValue()).intValue()+" = "+(fans*((Number)factorNormalField.getValue()).intValue())+" ("+ TranslationFacility.tr("Zuschauer")+" )"); } @@ -203,7 +193,7 @@ int[] getModifiedSupporter(){ supporter[2] = (((Number)factorNormalField.getValue()).intValue()-5) * getSupporter(); // the wrong place for this, only temp playCE - exampleLabel.setText("=> " + m_jtfFans.getText()+" * "+((Number)factorNormalField.getValue()).intValue()+" = "+(Integer.parseInt(m_jtfFans.getText())*((Number)factorNormalField.getValue()).intValue())+" ("+ HOVerwaltung.instance().getLanguageString("Zuschauer")+" )"); + exampleLabel.setText("=> " + m_jtfFans.getText()+" * "+((Number)factorNormalField.getValue()).intValue()+" = "+(Integer.parseInt(m_jtfFans.getText())*((Number)factorNormalField.getValue()).intValue())+" ("+ TranslationFacility.tr("Zuschauer")+" )"); return supporter; } @@ -223,7 +213,7 @@ public void actionPerformed(java.awt.event.ActionEvent actionEvent) { BigDecimal vPercent = new BigDecimal(vipPercentField.getValue().toString()); BigDecimal sum = tPercent.add(bPercent).add(rPercent).add(vPercent); if(sum.multiply(HUNDRED).compareTo(HUNDRED) != 0){ - JOptionPane.showMessageDialog(getTopLevelAncestor(), sum.multiply(HUNDRED).setScale(1)+" % <> "+HUNDRED+" %", HOVerwaltung.instance().getLanguageString("Fehler"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(getTopLevelAncestor(), sum.multiply(HUNDRED).setScale(1)+" % <> "+HUNDRED+" %", TranslationFacility.tr("Fehler"), JOptionPane.ERROR_MESSAGE); terracesPercentField.setForeground(ThemeManager.getColor(HOColorName.LABEL_ERROR_FG)); basicPercentField.setForeground(ThemeManager.getColor(HOColorName.LABEL_ERROR_FG)); roofPercentField.setForeground(ThemeManager.getColor(HOColorName.LABEL_ERROR_FG)); diff --git a/src/main/java/tool/arenasizer/DistributionStatisticsPanel.java b/src/main/java/tool/arenasizer/DistributionStatisticsPanel.java index f0ec637ac..6d34458c4 100644 --- a/src/main/java/tool/arenasizer/DistributionStatisticsPanel.java +++ b/src/main/java/tool/arenasizer/DistributionStatisticsPanel.java @@ -9,21 +9,17 @@ import core.gui.theme.HOColorName; import core.gui.theme.HOIconName; import core.gui.theme.ThemeManager; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.util.Helper; import module.matches.MatchesPanel; import tool.updater.TableModel; -import java.awt.BorderLayout; +import javax.swing.*; +import javax.swing.table.TableColumnModel; +import java.awt.*; import java.math.BigDecimal; import java.math.RoundingMode; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.table.TableColumnModel; - class DistributionStatisticsPanel extends JPanel { @@ -54,11 +50,10 @@ protected JScrollPane createTable() { } protected TableModel getModel() { - HOVerwaltung hoV = HOVerwaltung.instance(); // DATUM SpielerRenderer - String[] columnNames = {hoV.getLanguageString("ls.match.id"),hoV.getLanguageString("ls.match.weather"),hoV.getLanguageString("Zuschauer"),hoV.getLanguageString("ls.club.arena.terraces")+" ( %)", - hoV.getLanguageString("ls.club.arena.basicseating")+" ( %)",hoV.getLanguageString("ls.club.arena.seatsunderroof")+" ( %)",hoV.getLanguageString("ls.club.arena.seatsinvipboxes")+" ( %)", - hoV.getLanguageString("Fans")+" ( )"}; + String[] columnNames = {TranslationFacility.tr("ls.match.id"), TranslationFacility.tr("ls.match.weather"), TranslationFacility.tr("Zuschauer"), TranslationFacility.tr("ls.club.arena.terraces")+" ( %)", + TranslationFacility.tr("ls.club.arena.basicseating")+" ( %)", TranslationFacility.tr("ls.club.arena.seatsunderroof")+" ( %)", TranslationFacility.tr("ls.club.arena.seatsinvipboxes")+" ( %)", + TranslationFacility.tr("Fans")+" ( )"}; ArenaStatistikModel[] matches= DBManager.instance().getArenaStatistikModel(MatchesPanel.OWN_LEAGUE_GAMES).getMatches(); IHOTableEntry[][] value = new IHOTableEntry[matches.length][columnNames.length]; diff --git a/src/main/java/tool/dbcleanup/DBCleanupDialog.kt b/src/main/java/tool/dbcleanup/DBCleanupDialog.kt index 329e39cf0..3b190852e 100644 --- a/src/main/java/tool/dbcleanup/DBCleanupDialog.kt +++ b/src/main/java/tool/dbcleanup/DBCleanupDialog.kt @@ -1,7 +1,7 @@ package tool.dbcleanup import core.gui.HOMainFrame -import core.model.HOVerwaltung +import core.model.TranslationFacility import java.awt.* import javax.swing.* @@ -12,7 +12,7 @@ import javax.swing.* */ internal class DBCleanupDialog(owner: JFrame?, private val cleanupTool: DBCleanupTool) : JDialog( owner, - HOVerwaltung.instance().getLanguageString("ls.menu.file.database.databasecleanup"), + TranslationFacility.tr("ls.menu.file.database.databasecleanup"), true ) { private val mainPanelOwnMatches = WeekSelectionPanel(DBCleanupTool.REMOVE_NONE) @@ -45,22 +45,22 @@ internal class DBCleanupDialog(owner: JFrame?, private val cleanupTool: DBCleanu gbc.gridwidth = 2 val textIntro = JLabel( - "" + HOVerwaltung.instance().getLanguageString("dbcleanup.intro") + "" + TranslationFacility.tr("dbcleanup.intro") .replace("\n", "
") + "" ) mainPanel.add(textIntro, gbc) gbc.gridwidth = 1 - val labelOwnMatches = JLabel(HOVerwaltung.instance().getLanguageString("dbcleanup.yourMatches")) + val labelOwnMatches = JLabel(TranslationFacility.tr("dbcleanup.yourMatches")) labelOwnMatches.font = labelOwnMatches.font.deriveFont(Font.BOLD) - val labelOtherMatches = JLabel(HOVerwaltung.instance().getLanguageString("dbcleanup.otherTeamsMatches")) + val labelOtherMatches = JLabel(TranslationFacility.tr("dbcleanup.otherTeamsMatches")) labelOtherMatches.font = labelOtherMatches.font.deriveFont(Font.BOLD) - val labelHrf = JLabel(HOVerwaltung.instance().getLanguageString("dbcleanup.hrf")) + val labelHrf = JLabel(TranslationFacility.tr("dbcleanup.hrf")) labelHrf.font = labelHrf.font.deriveFont(Font.BOLD) - val hrfAutoRemove = JCheckBox(HOVerwaltung.instance().getLanguageString("dbcleanup.hrfSmartRemove")) + val hrfAutoRemove = JCheckBox(TranslationFacility.tr("dbcleanup.hrfSmartRemove")) hrfAutoRemove.isSelected = true gbc.gridx = 0 @@ -94,7 +94,7 @@ internal class DBCleanupDialog(owner: JFrame?, private val cleanupTool: DBCleanu gbc.gridx = 0 gbc.anchor = GridBagConstraints.WEST gbc.weightx = 1.0 - mainPanel.add(JLabel(HOVerwaltung.instance().getLanguageString("dbcleanup.numMatches")), gbc) + mainPanel.add(JLabel(TranslationFacility.tr("dbcleanup.numMatches")), gbc) gbc.gridx = 1 gbc.anchor = GridBagConstraints.LINE_END @@ -104,7 +104,7 @@ internal class DBCleanupDialog(owner: JFrame?, private val cleanupTool: DBCleanu gbc.gridx = 0 gbc.gridy++ gbc.anchor = GridBagConstraints.LINE_START - mainPanel.add(JLabel(HOVerwaltung.instance().getLanguageString("dbcleanup.numHrfs")), gbc) + mainPanel.add(JLabel(TranslationFacility.tr("dbcleanup.numHrfs")), gbc) gbc.gridx = 1 mainPanel.add(JLabel(cleanupTool.getHrfCount().toString()), gbc) gbc.gridy++ @@ -115,7 +115,7 @@ internal class DBCleanupDialog(owner: JFrame?, private val cleanupTool: DBCleanu // Add Buttons val buttonPanel = JPanel() - val cleanupNowButton = JButton(HOVerwaltung.instance().getLanguageString("dbcleanup.cleanupnow")) + val cleanupNowButton = JButton(TranslationFacility.tr("dbcleanup.cleanupnow")) cleanupNowButton.font = cleanupNowButton.font.deriveFont(Font.BOLD) cleanupNowButton.addActionListener { cleanupTool.cleanupMatches( @@ -129,7 +129,7 @@ internal class DBCleanupDialog(owner: JFrame?, private val cleanupTool: DBCleanu isVisible = false } - val cancelButton = JButton(HOVerwaltung.instance().getLanguageString("ls.button.cancel")) + val cancelButton = JButton(TranslationFacility.tr("ls.button.cancel")) cancelButton.addActionListener { isVisible = false } diff --git a/src/main/java/tool/dbcleanup/WeekSelectionPanel.kt b/src/main/java/tool/dbcleanup/WeekSelectionPanel.kt index 7bb49eabd..8a755ca8c 100644 --- a/src/main/java/tool/dbcleanup/WeekSelectionPanel.kt +++ b/src/main/java/tool/dbcleanup/WeekSelectionPanel.kt @@ -1,21 +1,17 @@ package tool.dbcleanup -import core.model.HOVerwaltung +import core.model.TranslationFacility import java.awt.FlowLayout import java.awt.event.FocusEvent import java.awt.event.FocusListener -import javax.swing.BorderFactory -import javax.swing.JCheckBox -import javax.swing.JLabel -import javax.swing.JPanel -import javax.swing.JTextField +import javax.swing.* internal class WeekSelectionPanel(weeks: Int, showRemoveAll: Boolean) : JPanel() { - private val labelRemoveOlderThan = JLabel(HOVerwaltung.instance().getLanguageString("dbcleanup.removeOlderThan")) - private val labelWeeks = JLabel(HOVerwaltung.instance().getLanguageString("dbcleanup.weeks")) + private val labelRemoveOlderThan = JLabel(TranslationFacility.tr("dbcleanup.removeOlderThan")) + private val labelWeeks = JLabel(TranslationFacility.tr("dbcleanup.weeks")) - private val noneCheckBox = JCheckBox(HOVerwaltung.instance().getLanguageString("dbcleanup.none")) - private val allCheckBox = JCheckBox(HOVerwaltung.instance().getLanguageString("dbcleanup.allTime")) + private val noneCheckBox = JCheckBox(TranslationFacility.tr("dbcleanup.none")) + private val allCheckBox = JCheckBox(TranslationFacility.tr("dbcleanup.allTime")) private val weeksTextField = JTextField(3) constructor(weeks: Int) : this(weeks, true) diff --git a/src/main/java/tool/export/CsvPlayerExport.java b/src/main/java/tool/export/CsvPlayerExport.java index 3f19f501a..bebeeb39f 100644 --- a/src/main/java/tool/export/CsvPlayerExport.java +++ b/src/main/java/tool/export/CsvPlayerExport.java @@ -1,14 +1,18 @@ package tool.export; -import core.constants.player.PlayerSkill; +import core.constants.player.*; import core.file.ExampleFileFilter; import core.gui.HOMainFrame; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.IMatchRoleID; import core.model.player.Player; import core.util.HOLogger; -import java.io.*; +import javax.swing.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; import java.math.RoundingMode; import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; @@ -16,14 +20,6 @@ import java.util.List; import java.util.Locale; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; - -import core.constants.player.PlayerAggressiveness; -import core.constants.player.PlayerAgreeability; -import core.constants.player.PlayerHonesty; -import core.constants.player.PlayerSpeciality; - /** * CsvPlayerExport * Export all players as CSV file @@ -49,11 +45,11 @@ public void showSaveDialog() { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); - fileChooser.setDialogTitle(HOVerwaltung.instance().getLanguageString("CSVExporter")); + fileChooser.setDialogTitle(TranslationFacility.tr("CSVExporter")); ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("csv"); - filter.setDescription(HOVerwaltung.instance().getLanguageString("filetypedescription.csv")); + filter.setDescription(TranslationFacility.tr("filetypedescription.csv")); fileChooser.setFileFilter(filter); fileChooser.setSelectedFile(file); @@ -63,7 +59,7 @@ public void showSaveDialog() { file = fileChooser.getSelectedFile(); if (file.exists() && JOptionPane.showConfirmDialog( HOMainFrame.instance(), - HOVerwaltung.instance().getLanguageString("overwrite"), HOVerwaltung.instance().getLanguageString("CSVExporter"), + TranslationFacility.tr("overwrite"), TranslationFacility.tr("CSVExporter"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { // Cancel return; @@ -83,55 +79,55 @@ private void doExport (File file) { OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8); writer.write( - "\"" + HOVerwaltung.instance().getLanguageString("ls.player.name") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.id") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("Aufgestellt") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.age") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.age") + " " + HOVerwaltung.instance().getLanguageString("ls.player.age.days") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.tsi") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.wage") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.warningstatus") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.injurystatus") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.short_motherclub") + "\"," - - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.agreeability") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.aggressiveness") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.honesty") + "\"," - - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.speciality") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.short_experience") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.short_leadership") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.form") + "\"," + "\"" + TranslationFacility.tr("ls.player.name") + "\"," + + "\"" + TranslationFacility.tr("ls.player.id") + "\"," + + "\"" + TranslationFacility.tr("Aufgestellt") + "\"," + + "\"" + TranslationFacility.tr("ls.player.age") + "\"," + + "\"" + TranslationFacility.tr("ls.player.age") + " " + TranslationFacility.tr("ls.player.age.days") + "\"," + + "\"" + TranslationFacility.tr("ls.player.tsi") + "\"," + + "\"" + TranslationFacility.tr("ls.player.wage") + "\"," + + "\"" + TranslationFacility.tr("ls.player.warningstatus") + "\"," + + "\"" + TranslationFacility.tr("ls.player.injurystatus") + "\"," + + "\"" + TranslationFacility.tr("ls.player.short_motherclub") + "\"," + + + "\"" + TranslationFacility.tr("ls.player.agreeability") + "\"," + + "\"" + TranslationFacility.tr("ls.player.aggressiveness") + "\"," + + "\"" + TranslationFacility.tr("ls.player.honesty") + "\"," + + + "\"" + TranslationFacility.tr("ls.player.speciality") + "\"," + + "\"" + TranslationFacility.tr("ls.player.short_experience") + "\"," + + "\"" + TranslationFacility.tr("ls.player.short_leadership") + "\"," + + "\"" + TranslationFacility.tr("ls.player.form") + "\"," // ls.player.skill_short - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.stamina") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.short_loyalty") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.keeper") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.defending") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.winger") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.playmaking") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.passing") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.scoring") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.skill_short.setpieces") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.stamina") + "\"," + + "\"" + TranslationFacility.tr("ls.player.short_loyalty") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.keeper") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.defending") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.winger") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.playmaking") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.passing") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.scoring") + "\"," + + "\"" + TranslationFacility.tr("ls.player.skill_short.setpieces") + "\"," // ls.player.position_short - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.keeper") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefender") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefenderoffensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.centraldefendertowardswing") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingback") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackoffensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbackdefensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingbacktowardsmiddle") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielder") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderoffensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfielderdefensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.innermidfieldertowardswing") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.winger") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingeroffensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingerdefensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.wingertowardsmiddle") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.forward") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwarddefensive") + "\"," - + "\"" + HOVerwaltung.instance().getLanguageString("ls.player.position_short.forwardtowardswing") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.keeper") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.centraldefender") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.centraldefenderoffensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.centraldefendertowardswing") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.wingback") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.wingbackoffensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.wingbackdefensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.wingbacktowardsmiddle") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.innermidfielder") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.innermidfielderoffensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.innermidfielderdefensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.innermidfieldertowardswing") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.winger") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.wingeroffensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.wingerdefensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.wingertowardsmiddle") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.forward") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.forwarddefensive") + "\"," + + "\"" + TranslationFacility.tr("ls.player.position_short.forwardtowardswing") + "\"," + "\n"); var ratingPredictionModel = HOVerwaltung.instance().getModel().getRatingPredictionModel(); diff --git a/src/main/java/tool/hrfExplorer/HrfExplorer.java b/src/main/java/tool/hrfExplorer/HrfExplorer.java index b72f9a3ee..14c5f3e89 100644 --- a/src/main/java/tool/hrfExplorer/HrfExplorer.java +++ b/src/main/java/tool/hrfExplorer/HrfExplorer.java @@ -9,38 +9,12 @@ import core.gui.theme.ImageUtilities; import core.gui.theme.ThemeManager; import core.model.HOVerwaltung; -import core.model.match.MatchKurzInfo; +import core.model.TranslationFacility; import core.model.enums.MatchType; +import core.model.match.MatchKurzInfo; import core.util.HOLogger; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.io.File; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.*; - -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTable; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.border.BevelBorder; import javax.swing.border.Border; import javax.swing.event.ChangeEvent; @@ -48,6 +22,14 @@ import javax.swing.event.TableColumnModelEvent; import javax.swing.event.TableColumnModelListener; import javax.swing.table.TableColumn; +import java.awt.*; +import java.awt.event.*; +import java.io.File; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.List; +import java.util.*; /** @@ -221,13 +203,13 @@ private void initialize() { //Füllen der HashTable m_HashTable_EventInfo mit den Sprachenabhängigen Wörtern - m_HashTable_EventInfo.put("L",hoV.getLanguageString("ls.match.matchtype.league")); - m_HashTable_EventInfo.put("F",hoV.getLanguageString("ls.match.matchtype.friendly_normal")); - m_HashTable_EventInfo.put("I",hoV.getLanguageString("ls.match.matchtype.internationalfriendly_normal")); - m_HashTable_EventInfo.put("P",hoV.getLanguageString("ls.match.matchtype.cup")); - m_HashTable_EventInfo.put("Q",hoV.getLanguageString("ls.match.matchtype.qualification")); - m_HashTable_EventInfo.put("DB",hoV.getLanguageString("ttCalDB")); - m_HashTable_EventInfo.put("FILE",hoV.getLanguageString("ttCalFile")); + m_HashTable_EventInfo.put("L",TranslationFacility.tr("ls.match.matchtype.league")); + m_HashTable_EventInfo.put("F",TranslationFacility.tr("ls.match.matchtype.friendly_normal")); + m_HashTable_EventInfo.put("I",TranslationFacility.tr("ls.match.matchtype.internationalfriendly_normal")); + m_HashTable_EventInfo.put("P",TranslationFacility.tr("ls.match.matchtype.cup")); + m_HashTable_EventInfo.put("Q",TranslationFacility.tr("ls.match.matchtype.qualification")); + m_HashTable_EventInfo.put("DB",TranslationFacility.tr("ttCalDB")); + m_HashTable_EventInfo.put("FILE",TranslationFacility.tr("ttCalFile")); // Anzahl der HRF-Files in der DB ermitteln doSelect("SELECT COUNT(*) FROM HRF"); @@ -295,7 +277,7 @@ private void initialize() { Vector importHeader = new Vector(); Vector importValues = new Vector(); - importHeader.add(hoV.getLanguageString("pfad")); + importHeader.add(TranslationFacility.tr("pfad")); m_TableModel_Imports = new HrfTableModel(importHeader, importValues); m_Table_Imports = new HrfTable(m_TableModel_Imports, "HRFImportieren"); @@ -308,15 +290,15 @@ private void initialize() { Vector tmpV = new Vector(); m_V_Filelist_Header.add(""); - m_V_Filelist_Header.add(hoV.getLanguageString("datname")); - m_V_Filelist_Header.add(hoV.getLanguageString("Datum")); - m_V_Filelist_Header.add(hoV.getLanguageString("tag")); - m_V_Filelist_Header.add(hoV.getLanguageString("kw")); - m_V_Filelist_Header.add(hoV.getLanguageString("Season")); - m_V_Filelist_Header.add(hoV.getLanguageString("Liga")); - m_V_Filelist_Header.add(hoV.getLanguageString("Training")); + m_V_Filelist_Header.add(TranslationFacility.tr("datname")); + m_V_Filelist_Header.add(TranslationFacility.tr("Datum")); + m_V_Filelist_Header.add(TranslationFacility.tr("tag")); + m_V_Filelist_Header.add(TranslationFacility.tr("kw")); + m_V_Filelist_Header.add(TranslationFacility.tr("Season")); + m_V_Filelist_Header.add(TranslationFacility.tr("Liga")); + m_V_Filelist_Header.add(TranslationFacility.tr("Training")); m_V_Filelist_Header.add("%"); - m_V_Filelist_Header.add(hoV.getLanguageString("indb")); + m_V_Filelist_Header.add(TranslationFacility.tr("indb")); m_TableModel_Filelist = new HrfTableModel(m_V_Filelist_Header, m_V_Filelist_Values); m_Table_Filelist = new HrfTable(m_TableModel_Filelist,m_intAr_col_width_Filelist, "filelist"); @@ -328,14 +310,14 @@ private void initialize() { m_V_Calendar_Header = new Vector(); m_V_Calendar_Values = new Vector(); - m_V_Calendar_Header.add(hoV.getLanguageString("kw")); - m_V_Calendar_Header.add(hoV.getLanguageString("monkurz")); - m_V_Calendar_Header.add(hoV.getLanguageString("diekurz")); - m_V_Calendar_Header.add(hoV.getLanguageString("mitkurz")); - m_V_Calendar_Header.add(hoV.getLanguageString("donkurz")); - m_V_Calendar_Header.add(hoV.getLanguageString("frekurz")); - m_V_Calendar_Header.add(hoV.getLanguageString("samkurz")); - m_V_Calendar_Header.add(hoV.getLanguageString("sonkurz")); + m_V_Calendar_Header.add(TranslationFacility.tr("kw")); + m_V_Calendar_Header.add(TranslationFacility.tr("monkurz")); + m_V_Calendar_Header.add(TranslationFacility.tr("diekurz")); + m_V_Calendar_Header.add(TranslationFacility.tr("mitkurz")); + m_V_Calendar_Header.add(TranslationFacility.tr("donkurz")); + m_V_Calendar_Header.add(TranslationFacility.tr("frekurz")); + m_V_Calendar_Header.add(TranslationFacility.tr("samkurz")); + m_V_Calendar_Header.add(TranslationFacility.tr("sonkurz")); m_TableModel_Calendar = new HrfTableModel(m_V_Calendar_Header, m_V_Calendar_Values); m_Table_Calendar = new HrfTable(m_TableModel_Calendar,m_intAr_col_width_Calendar, "calendar"); @@ -348,18 +330,18 @@ private void initialize() { */ //Vorbereiten der fixen Labelbeschriftungen m_Ar_Detail_Label_fix = new String[12]; - m_Ar_Detail_Label_fix[0] = hoV.getLanguageString("Liga"); - m_Ar_Detail_Label_fix[1] = hoV.getLanguageString("Season") + " / " +hoV.getLanguageString("Spieltag"); - m_Ar_Detail_Label_fix[2] = hoV.getLanguageString("Punkte") + " / " + hoV.getLanguageString("Tore"); - m_Ar_Detail_Label_fix[3] =hoV.getLanguageString("Platzierung"); - m_Ar_Detail_Label_fix[4] = hoV.getLanguageString("ls.team.trainingtype"); - m_Ar_Detail_Label_fix[5] = hoV.getLanguageString("ls.team.trainingintensity"); - m_Ar_Detail_Label_fix[6] = hoV.getLanguageString("ls.club.staff.assistantcoach"); - m_Ar_Detail_Label_fix[7] = hoV.getLanguageString("ls.team.confidence"); - m_Ar_Detail_Label_fix[8] = hoV.getLanguageString("AnzahlSpieler"); - m_Ar_Detail_Label_fix[9] =hoV.getLanguageString("ls.team.teamspirit"); - m_Ar_Detail_Label_fix[10] = hoV.getLanguageString("lasthrf"); - m_Ar_Detail_Label_fix[11] = hoV.getLanguageString("nexthrf"); + m_Ar_Detail_Label_fix[0] = TranslationFacility.tr("Liga"); + m_Ar_Detail_Label_fix[1] = TranslationFacility.tr("Season") + " / " +TranslationFacility.tr("Spieltag"); + m_Ar_Detail_Label_fix[2] = TranslationFacility.tr("Punkte") + " / " + TranslationFacility.tr("Tore"); + m_Ar_Detail_Label_fix[3] =TranslationFacility.tr("Platzierung"); + m_Ar_Detail_Label_fix[4] = TranslationFacility.tr("ls.team.trainingtype"); + m_Ar_Detail_Label_fix[5] = TranslationFacility.tr("ls.team.trainingintensity"); + m_Ar_Detail_Label_fix[6] = TranslationFacility.tr("ls.club.staff.assistantcoach"); + m_Ar_Detail_Label_fix[7] = TranslationFacility.tr("ls.team.confidence"); + m_Ar_Detail_Label_fix[8] = TranslationFacility.tr("AnzahlSpieler"); + m_Ar_Detail_Label_fix[9] =TranslationFacility.tr("ls.team.teamspirit"); + m_Ar_Detail_Label_fix[10] = TranslationFacility.tr("lasthrf"); + m_Ar_Detail_Label_fix[11] = TranslationFacility.tr("nexthrf"); m_int_Hoehe_DetailPanels = m_Ar_Detail_Label_fix.length * m_int_Hoehe_Label; // Festlege der Gesamthöhe des Detailpanels @@ -409,36 +391,36 @@ private void initialize() { Border kante = BorderFactory.createBevelBorder(BevelBorder.RAISED,hellblau,dunkelblau); - m_Button_load_file = new JButton(hoV.getLanguageString("btLoadFile")); - m_Button_load_file.setToolTipText(hoV.getLanguageString("ttLoadFile")); + m_Button_load_file = new JButton(TranslationFacility.tr("btLoadFile")); + m_Button_load_file.setToolTipText(TranslationFacility.tr("ttLoadFile")); m_Button_load_file.addActionListener(this); - m_Button_delete_db = new JButton(hoV.getLanguageString("btDeleteDB")); - m_Button_delete_db.setToolTipText(hoV.getLanguageString("ttDeleteDB")); + m_Button_delete_db = new JButton(TranslationFacility.tr("btDeleteDB")); + m_Button_delete_db.setToolTipText(TranslationFacility.tr("ttDeleteDB")); m_Button_delete_db.addActionListener(this); - m_Button_delete_file = new JButton(hoV.getLanguageString("btDeleteFile")); - m_Button_delete_file.setToolTipText(hoV.getLanguageString("ttDeleteFile")); + m_Button_delete_file = new JButton(TranslationFacility.tr("btDeleteFile")); + m_Button_delete_file.setToolTipText(TranslationFacility.tr("ttDeleteFile")); m_Button_delete_file.addActionListener(this); - m_Button_ImportList = new JButton(hoV.getLanguageString("btImport")); - m_Button_ImportList.setToolTipText(hoV.getLanguageString("ttImport")); + m_Button_ImportList = new JButton(TranslationFacility.tr("btImport")); + m_Button_ImportList.setToolTipText(TranslationFacility.tr("ttImport")); m_Button_ImportList.addActionListener(this); - m_Button_Select_All = new JButton(hoV.getLanguageString("btSelect")); - m_Button_Select_All.setToolTipText(hoV.getLanguageString("ttSelect")); + m_Button_Select_All = new JButton(TranslationFacility.tr("btSelect")); + m_Button_Select_All.setToolTipText(TranslationFacility.tr("ttSelect")); m_Button_Select_All.addActionListener(this); - m_Button_reset = new JButton(hoV.getLanguageString("ls.button.reset")); - m_Button_reset.setToolTipText(hoV.getLanguageString("ttReset")); + m_Button_reset = new JButton(TranslationFacility.tr("ls.button.reset")); + m_Button_reset.setToolTipText(TranslationFacility.tr("ttReset")); m_Button_reset.addActionListener(this); - m_Button_Delete_Row = new JButton(hoV.getLanguageString("btRemove")); - m_Button_Delete_Row.setToolTipText(hoV.getLanguageString("ttRemove")); + m_Button_Delete_Row = new JButton(TranslationFacility.tr("btRemove")); + m_Button_Delete_Row.setToolTipText(TranslationFacility.tr("ttRemove")); m_Button_Delete_Row.addActionListener(this); - m_Button_GoTo = new JButton(hoV.getLanguageString("ls.button.apply")); - m_Button_GoTo.setToolTipText(hoV.getLanguageString("ttok")); + m_Button_GoTo = new JButton(TranslationFacility.tr("ls.button.apply")); + m_Button_GoTo.setToolTipText(TranslationFacility.tr("ttok")); m_Button_GoTo.setBackground(hellblau); m_Button_GoTo.addActionListener(this); @@ -450,8 +432,8 @@ private void initialize() { m_Button_Month_Back.setIcon(ImageUtilities.getTransferInIcon()); m_Button_Month_Back.addActionListener(this); - m_Button_ResetImports = new JButton(hoV.getLanguageString("btImports")); - m_Button_ResetImports.setToolTipText(hoV.getLanguageString("ttImports")); + m_Button_ResetImports = new JButton(TranslationFacility.tr("btImports")); + m_Button_ResetImports.setToolTipText(TranslationFacility.tr("ttImports")); m_Button_ResetImports.addActionListener(this); m_Label_Monat = new JLabel(""); @@ -552,19 +534,18 @@ private JLabel createLabel(String text, int breite, int hoehe, int position, Col ******************/ public void setMonate() { - HOVerwaltung hoV = HOVerwaltung.instance(); - m_V_months.add(hoV.getLanguageString("jan")); - m_V_months.add(hoV.getLanguageString("feb")); - m_V_months.add(hoV.getLanguageString("mar")); - m_V_months.add(hoV.getLanguageString("apr")); - m_V_months.add(hoV.getLanguageString("may")); - m_V_months.add(hoV.getLanguageString("jun")); - m_V_months.add(hoV.getLanguageString("jul")); - m_V_months.add(hoV.getLanguageString("aug")); - m_V_months.add(hoV.getLanguageString("sep")); - m_V_months.add(hoV.getLanguageString("oct")); - m_V_months.add(hoV.getLanguageString("nov")); - m_V_months.add(hoV.getLanguageString("dec")); + m_V_months.add(TranslationFacility.tr("jan")); + m_V_months.add(TranslationFacility.tr("feb")); + m_V_months.add(TranslationFacility.tr("mar")); + m_V_months.add(TranslationFacility.tr("apr")); + m_V_months.add(TranslationFacility.tr("may")); + m_V_months.add(TranslationFacility.tr("jun")); + m_V_months.add(TranslationFacility.tr("jul")); + m_V_months.add(TranslationFacility.tr("aug")); + m_V_months.add(TranslationFacility.tr("sep")); + m_V_months.add(TranslationFacility.tr("oct")); + m_V_months.add(TranslationFacility.tr("nov")); + m_V_months.add(TranslationFacility.tr("dec")); } /****************** @@ -582,14 +563,13 @@ public static Vector getMonate() ******************/ public void setTage() { - HOVerwaltung hoV = HOVerwaltung.instance(); - m_Ar_days[0] = hoV.getLanguageString("mon"); - m_Ar_days[1] = hoV.getLanguageString("die"); - m_Ar_days[2] = hoV.getLanguageString("wed"); - m_Ar_days[3] = hoV.getLanguageString("don"); - m_Ar_days[4] = hoV.getLanguageString("fre"); - m_Ar_days[5] = hoV.getLanguageString("sam"); - m_Ar_days[6] = hoV.getLanguageString("son"); + m_Ar_days[0] = TranslationFacility.tr("mon"); + m_Ar_days[1] = TranslationFacility.tr("die"); + m_Ar_days[2] = TranslationFacility.tr("wed"); + m_Ar_days[3] = TranslationFacility.tr("don"); + m_Ar_days[4] = TranslationFacility.tr("fre"); + m_Ar_days[5] = TranslationFacility.tr("sam"); + m_Ar_days[6] = TranslationFacility.tr("son"); } /****************** @@ -874,7 +854,7 @@ public void createDetailTable(String hashwert) // Entfernen-Panel und -Label erstellen HrfPanel entfernen = new HrfPanel(m_int_Breite_Detail_Var,m_int_Hoehe_Label + 5,rot); entfernen.setLayout(new GridLayout(1,1)); - JLabel remove = createLabel(HOVerwaltung.instance().getLanguageString("ls.button.remove"),m_int_Breite_Detail_Var,m_int_Hoehe_Label,JLabel.CENTER,rot); + JLabel remove = createLabel(TranslationFacility.tr("ls.button.remove"),m_int_Breite_Detail_Var,m_int_Hoehe_Label,JLabel.CENTER,rot); remove.getInsets(); entfernen.add(remove); @@ -1145,7 +1125,7 @@ else if(e.getSource().equals(m_Button_delete_file)) File tmp_File = new File(deletePath); - int option = JOptionPane.showConfirmDialog(null,HOVerwaltung.instance().getLanguageString("deletefile") + "\n" + deletePath,HOVerwaltung.instance().getLanguageString("deletefile"),JOptionPane.YES_NO_OPTION); + int option = JOptionPane.showConfirmDialog(null,TranslationFacility.tr("deletefile") + "\n" + deletePath,TranslationFacility.tr("deletefile"),JOptionPane.YES_NO_OPTION); if(option == 0) { //Löschen der Datei von der Platte diff --git a/src/main/java/tool/hrfExplorer/HrfExplorerDialog.java b/src/main/java/tool/hrfExplorer/HrfExplorerDialog.java index 8824f1be2..13c39b256 100644 --- a/src/main/java/tool/hrfExplorer/HrfExplorerDialog.java +++ b/src/main/java/tool/hrfExplorer/HrfExplorerDialog.java @@ -1,12 +1,9 @@ package tool.hrfExplorer; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.BorderLayout; -import java.awt.Dimension; - -import javax.swing.JDialog; -import javax.swing.JFrame; +import javax.swing.*; +import java.awt.*; public class HrfExplorerDialog extends JDialog { @@ -22,7 +19,7 @@ public HrfExplorerDialog(JFrame owner){ private void initialize() { setSize(1024,668); setLayout(new BorderLayout()); - setTitle(HOVerwaltung.instance().getLanguageString("Tab_HRF-Explorer")); + setTitle(TranslationFacility.tr("Tab_HRF-Explorer")); add(new HrfExplorer(), BorderLayout.CENTER); diff --git a/src/main/java/tool/injury/AbstractInjuryPanel.java b/src/main/java/tool/injury/AbstractInjuryPanel.java index 651df0f74..4ab43b733 100644 --- a/src/main/java/tool/injury/AbstractInjuryPanel.java +++ b/src/main/java/tool/injury/AbstractInjuryPanel.java @@ -1,17 +1,13 @@ package tool.injury; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; -import java.awt.BorderLayout; -import java.awt.GridLayout; +import core.model.TranslationFacility; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DecimalFormat; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; /** * Abstract Injury Calculator Panel Component @@ -132,7 +128,7 @@ private void init() { final JPanel pan = new ImagePanel(); pan.setLayout(new GridLayout(1, 4)); - final JButton button = new JButton(HOVerwaltung.instance().getLanguageString("Calculate")); + final JButton button = new JButton(TranslationFacility.tr("Calculate")); pan.add(inputMsg); pan.add(input); pan.add(outputMsg); diff --git a/src/main/java/tool/injury/DoctorPanel.java b/src/main/java/tool/injury/DoctorPanel.java index 7c0625d7f..85da8d871 100644 --- a/src/main/java/tool/injury/DoctorPanel.java +++ b/src/main/java/tool/injury/DoctorPanel.java @@ -1,5 +1,6 @@ package tool.injury; -import core.model.HOVerwaltung; + +import core.model.TranslationFacility; /** * The Panel to calculate the number of needed doctors @@ -12,7 +13,7 @@ public class DoctorPanel extends AbstractInjuryPanel { //~ Instance fields ---------------------------------------------------------------------------- - private String msg = HOVerwaltung.instance().getLanguageString("DoctorsNeeded"); + private String msg = TranslationFacility.tr("DoctorsNeeded"); //~ Constructors ------------------------------------------------------------------------------- @@ -50,8 +51,8 @@ public final void doAction() { */ public final void reset() { setInputValue(""); - setInputMsg(HOVerwaltung.instance().getLanguageString("Updates")); + setInputMsg(TranslationFacility.tr("Updates")); setOutputMsg(msg); - setHeader(HOVerwaltung.instance().getLanguageString("Injury1")); + setHeader(TranslationFacility.tr("Injury1")); } } diff --git a/src/main/java/tool/injury/InjuryDetailPanel.java b/src/main/java/tool/injury/InjuryDetailPanel.java index 558ce8028..e09f64e20 100644 --- a/src/main/java/tool/injury/InjuryDetailPanel.java +++ b/src/main/java/tool/injury/InjuryDetailPanel.java @@ -2,17 +2,12 @@ import core.gui.comp.panel.ImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; import tool.keepertool.PlayerItem; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import javax.swing.BorderFactory; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; + +import javax.swing.*; +import java.awt.*; /** @@ -198,9 +193,9 @@ private Component createPanel(Component field) { * Initialize the GUI components */ private void init() { - injuryType.addItem(HOVerwaltung.instance().getLanguageString("ls.player.injurystatus.healthy")); - injuryType.addItem(HOVerwaltung.instance().getLanguageString("ls.player.injurystatus.bruised")); - injuryType.addItem(HOVerwaltung.instance().getLanguageString("ls.player.injurystatus.injured")); + injuryType.addItem(TranslationFacility.tr("ls.player.injurystatus.healthy")); + injuryType.addItem(TranslationFacility.tr("ls.player.injurystatus.bruised")); + injuryType.addItem(TranslationFacility.tr("ls.player.injurystatus.injured")); setOpaque(false); setLayout(new BorderLayout()); @@ -208,15 +203,15 @@ private void init() { final JPanel config = new ImagePanel(); config.setOpaque(false); config.setLayout(new GridLayout(4, 3)); - config.add(createLabel(HOVerwaltung.instance().getLanguageString("Spieler"))); - config.add(createLabel(HOVerwaltung.instance().getLanguageString("ls.player.age"))); - config.add(createLabel(HOVerwaltung.instance().getLanguageString("ls.player.injurystatus.injured"))); + config.add(createLabel(TranslationFacility.tr("Spieler"))); + config.add(createLabel(TranslationFacility.tr("ls.player.age"))); + config.add(createLabel(TranslationFacility.tr("ls.player.injurystatus.injured"))); config.add(createPanel(players)); config.add(createPanel(age)); config.add(createPanel(injury)); - config.add(createLabel(HOVerwaltung.instance().getLanguageString("ls.player.injurystatus"))); - config.add(createLabel(HOVerwaltung.instance().getLanguageString("TSIPre"))); - config.add(createLabel(HOVerwaltung.instance().getLanguageString("TSIPost"))); + config.add(createLabel(TranslationFacility.tr("ls.player.injurystatus"))); + config.add(createLabel(TranslationFacility.tr("TSIPre"))); + config.add(createLabel(TranslationFacility.tr("TSIPost"))); config.add(createPanel(injuryType)); config.add(createPanel(tsiPre)); config.add(createPanel(tsiPost)); diff --git a/src/main/java/tool/injury/InjuryDialog.java b/src/main/java/tool/injury/InjuryDialog.java index d4cafdde5..473f794fc 100644 --- a/src/main/java/tool/injury/InjuryDialog.java +++ b/src/main/java/tool/injury/InjuryDialog.java @@ -1,13 +1,10 @@ package tool.injury; import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridLayout; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; +import core.model.TranslationFacility; + +import javax.swing.*; +import java.awt.*; /** @@ -33,7 +30,7 @@ public class InjuryDialog extends JDialog { */ public InjuryDialog(JFrame owner) { super(owner, false); - setTitle(HOVerwaltung.instance().getLanguageString("InjuryCalculator")); + setTitle(TranslationFacility.tr("InjuryCalculator")); initComponents(); diff --git a/src/main/java/tool/injury/UpdatePanel.java b/src/main/java/tool/injury/UpdatePanel.java index eff265253..5444289e0 100644 --- a/src/main/java/tool/injury/UpdatePanel.java +++ b/src/main/java/tool/injury/UpdatePanel.java @@ -1,5 +1,6 @@ package tool.injury; import core.model.HOVerwaltung; +import core.model.TranslationFacility; /** * The Panel to calculate the number of needed updates @@ -12,7 +13,7 @@ class UpdatePanel extends AbstractInjuryPanel { //~ Instance fields ---------------------------------------------------------------------------- - private String msg = HOVerwaltung.instance().getLanguageString("UpdatesNeeded"); + private String msg = TranslationFacility.tr("UpdatesNeeded"); //~ Constructors ------------------------------------------------------------------------------- @@ -49,9 +50,9 @@ public final void doAction() { * Reset the panel to default data */ final void reset() { - setInputMsg(HOVerwaltung.instance().getLanguageString("ls.club.staff.medic")); + setInputMsg(TranslationFacility.tr("ls.club.staff.medic")); setOutputMsg(msg); - setHeader(HOVerwaltung.instance().getLanguageString("Injury2")); + setHeader(TranslationFacility.tr("Injury2")); setInputValue(HOVerwaltung.instance().getModel().getClub().getAerzte() + ""); } } diff --git a/src/main/java/tool/injury/UpdateTSIPanel.java b/src/main/java/tool/injury/UpdateTSIPanel.java index 6cf1108f8..fcaf4624f 100644 --- a/src/main/java/tool/injury/UpdateTSIPanel.java +++ b/src/main/java/tool/injury/UpdateTSIPanel.java @@ -1,5 +1,6 @@ package tool.injury; import core.model.HOVerwaltung; +import core.model.TranslationFacility; /** @@ -13,7 +14,7 @@ class UpdateTSIPanel extends AbstractInjuryPanel { //~ Instance fields ---------------------------------------------------------------------------- - private String msg = HOVerwaltung.instance().getLanguageString("UpdatesNeeded"); + private String msg = TranslationFacility.tr("UpdatesNeeded"); //~ Constructors ------------------------------------------------------------------------------- @@ -50,9 +51,9 @@ public final void doAction() { * Reset the panel to default data */ final void reset() { - setInputMsg(HOVerwaltung.instance().getLanguageString("Injury4")); + setInputMsg(TranslationFacility.tr("Injury4")); setOutputMsg(msg); - setHeader(HOVerwaltung.instance().getLanguageString("Injury3")); + setHeader(TranslationFacility.tr("Injury3")); setInputValue(HOVerwaltung.instance().getModel().getClub().getAerzte() + ""); } } diff --git a/src/main/java/tool/keepertool/KeeperToolDialog.java b/src/main/java/tool/keepertool/KeeperToolDialog.java index 9c685b2e2..69403976c 100644 --- a/src/main/java/tool/keepertool/KeeperToolDialog.java +++ b/src/main/java/tool/keepertool/KeeperToolDialog.java @@ -3,19 +3,12 @@ import core.gui.comp.panel.ImagePanel; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Dimension; -import java.awt.GridLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.ButtonGroup; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JRadioButton; /** @@ -46,7 +39,7 @@ public class KeeperToolDialog extends JDialog implements ActionListener { */ public KeeperToolDialog(JFrame owner) { super(owner, false); - setTitle(HOVerwaltung.instance().getLanguageString("KeeperTool")); + setTitle(TranslationFacility.tr("KeeperTool")); resultPanel = new ResultPanel(this); initComponents(); @@ -103,16 +96,16 @@ private void initComponents() { final JPanel main = new JPanel(new BorderLayout()); main.setOpaque(false); - rosterButton = new JRadioButton(core.model.HOVerwaltung.instance().getLanguageString("Spieleruebersicht")); + rosterButton = new JRadioButton(TranslationFacility.tr("Spieleruebersicht")); rosterButton.setSelected(true); rosterButton.addActionListener(this); rosterButton.setOpaque(false); - scoutButton = new JRadioButton(core.model.HOVerwaltung.instance().getLanguageString("TransferScout")); + scoutButton = new JRadioButton(TranslationFacility.tr("TransferScout")); scoutButton.addActionListener(this); scoutButton.setOpaque(false); - final JRadioButton manualButton = new JRadioButton(core.model.HOVerwaltung.instance().getLanguageString("Manual")); + final JRadioButton manualButton = new JRadioButton(TranslationFacility.tr("Manual")); manualButton.addActionListener(this); manualButton.setOpaque(false); diff --git a/src/main/java/tool/keepertool/ManualPanel.java b/src/main/java/tool/keepertool/ManualPanel.java index e3e62172e..dc3559abd 100644 --- a/src/main/java/tool/keepertool/ManualPanel.java +++ b/src/main/java/tool/keepertool/ManualPanel.java @@ -2,22 +2,15 @@ import core.constants.player.PlayerAbility; import core.gui.comp.panel.ImagePanel; +import core.model.TranslationFacility; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; - /** * Panel for manual editing of keeper data @@ -70,11 +63,11 @@ private void init() { buttonPanel.setLayout(new GridLayout(6, 2)); buttonPanel.add(label("")); buttonPanel.add(label("")); - buttonPanel.add(label(core.model.HOVerwaltung.instance().getLanguageString("ls.player.tsi"))); + buttonPanel.add(label(TranslationFacility.tr("ls.player.tsi"))); buttonPanel.add(tsi); buttonPanel.add(label("")); buttonPanel.add(label("")); - buttonPanel.add(label(core.model.HOVerwaltung.instance().getLanguageString("ls.player.form"))); + buttonPanel.add(label(TranslationFacility.tr("ls.player.form"))); buttonPanel.add(form); buttonPanel.add(label("")); buttonPanel.add(label("")); @@ -90,7 +83,7 @@ public void itemStateChanged(ItemEvent e) { } }); - final JButton b = new JButton(core.model.HOVerwaltung.instance().getLanguageString("Calculate")); + final JButton b = new JButton(TranslationFacility.tr("Calculate")); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { final int tsiValue = Integer.parseInt(tsi.getText()); diff --git a/src/main/java/tool/keepertool/ResultPanel.java b/src/main/java/tool/keepertool/ResultPanel.java index 5dde2f177..b1b704325 100644 --- a/src/main/java/tool/keepertool/ResultPanel.java +++ b/src/main/java/tool/keepertool/ResultPanel.java @@ -4,14 +4,12 @@ import core.db.DBManager; import core.gui.comp.panel.ImagePanel; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.player.Player; -import java.awt.BorderLayout; -import java.awt.GridLayout; + +import javax.swing.*; +import java.awt.*; import java.text.DecimalFormat; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JTextArea; /** * Panel where results are shown @@ -52,8 +50,8 @@ public final void reset() { id = 0; average = 0; set.setEnabled(false); - result.setText(core.model.HOVerwaltung.instance().getLanguageString("ls.player.skill")); - set.setText(core.model.HOVerwaltung.instance().getLanguageString("Disabled")); + result.setText(TranslationFacility.tr("ls.player.skill")); + set.setText(TranslationFacility.tr("Disabled")); } /** @@ -73,15 +71,15 @@ protected final void setPlayer(int form, int tsi, int playerId, String name) { final KeeperTool kt = new KeeperTool(form, tsi); id = playerId; - result.setText(core.model.HOVerwaltung.instance().getLanguageString("ls.player.skill") + ": " + df.format(kt.getMin()) + " - " + df.format(kt.getMax())); + result.setText(TranslationFacility.tr("ls.player.skill") + ": " + df.format(kt.getMin()) + " - " + df.format(kt.getMax())); average = kt.getAvg(); if (playerId > 0) { - set.setText(core.model.HOVerwaltung.instance().getLanguageString("OffsetTitle") + " " + set.setText(TranslationFacility.tr("OffsetTitle") + " " + name); set.setEnabled(true); } else { - set.setText(core.model.HOVerwaltung.instance().getLanguageString("Disabled")); + set.setText(TranslationFacility.tr("Disabled")); set.setEnabled(false); } } diff --git a/src/main/java/tool/updater/UpdateController.java b/src/main/java/tool/updater/UpdateController.java index 17768cbd7..c6f92fa96 100644 --- a/src/main/java/tool/updater/UpdateController.java +++ b/src/main/java/tool/updater/UpdateController.java @@ -3,7 +3,7 @@ import com.install4j.api.launcher.Variables; import core.HO; import core.gui.HOMainFrame; -import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.UserParameter; import core.net.MyConnector; import core.util.BrowserLauncher; @@ -75,28 +75,28 @@ private static void showUpdateDialog(VersionInfo updateVersion) { String releaseNoteUrl; switch (versionType) { case "DEV" -> { - updateAvailable = HOVerwaltung.instance().getLanguageString("updateDEVavailable"); + updateAvailable = TranslationFacility.tr("updateDEVavailable"); releaseNoteUrl = RELEASE_NOTES_DEV_URL; } case "BETA" -> { - updateAvailable = HOVerwaltung.instance().getLanguageString("updateBETAavailable"); + updateAvailable = TranslationFacility.tr("updateBETAavailable"); releaseNoteUrl = RELEASE_NOTES_BETA_URL; } default -> { - updateAvailable = HOVerwaltung.instance().getLanguageString("updateStableavailable"); + updateAvailable = TranslationFacility.tr("updateStableavailable"); releaseNoteUrl = RELEASE_NOTES_STABLE_URL; } } int update = JOptionPane.showConfirmDialog(HOMainFrame.instance(), new UpdaterPanel("" + updateAvailable + "

" - + "" + HOVerwaltung.instance().getLanguageString("ls.version") + ":" + + "" + TranslationFacility.tr("ls.version") + ":" + updateVersion.getVersionString() + "
" - + "" + HOVerwaltung.instance().getLanguageString("Released") + ":" + + "" + TranslationFacility.tr("Released") + ":" + updateVersion.getReleaseDate() + "

" - + HOVerwaltung.instance().getLanguageString("ls.button.update") + "?", + + TranslationFacility.tr("ls.button.update") + "?", releaseNoteUrl), - HOVerwaltung.instance().getLanguageString("confirmation.title"), + TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION); // Warning, if install via package, ask user to confirmation @@ -104,8 +104,8 @@ private static void showUpdateDialog(VersionInfo updateVersion) { System.getProperty("install.mode","").equalsIgnoreCase("pkg") && versionType.equals("RELEASE")) { update = JOptionPane.showConfirmDialog(HOMainFrame.instance(), - HOVerwaltung.instance().getLanguageString("ls.button.update.linux.pkg.warning") + "?", - HOVerwaltung.instance().getLanguageString("confirmation.title"), + TranslationFacility.tr("ls.button.update.linux.pkg.warning") + "?", + TranslationFacility.tr("confirmation.title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); } @@ -117,15 +117,15 @@ private static void showUpdateDialog(VersionInfo updateVersion) { private static void showNoUpdateAvailableDialog() { final int currRev = HO.getRevisionNumber(); - JOptionPane.showMessageDialog(HOMainFrame.instance(), HOVerwaltung.instance() - .getLanguageString("updatenotavailable") + JOptionPane.showMessageDialog(HOMainFrame.instance(), + TranslationFacility.tr("updatenotavailable") + "\n\n" - + HOVerwaltung.instance().getLanguageString("ls.version") + + TranslationFacility.tr("ls.version") + ": " + HO.VERSION - + (currRev > 1 ? " (Build " + currRev + ")" : ""), HOVerwaltung.instance() - .getLanguageString("ls.menu.file.update") + " - "+ HOVerwaltung.instance() - .getLanguageString("ls.menu.file.update.ho"), JOptionPane.INFORMATION_MESSAGE); + + (currRev > 1 ? " (Build " + currRev + ")" : ""), + TranslationFacility.tr("ls.menu.file.update") + " - "+ + TranslationFacility.tr("ls.menu.file.update.ho"), JOptionPane.INFORMATION_MESSAGE); } public static String getHOZipDownloadUrl(VersionInfo versionInfo, String versionType) { diff --git a/src/test/java/core/constants/player/PlayerAbilityTest.kt b/src/test/java/core/constants/player/PlayerAbilityTest.kt index f2fbb3d90..55c5c7149 100644 --- a/src/test/java/core/constants/player/PlayerAbilityTest.kt +++ b/src/test/java/core/constants/player/PlayerAbilityTest.kt @@ -2,6 +2,7 @@ package core.constants.player import core.HOModelBuilder import core.model.HOVerwaltung +import core.model.TranslationFacility import core.model.Translator import core.util.Helper import org.junit.jupiter.api.Assertions.assertEquals @@ -17,7 +18,7 @@ class PlayerAbilityTest { .hrfId(42) .build() hoAdmin.model = hoModel - hoAdmin.setTranslator(Translator.LANGUAGE_NO_TRANSLATION) + TranslationFacility.setTranslator(Translator.load(Translator.LANGUAGE_NO_TRANSLATION)) } @Test diff --git a/src/test/java/core/model/TranslationFacilityTest.java b/src/test/java/core/model/TranslationFacilityTest.java new file mode 100644 index 000000000..3444743b1 --- /dev/null +++ b/src/test/java/core/model/TranslationFacilityTest.java @@ -0,0 +1,75 @@ +package core.model; + +import org.junit.jupiter.api.Test; + +import java.util.MissingResourceException; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; + +class TranslationFacilityTest { + + @Test + void getTranslator() { + // given + TranslationFacility.setLanguage(Translator.LANGUAGE_DEFAULT); + + // when + final var translator = TranslationFacility.getTranslator(); + + // then + assertThat(translator.getLanguage()).isEqualTo(Translator.LANGUAGE_DEFAULT); + } + + @Test + void setLanguage_with_German() { + // given + TranslationFacility.setLanguage("German"); + + // when + final var translator = TranslationFacility.getTranslator(); + + // then + assertThat(translator.getLanguage()).isEqualTo("German"); + } + + @Test + void setLanguage_unknown_throws_exception() { + // when-then + assertThatThrownBy(() -> TranslationFacility.setLanguage("foobar")).isInstanceOf(MissingResourceException.class); + } + + @Test + void setTranslator() { + // when + TranslationFacility.setTranslator(null); + + // then + assertThat(TranslationFacility.getTranslator()).isNotNull(); + assertThat(TranslationFacility.getTranslator().getLanguage()).isEqualTo(Translator.LANGUAGE_NO_TRANSLATION); + } + + @Test + void tr_with_initial_translator_results_in_no_translation() { + // given + TranslationFacility.setTranslator(null); + + // when + final var translation = TranslationFacility.tr("ls.button.save"); + + // then + assertThat(translation).isEqualTo("!ls.button.save!"); + } + + @Test + void tr_with_variables() { + // given + TranslationFacility.setLanguage("English"); + + // when + final var translation = TranslationFacility.tr("ls.teamanalyzer.bot_since", "EVER"); + + // then + assertThat(translation).isEqualTo("since EVER"); + } +} \ No newline at end of file diff --git a/src/test/java/core/model/TranslatorTest.java b/src/test/java/core/model/TranslatorTest.java new file mode 100644 index 000000000..6c4b5f086 --- /dev/null +++ b/src/test/java/core/model/TranslatorTest.java @@ -0,0 +1,207 @@ +package core.model; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.stream.Stream; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; +import static org.junit.jupiter.params.provider.Arguments.of; + +class TranslatorTest { + + private static final List SUPPORTED_LANGUAGES = List.of( + "Bulgarian", + "Catalan", + "Chinese", + "Czech", + "Danish", + "English", + "Finnish", + "French", + "Galego", + "Georgian", + "German", + "Greeklish", + "Hangul(Korean)", + "Hebrew", + "Hrvatski(Croatian)", + "Indonesian", + "Italiano", + "Japanese", + "Latvija", + "Lithuanian", + "Magyar", + "Nederlands", + "Norsk", + "Persian", + "Polish", + "Portugues", + "PortuguesBrasil", + "Romanian", + "Russian", + "Serbian(Cyrillic)", + "Slovak", + "Slovenian", + "Spanish", + "Spanish(AR)", + "Svenska", + "Turkish", + "Ukranian", + "Vlaams"); + + private static Stream whitelist() { + return Stream.concat( + SUPPORTED_LANGUAGES.stream().map(Arguments::of), + Stream.of(Arguments.of(Translator.LANGUAGE_NO_TRANSLATION)) + ); + } + + private static Stream blacklist() { + return Stream.of( + "Latin", + "FOOBAR", + "", + null) + .map(Arguments::of); + } + + @Test + void getSupportedLanguages() { + // when + final var supportedLanguages = Translator.getSupportedLanguages(); + + // then + assertThat(supportedLanguages).isEqualTo(SUPPORTED_LANGUAGES.toArray(new String[0])); + } + + @ParameterizedTest + @MethodSource("whitelist") + void isAvailable_true(String language) { + // when + final var available = Translator.isAvailable(language); + + // then + assertThat(available).isTrue(); + } + + @ParameterizedTest + @MethodSource("blacklist") + void isAvailable_false(String language) { + // when + final var available = Translator.isAvailable(language); + + // then + assertThat(available).isFalse(); + } + + @ParameterizedTest + @MethodSource("whitelist") + void load_available(String language) { + // when + final var translator = Translator.load(language); + + // then + assertThat(translator).isNotNull(); + } + + @ParameterizedTest + @MethodSource("blacklist") + void load_missing_throws_exception(String language) { + // when-then + assertThatThrownBy(() -> Translator.load(language)) + .isInstanceOf(MissingResourceException.class); + } + + @Test + void loadDefault() { + // when + final var translator = Translator.loadDefault(); + + // then + assertThat(translator.getLanguage()).isEqualTo(Translator.LANGUAGE_DEFAULT); + } + + @ParameterizedTest + @MethodSource("whitelist") + void getLanguage(String language) { + // given + final var translator = Translator.load(language); + + // when-then + assertThat(translator.getLanguage()).isEqualTo(language); + } + + @ParameterizedTest + @MethodSource("whitelist") + void getResourceBundle(String language) { + // given + final var translator = Translator.load(language); + + // when-then + assertThat(translator.getResourceBundle()).isNotNull(); + } + + @ParameterizedTest + @MethodSource("whitelist") + void getLocale(String language) { + // given + final var translator = Translator.load(language); + + // when-then + if (StringUtils.endsWithIgnoreCase(language, "FRENCH")) { + assertThat(translator.getLocale()).isEqualTo(Locale.FRENCH); + } else { + assertThat(translator.getLocale()).isEqualTo(Locale.ENGLISH); + } + } + + private static Stream translate() { + return Stream.of( + of("English", "ls.core.preferences.misc.language", "Language"), + of("English", "ls.button.save", "Save"), + of("English", "ls.player.shirtnumber", "Shirt number"), + of("German", "ls.core.preferences.misc.language", "Sprache"), + of("German", "ls.button.save", "Speichern"), + of("German", "ls.player.shirtnumber", "Trikotnummer"), + of(Translator.LANGUAGE_DEFAULT, "ls.core.preferences.misc.language", "Language"), + of(Translator.LANGUAGE_DEFAULT, "ls.button.save", "Save"), + of(Translator.LANGUAGE_DEFAULT, "ls.player.shirtnumber", "Shirt number") + ); + } + + @ParameterizedTest + @MethodSource + void translate(String language, String key, String expectedTranslation) { + // given + final var translator = Translator.load(language); + + // when-then + assertThat(translator.translate(key)).isEqualTo(expectedTranslation); + } + + private static Stream translateWithVariables() { + return Stream.of( + of("English", "ls.teamanalyzer.bot_since", new String[]{"EVER"}, "since EVER"), + of("English", "ls.teamanalyzer.league_position_val", ArrayUtils.toObject(new int[]{1, 2, 3}), "1 in 2 (3)") + ); + } + + @ParameterizedTest + @MethodSource + void translateWithVariables(String language, String key, Object[] values, String expectedTranslation) { + // given + final var translator = Translator.load(language); + + // when-then + assertThat(translator.translate(key, values)).isEqualTo(expectedTranslation); + } +} \ No newline at end of file diff --git a/src/test/java/core/playeravatars/PlayerAvatars.java b/src/test/java/core/playeravatars/PlayerAvatars.java index bf6d041d7..9dcb7bb3f 100644 --- a/src/test/java/core/playeravatars/PlayerAvatars.java +++ b/src/test/java/core/playeravatars/PlayerAvatars.java @@ -3,6 +3,7 @@ import core.HO; import core.db.DBManager; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.Translator; import core.net.MyConnector; @@ -22,7 +23,7 @@ public static void main(String[] args) throws IOException { HO.setPortable_version(true); DBManager.instance().loadUserParameter(); HOVerwaltung.instance().loadLatestHoModel(); - HOVerwaltung.instance().setTranslator(Translator.LANGUAGE_DEFAULT); + TranslationFacility.setLanguage(Translator.LANGUAGE_DEFAULT); // HOVerwaltung.instance().set final MyConnector mc = MyConnector.instance(); diff --git a/src/test/java/core/training/TrainingManagerTest.java b/src/test/java/core/training/TrainingManagerTest.java index 33e17c9f5..fe0054889 100644 --- a/src/test/java/core/training/TrainingManagerTest.java +++ b/src/test/java/core/training/TrainingManagerTest.java @@ -2,6 +2,7 @@ import core.HO; import core.model.HOVerwaltung; +import core.model.TranslationFacility; import core.model.Translator; import java.time.Instant; @@ -13,7 +14,7 @@ public static void main(String[] args) { HO.setPortable_version(true); HOVerwaltung.instance().loadLatestHoModel(); - HOVerwaltung.instance().setTranslator(Translator.LANGUAGE_DEFAULT); + TranslationFacility.setLanguage(Translator.LANGUAGE_DEFAULT); Instant endDate = Instant.now(); Instant startDate = endDate.minus(7, ChronoUnit.DAYS);