Fix: removes all minus from the description fields since they mess up the carousel

This commit is contained in:
lantzelot-swe 2021-02-11 21:51:49 +01:00
parent bad517d5e9
commit 28a642ba09
2 changed files with 16 additions and 5 deletions

View File

@ -75,6 +75,7 @@ public class InfoModel extends AbstractModel
//Replace all double spaces, tabs and newlines
this.description = description.replaceAll("\\s\\s+", " ");
this.description = this.description.replace("\t", " ");
this.description = this.description.replace("-", " ");
if (!Objects.equals(old, description))
{
notifyChange();
@ -92,6 +93,7 @@ public class InfoModel extends AbstractModel
//Replace all double spaces, tabs and newlines
this.description_de = description.replaceAll("\\s\\s+", " ");
this.description_de = this.description_de.replace("\t", " ");
this.description_de = this.description_de.replace("-", " ");
if (!Objects.equals(old, description))
{
notifyChange();
@ -109,6 +111,7 @@ public class InfoModel extends AbstractModel
//Replace all double spaces, tabs and newlines
this.description_fr = description.replaceAll("\\s\\s+", " ");
this.description_fr = this.description_fr.replace("\t", " ");
this.description_fr = this.description_fr.replace("-", " ");
if (!Objects.equals(old, description))
{
notifyChange();
@ -126,6 +129,7 @@ public class InfoModel extends AbstractModel
//Replace all double spaces, tabs and newlines
this.description_es = description.replaceAll("\\s\\s+", " ");
this.description_es = this.description_es.replace("\t", " ");
this.description_es = this.description_es.replace("-", " ");
if (!Objects.equals(old, description))
{
notifyChange();
@ -143,6 +147,7 @@ public class InfoModel extends AbstractModel
//Replace all double spaces, tabs and newlines
this.description_it = description.replaceAll("\\s\\s+", " ");
this.description_it = this.description_it.replace("\t", " ");
this.description_it = this.description_it.replace("-", " ");
if (!Objects.equals(old, description))
{
notifyChange();

View File

@ -340,18 +340,19 @@ public class FileManager
fw.write("T:" + gameDetails.getTitle() + "\n");
fw.write("X:" + gameDetails.getSystem() + "\n");
fw.write("D:en:" + gameDetails.getDescription() + "\n");
String description = replaceMinus(gameDetails.getDescription());
fw.write("D:en:" + description + "\n");
fw.write("D:de:" +
(gameDetails.getDescriptionDe().isEmpty() ? gameDetails.getDescription() : gameDetails.getDescriptionDe()) +
(gameDetails.getDescriptionDe().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionDe())) +
"\n");
fw.write("D:fr:" +
(gameDetails.getDescriptionFr().isEmpty() ? gameDetails.getDescription() : gameDetails.getDescriptionFr()) +
(gameDetails.getDescriptionFr().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionFr())) +
"\n");
fw.write("D:es:" +
(gameDetails.getDescriptionEs().isEmpty() ? gameDetails.getDescription() : gameDetails.getDescriptionEs()) +
(gameDetails.getDescriptionEs().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionEs())) +
"\n");
fw.write("D:it:" +
(gameDetails.getDescriptionIt().isEmpty() ? gameDetails.getDescription() : gameDetails.getDescriptionIt()) +
(gameDetails.getDescriptionIt().isEmpty() ? description : replaceMinus(gameDetails.getDescriptionIt())) +
"\n");
if (!gameDetails.getAuthor().isEmpty())
{
@ -389,6 +390,11 @@ public class FileManager
}
fw.close();
}
private String replaceMinus(String description)
{
return description.replaceAll("-", " ");
}
public void runVice(boolean appendGame)
{