diff --git a/src/main/java/de/neemann/digital/draw/shapes/TextShape.java b/src/main/java/de/neemann/digital/draw/shapes/TextShape.java index fa1b44c3a..a7cc68f0d 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/TextShape.java +++ b/src/main/java/de/neemann/digital/draw/shapes/TextShape.java @@ -22,25 +22,20 @@ public class TextShape implements Shape { private final String text; private final int fontSize; - private Orientation orientation; + private final Orientation orientation; /** - * Create a new instance + * Creates a new instance * * @param attr attributes * @param inputs the inputs * @param outputs the outputs */ public TextShape(ElementAttributes attr, PinDescriptions inputs, PinDescriptions outputs) { - String text = attr.get(Keys.DESCRIPTION); - if (text.length() == 0) { - String gen = attr.get(Keys.GENERIC); - if (gen.isEmpty()) - text = Lang.get("elem_Text"); - else - text = gen.replace(" ", "\u00A0"); - } - this.text = Lang.evalMultilingualContent(text); + String text = Lang.evalMultilingualContent(attr.get(Keys.DESCRIPTION)); + if (text.isEmpty()) + text = Lang.get("elem_Text"); + this.text = text; fontSize = attr.get(Keys.FONT_SIZE); orientation = attr.get(Keys.TEXT_ORIENTATION); diff --git a/src/main/java/de/neemann/digital/lang/Lang.java b/src/main/java/de/neemann/digital/lang/Lang.java index 2a95bbe79..07b3dafdb 100644 --- a/src/main/java/de/neemann/digital/lang/Lang.java +++ b/src/main/java/de/neemann/digital/lang/Lang.java @@ -141,6 +141,8 @@ static String evalMultilingualContent(String text, Language currentLanguage) { String l = text.substring(pos + 2, pos + 4); if (l.equalsIgnoreCase(currentLanguage.getName())) return text.substring(pos + 4, p2).trim(); + if (l.equalsIgnoreCase("en") && def.isEmpty()) + def = text.substring(pos + 4, p2).trim(); pos = text.indexOf("{{", p2); } else