diff --git a/source/net/filebot/ui/rename/Preset.java b/source/net/filebot/ui/rename/Preset.java index d6e8aab4..1be1733d 100644 --- a/source/net/filebot/ui/rename/Preset.java +++ b/source/net/filebot/ui/rename/Preset.java @@ -145,8 +145,8 @@ public class Preset { } } - public Locale getLanguage() { - return language == null || language.isEmpty() ? null : new Locale(language); + public Language getLanguage() { + return language == null || language.isEmpty() ? null : Language.getLanguage(language); } public StandardRenameAction getRenameAction() { diff --git a/source/net/filebot/ui/rename/PresetEditor.java b/source/net/filebot/ui/rename/PresetEditor.java index 618fae13..9b637a22 100644 --- a/source/net/filebot/ui/rename/PresetEditor.java +++ b/source/net/filebot/ui/rename/PresetEditor.java @@ -12,6 +12,7 @@ import java.awt.event.ActionEvent; import java.io.File; import java.util.EnumSet; import java.util.List; +import java.util.Locale; import java.util.logging.Level; import javax.swing.AbstractAction; @@ -169,6 +170,16 @@ public class PresetEditor extends JDialog { matchModeCombo.setSelectedItem(p.getMatchMode() == null ? RenamePanel.MATCH_MODE_OPPORTUNISTIC : p.getMatchMode()); actionCombo.setSelectedItem(p.getRenameAction() == null ? StandardRenameAction.MOVE : p.getRenameAction()); + // ugly hack, since Language objects only do object equality + if (p.getLanguage() != null && !p.getLanguage().getCode().equals(((Language) languageCombo.getSelectedItem()).getCode())) { + for (int i = 0; i < languageCombo.getModel().getSize(); i++) { + if (p.getLanguage().getCode().equals(languageCombo.getModel().getElementAt(i).getCode())) { + languageCombo.setSelectedIndex(i); + break; + } + } + } + selectRadio.setSelected(p.getInputFolder() != null); updateComponentStates(); } diff --git a/source/net/filebot/ui/rename/RenamePanel.java b/source/net/filebot/ui/rename/RenamePanel.java index b461f24c..8e5676a5 100644 --- a/source/net/filebot/ui/rename/RenamePanel.java +++ b/source/net/filebot/ui/rename/RenamePanel.java @@ -722,7 +722,7 @@ public class RenamePanel extends JComponent { @Override public Locale getLocale(ActionEvent evt) { - return preset.getLanguage() != null ? preset.getLanguage() : super.getLocale(evt); + return preset.getLanguage() != null ? preset.getLanguage().getLocale() : super.getLocale(evt); } @Override