fix: custom language is saved in the property file
This commit is contained in:
parent
7707885ccd
commit
81c164e3c8
|
@ -17,9 +17,11 @@ import javax.swing.JPanel;
|
|||
import javax.swing.JTextField;
|
||||
|
||||
import se.lantz.model.InfoModel;
|
||||
import se.lantz.util.FileManager;
|
||||
|
||||
public class TranslationPanel extends JPanel
|
||||
{
|
||||
private static final String CUSTOM_LANGUAGE_PROPERTY = "customLanguage";
|
||||
private static final String EN = "English (en)";
|
||||
private static final String DE = "German (de)";
|
||||
private static final String FR = "French (fr)";
|
||||
|
@ -39,6 +41,7 @@ public class TranslationPanel extends JPanel
|
|||
private JCheckBox customCheckBox;
|
||||
private JTextField customTextField;
|
||||
private JLabel infoLabel;
|
||||
private String customLanguage;
|
||||
|
||||
public TranslationPanel(InfoModel model)
|
||||
{
|
||||
|
@ -81,6 +84,13 @@ public class TranslationPanel extends JPanel
|
|||
gbc_customPanel.gridx = 0;
|
||||
gbc_customPanel.gridy = 3;
|
||||
add(getCustomPanel(), gbc_customPanel);
|
||||
|
||||
customLanguage = FileManager.getConfiguredProperties().getProperty(CUSTOM_LANGUAGE_PROPERTY);
|
||||
if (customLanguage == null)
|
||||
{
|
||||
customLanguage = "";
|
||||
}
|
||||
getCustomTextField().setText(customLanguage);
|
||||
}
|
||||
|
||||
private JLabel getSelectFromLabel()
|
||||
|
@ -271,6 +281,12 @@ public class TranslationPanel extends JPanel
|
|||
returnList.add("it");
|
||||
}
|
||||
}
|
||||
|
||||
//Store custom language if entered
|
||||
if (!getCustomTextField().getText().isEmpty())
|
||||
{
|
||||
FileManager.getConfiguredProperties().put(CUSTOM_LANGUAGE_PROPERTY, getCustomTextField().getText());
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.util.zip.GZIPOutputStream;
|
|||
import java.util.zip.ZipEntry;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ListModel;
|
||||
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -39,7 +38,6 @@ import se.lantz.model.InfoModel;
|
|||
import se.lantz.model.MainViewModel;
|
||||
import se.lantz.model.SystemModel;
|
||||
import se.lantz.model.data.GameDetails;
|
||||
import se.lantz.model.data.GameListData;
|
||||
|
||||
public class FileManager
|
||||
{
|
||||
|
@ -343,17 +341,13 @@ public class FileManager
|
|||
String description = replaceMinus(gameDetails.getDescription());
|
||||
fw.write("D:en:" + description + "\n");
|
||||
fw.write("D:de:" +
|
||||
(gameDetails.getDescriptionDe().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionDe())) +
|
||||
"\n");
|
||||
(gameDetails.getDescriptionDe().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionDe())) + "\n");
|
||||
fw.write("D:fr:" +
|
||||
(gameDetails.getDescriptionFr().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionFr())) +
|
||||
"\n");
|
||||
(gameDetails.getDescriptionFr().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionFr())) + "\n");
|
||||
fw.write("D:es:" +
|
||||
(gameDetails.getDescriptionEs().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionEs())) +
|
||||
"\n");
|
||||
(gameDetails.getDescriptionEs().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionEs())) + "\n");
|
||||
fw.write("D:it:" +
|
||||
(gameDetails.getDescriptionIt().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionIt())) +
|
||||
"\n");
|
||||
(gameDetails.getDescriptionIt().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionIt())) + "\n");
|
||||
if (!gameDetails.getAuthor().isEmpty())
|
||||
{
|
||||
fw.write("A:" + gameDetails.getAuthor() + "\n");
|
||||
|
@ -390,10 +384,10 @@ public class FileManager
|
|||
}
|
||||
fw.close();
|
||||
}
|
||||
|
||||
|
||||
private String replaceMinus(String description)
|
||||
{
|
||||
return description.replaceAll("-", " ");
|
||||
return description.replaceAll("-", " ");
|
||||
}
|
||||
|
||||
public void runVice(boolean appendGame)
|
||||
|
@ -676,7 +670,6 @@ public class FileManager
|
|||
deleteDirContent(new File(SCREENS), false);
|
||||
deleteDirContent(new File(GAMES), false);
|
||||
}
|
||||
|
||||
|
||||
private static void deleteDirContent(File dir, boolean deleteAll)
|
||||
{
|
||||
|
@ -688,7 +681,7 @@ public class FileManager
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void deleteFilesForGame(GameDetails details)
|
||||
{
|
||||
if (!details.getCover().isEmpty())
|
||||
|
|
Loading…
Reference in New Issue