mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
fix macOs language selection
This commit is contained in:
@@ -89,8 +89,10 @@ public class LangUtil {
|
|||||||
LOG.info("Loading translation for " + language);
|
LOG.info("Loading translation for " + language);
|
||||||
dict = new HashMap<String, String>();
|
dict = new HashMap<String, String>();
|
||||||
try {
|
try {
|
||||||
|
String path = ResourceLoader.getFile(LANG_DIR + File.separator + language + ".txt").getAbsolutePath();
|
||||||
|
LOG.debug("Loading language file: " + path);
|
||||||
try (Stream<String> stream = Files.lines(
|
try (Stream<String> stream = Files.lines(
|
||||||
Paths.get(LANG_DIR + File.separator + language + ".txt"), StandardCharsets.UTF_8)) {
|
Paths.get(path), StandardCharsets.UTF_8)) {
|
||||||
stream.forEach(s -> {
|
stream.forEach(s -> {
|
||||||
if (s.contains("|")) {
|
if (s.contains("|")) {
|
||||||
String[] parts = s.split("\\|");
|
String[] parts = s.split("\\|");
|
||||||
|
|||||||
@@ -431,13 +431,17 @@ public class Presenter implements IPlugInPort {
|
|||||||
Set<Class<?>> componentTypeClasses = null;
|
Set<Class<?>> componentTypeClasses = null;
|
||||||
try {
|
try {
|
||||||
componentTypeClasses = Utils.getClasses("org.diylc.components");
|
componentTypeClasses = Utils.getClasses("org.diylc.components");
|
||||||
try {
|
File libraryFile = new File("library");
|
||||||
List<Class<?>> additionalComponentTypeClasses =
|
if (libraryFile.exists() && libraryFile.isDirectory()) {
|
||||||
JarScanner.getInstance().scanFolder("library", IDIYComponent.class);
|
LOG.info("Loading additional library JARs");
|
||||||
if (additionalComponentTypeClasses != null)
|
try {
|
||||||
componentTypeClasses.addAll(additionalComponentTypeClasses);
|
List<Class<?>> additionalComponentTypeClasses =
|
||||||
} catch (Exception e) {
|
JarScanner.getInstance().scanFolder("library", IDIYComponent.class);
|
||||||
LOG.warn("Could not find additional type classes", e);
|
if (additionalComponentTypeClasses != null)
|
||||||
|
componentTypeClasses.addAll(additionalComponentTypeClasses);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Could not find additional type classes", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Class<?> clazz : componentTypeClasses) {
|
for (Class<?> clazz : componentTypeClasses) {
|
||||||
|
|||||||
@@ -3333,6 +3333,10 @@
|
|||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Dragging components from the component tree to the canvas stops working once the component type is selected in the tree</description>
|
<description>Dragging components from the component tree to the canvas stops working once the component type is selected in the tree</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>macOS: fixed language selection that does not work</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class ResourceLoader {
|
|||||||
String bundlePath;
|
String bundlePath;
|
||||||
try {
|
try {
|
||||||
bundlePath = com.apple.eio.FileManager.getPathToApplicationBundle();
|
bundlePath = com.apple.eio.FileManager.getPathToApplicationBundle();
|
||||||
LOG.debug("Detected OSX bundle path: " + bundlePath);
|
//LOG.debug("Detected OSX bundle path: " + bundlePath);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
bundlePath = null; // on non-OSX platforms
|
bundlePath = null; // on non-OSX platforms
|
||||||
}
|
}
|
||||||
@@ -48,4 +48,26 @@ public class ResourceLoader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File getFile(String relativePath) {
|
||||||
|
String bundlePath;
|
||||||
|
try {
|
||||||
|
bundlePath = com.apple.eio.FileManager.getPathToApplicationBundle();
|
||||||
|
//LOG.debug("Detected OSX bundle path: " + bundlePath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
bundlePath = null; // on non-OSX platforms
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String absolutePath;
|
||||||
|
if (bundlePath == null)
|
||||||
|
absolutePath = relativePath;
|
||||||
|
else
|
||||||
|
absolutePath = bundlePath + File.separator + "Contents" + File.separator + "Resources" + File.separator + relativePath;
|
||||||
|
File absoluteFile = new File(absolutePath);
|
||||||
|
return absoluteFile;
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error while finding file: " + relativePath, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ Electrode Labels|Oznake Elektroda
|
|||||||
Electro-Mechanical|Elektro-Mehaničke
|
Electro-Mechanical|Elektro-Mehaničke
|
||||||
Enable Cache Boost|Uključi Keš-Ubrzanje
|
Enable Cache Boost|Uključi Keš-Ubrzanje
|
||||||
End Arrow|Krajnja Strelica
|
End Arrow|Krajnja Strelica
|
||||||
Enjoying DIYLC? Click here to buy me a coffee :)|Uživate koristeći DIYLC? Kupite mi kafu :)
|
Enjoying DIYLC? Click here to buy me a coffee :)|Uživate koristeći DIYLC? Častite me kafom :)
|
||||||
Error|Greška
|
Error|Greška
|
||||||
Error occurred while editing selection. Check the log for details.|Nastala je greška prilikom izmene. Proverite log za više informacija.
|
Error occurred while editing selection. Check the log for details.|Nastala je greška prilikom izmene. Proverite log za više informacija.
|
||||||
Exit|Izlaz
|
Exit|Izlaz
|
||||||
|
|||||||
@@ -160,6 +160,8 @@ public class ActionBarPlugin implements IPlugIn {
|
|||||||
toggleItems.add(new ToggleItem(IPlugInPort.SNAP_TO_COMPONENTS, IPlugInPort.SNAP_TO_COMPONENTS, IconLoader.SnapToComponents.getIcon()));
|
toggleItems.add(new ToggleItem(IPlugInPort.SNAP_TO_COMPONENTS, IPlugInPort.SNAP_TO_COMPONENTS, IconLoader.SnapToComponents.getIcon()));
|
||||||
configToolbar.addToggleLabel(LangUtil.translate("Snap To"), IPlugInPort.SNAP_TO_KEY, IPlugInPort.SNAP_TO_DEFAULT, toggleItems);
|
configToolbar.addToggleLabel(LangUtil.translate("Snap To"), IPlugInPort.SNAP_TO_KEY, IPlugInPort.SNAP_TO_DEFAULT, toggleItems);
|
||||||
|
|
||||||
|
configToolbar.add(new JLabel(" "));
|
||||||
|
|
||||||
configToolbar.add(LangUtil.translate("Continuous Creation"), IPlugInPort.CONTINUOUS_CREATION_KEY, IconLoader.Elements.getIcon(), false);
|
configToolbar.add(LangUtil.translate("Continuous Creation"), IPlugInPort.CONTINUOUS_CREATION_KEY, IconLoader.Elements.getIcon(), false);
|
||||||
configToolbar.add(LangUtil.translate("Highlight Connected Areas"), IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, IconLoader.LaserPointer.getIcon(), false);
|
configToolbar.add(LangUtil.translate("Highlight Connected Areas"), IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, IconLoader.LaserPointer.getIcon(), false);
|
||||||
configToolbar.add(LangUtil.translate("Sticky Points"), IPlugInPort.STICKY_POINTS_KEY, IconLoader.GraphNodes.getIcon(), true);
|
configToolbar.add(LangUtil.translate("Sticky Points"), IPlugInPort.STICKY_POINTS_KEY, IconLoader.GraphNodes.getIcon(), true);
|
||||||
|
|||||||
Reference in New Issue
Block a user