Skip to content

Commit

Permalink
Update german, some additional translations. This is nearly the remai…
Browse files Browse the repository at this point in the history
…ning part. (#747)

* Updated german translation
* renamed MakelangeloSettingsPanel to ApplicationSettings
* updating translations
* added limited support for multiple authors
* updated actions for node20
  • Loading branch information
peter-pri authored May 31, 2024
1 parent a277fb9 commit e453a73
Show file tree
Hide file tree
Showing 45 changed files with 511 additions and 639 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
UPLOAD_URL: https://uploads.github.com/repos/MarginallyClever/Makelangelo-software/releases/54908875/assets{?name,label}
RELEASE_ID: 54908875 # same as above (id can just be taken out the upload_url, it's used to find old releases)


on:
push:
pull_request:
Expand All @@ -14,9 +15,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v4

- uses: actions/setup-java@v3.9.0
- uses: actions/setup-java@v4.2.1
with:
distribution: 'temurin'
java-version: '17'
Expand Down Expand Up @@ -67,10 +68,10 @@ jobs:

- name: Deploy universal release
if: github.repository == 'MarginallyClever/Makelangelo-software' && github.ref == 'refs/heads/master'
uses: WebFreak001/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
uses: WebFreak001/[email protected]
with:
permission: write-all
token: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}
asset_path: Makelangelo.zip # path to archive to upload
Expand All @@ -79,7 +80,7 @@ jobs:
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted

- name: Upload artifact for package
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4.3.3
with:
name: jar
retention-days: 1
Expand All @@ -105,7 +106,7 @@ jobs:
distribution: 'temurin'
java-version: '17'

- uses: actions/download-artifact@v3.0.2
- uses: actions/download-artifact@v4.1.7
with:
name: jar

Expand All @@ -129,10 +130,10 @@ jobs:
- name: Deploy installation release
# if: github.repository == 'MarginallyClever/Makelangelo-software'
# if: github.repository == 'MarginallyClever/Makelangelo-software' && github.ref == 'refs/heads/master'
uses: WebFreak001/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
uses: WebFreak001/[email protected]
with:
permission: write-all
token: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}
asset_path: ${{ env.BINARY }} # path to archive to upload
Expand All @@ -142,7 +143,7 @@ jobs:

- name: Upload artifact for testing purpose
# if: github.repository == 'MarginallyClever/Makelangelo-software' || github.ref != 'refs/heads/master'
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.BINARY }}
retention-days: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import java.util.EventObject;

public class NetworkSessionEvent extends EventObject {
/**
*
*/
private static final long serialVersionUID = -1727188492088759549L;
// connection has been opened
public static final int CONNECTION_OPENED = 1;
// connection has closed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* @author Dan Royer
*/
public class ButtonIcon extends JButton {
@Serial
private static final long serialVersionUID = 6329805223648415348L;
private static final Logger logger = LoggerFactory.getLogger(ButtonIcon.class);

public ButtonIcon(String translation, String iconPath) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.marginallyclever.convenience;

import com.marginallyclever.makelangelo.makelangelosettingspanel.SoundPreferences;
import com.marginallyclever.makelangelo.applicationsettings.SoundPreferences;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -34,7 +34,7 @@ static public void playConnectSound() {
}

static public void playDisconnectSound() {
playSound(SoundPreferences.getDisonnectSoundFilename());
playSound(SoundPreferences.getDisconnectSoundFilename());
}

static public void playConversionFinishedSound() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
public class LogPanel extends JPanel {
private static final Logger logger = LoggerFactory.getLogger(LogPanel.class);

private static final long serialVersionUID = -2753297349917155256L;

private final JTextArea logArea = new JTextArea();
private final JComboBox<File> filesJComboBox = new JComboBox<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.marginallyclever.makelangelo;

import com.marginallyclever.convenience.ColorRGB;
import com.marginallyclever.makelangelo.select.*;

import javax.swing.*;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/marginallyclever/makelangelo/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.marginallyclever.makelangelo.makeart.turtlegenerator.TurtleGenerator;
import com.marginallyclever.makelangelo.makeart.turtlegenerator.TurtleGeneratorFactory;
import com.marginallyclever.makelangelo.makeart.turtlegenerator.TurtleGeneratorPanel;
import com.marginallyclever.makelangelo.makelangelosettingspanel.GFXPreferences;
import com.marginallyclever.makelangelo.makelangelosettingspanel.MakelangeloSettingPanel;
import com.marginallyclever.makelangelo.applicationsettings.GFXPreferences;
import com.marginallyclever.makelangelo.applicationsettings.ApplicationSettings;
import com.marginallyclever.makelangelo.paper.PaperSettingsPanel;
import com.marginallyclever.makelangelo.plotter.PiCaptureAction;
import com.marginallyclever.makelangelo.plotter.marlinsimulation.MarlinSimulation;
Expand Down Expand Up @@ -40,7 +40,7 @@ public class MainMenu extends JMenuBar {
private final Makelangelo app;
private final SaveDialog saveDialog = new SaveDialog();
private RecentFiles recentFiles;
private final MakelangeloSettingPanel myPreferencesPanel = new MakelangeloSettingPanel();
private final ApplicationSettings myPreferencesPanel = new ApplicationSettings();
private boolean isMacOS = false;

public MainMenu(Makelangelo app) {
Expand Down Expand Up @@ -101,7 +101,7 @@ private JMenu createFileMenu() {

menu.addSeparator();

JMenuItem buttonAdjustPreferences = new JMenuItem(Translator.get("MenuPreferences"));
JMenuItem buttonAdjustPreferences = new JMenuItem(Translator.get("ApplicationSettings.title"));
buttonAdjustPreferences.addActionListener((e)-> myPreferencesPanel.run(SwingUtilities.getWindowAncestor(this)));
if (isMacOS) {
buttonAdjustPreferences.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, SHORTCUT_CTRL));//"cmd ,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.marginallyclever.makelangelo.makeart.io.OpenFileChooser;
import com.marginallyclever.makelangelo.makeart.io.SaveGCode;
import com.marginallyclever.makelangelo.makeart.io.TurtleFactory;
import com.marginallyclever.makelangelo.makelangelosettingspanel.LanguagePreferences;
import com.marginallyclever.makelangelo.makelangelosettingspanel.MetricsPreferences;
import com.marginallyclever.makelangelo.applicationsettings.LanguagePreferences;
import com.marginallyclever.makelangelo.applicationsettings.MetricsPreferences;
import com.marginallyclever.makelangelo.paper.Paper;
import com.marginallyclever.makelangelo.plotter.Plotter;
import com.marginallyclever.makelangelo.plotter.plotterrenderer.PlotterRenderer;
Expand Down Expand Up @@ -171,7 +171,7 @@ private void checkSharingPermission() {
int comparison = MakelangeloVersion.VERSION.compareTo(v);
if(comparison!=0) {
preferences.put(SHARING_CHECK_STRING, MakelangeloVersion.VERSION);
int dialogResult = JOptionPane.showConfirmDialog(mainFrame, Translator.get("collectAnonymousMetricsOnUpdate"),"Sharing Is Caring",JOptionPane.YES_NO_OPTION);
int dialogResult = JOptionPane.showConfirmDialog(mainFrame, Translator.get("MetricsPreferences.collectAnonymousMetricsOnUpdate"),"Sharing Is Caring",JOptionPane.YES_NO_OPTION);
MetricsPreferences.setAllowedToShare(dialogResult == JOptionPane.YES_OPTION);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

public final class RecentFiles extends JMenu {
private static final Logger logger = LoggerFactory.getLogger(RecentFiles.class);

private static final long serialVersionUID = -4331360984016876093L;

public final int MAX_FILES = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private static boolean attemptToLoadLanguageXML(String name) throws Exception {
stream.close();

if( !lang.getName().isEmpty() &&
!lang.getAuthor().isEmpty()) {
!lang.getAuthors().isEmpty()) {
// we loaded a language file that seems pretty legit.
languages.put(lang.getName(), lang);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.*;

public class TranslatorLanguage {
private static final Logger logger = LoggerFactory.getLogger(TranslatorLanguage.class);

private String name = "";
private String author = "";
private final List<String> authors = new ArrayList<>();
private final Map<String, String> strings = new HashMap<>();


Expand Down Expand Up @@ -67,21 +65,44 @@ private void load(Document dom) {
final Element docEle = dom.getDocumentElement();

name = docEle.getElementsByTagName("name").item(0).getFirstChild().getNodeValue();
author = docEle.getElementsByTagName("author").item(0).getFirstChild().getNodeValue();
readAllAuthors(docEle);
readAllStrings(docEle);
}

private void readAllAuthors(Element docEle) {
NodeList authors = docEle.getElementsByTagName("authors");
for (int i = 0; i < authors.getLength(); i++) {
Node authorNode = authors.item(i);
if (authorNode.getNodeType() == Node.ELEMENT_NODE) {
Element authorElement = (Element) authorNode;
NodeList authorList = authorElement.getElementsByTagName("author");
for (int j = 0; j < authorList.getLength(); j++) {
Node author = authorList.item(j);
if (author.getNodeType() == Node.ELEMENT_NODE) {
Element authorElement2 = (Element) author;
this.authors.add(authorElement2.getFirstChild().getNodeValue());
}
}
}
}
}

/**
* read all key/value pairs from the xml file.
* @param docEle the root element of the xml file
*/
private void readAllStrings(Element docEle) {
NodeList nl = docEle.getElementsByTagName("string");
if (nl.getLength() > 0) {
for (int i = 0; i < nl.getLength(); i++) {
for (int i = 0; i < nl.getLength(); i++) {

//get the element
Element el = (Element) nl.item(i);
String key = getTextValue(el, "key");
String value = getTextValue(el, "value");
//get the element
Element el = (Element) nl.item(i);
String key = getTextValue(el, "key");
String value = getTextValue(el, "value");

// store key/value pairs into a map
//logger.debug(language_file +"\t"+key+"\t=\t"+value);
strings.put(key, value);
}
// store key/value pairs into a map
//logger.debug(language_file +"\t"+key+"\t=\t"+value);
strings.put(key, value);
}
}

Expand Down Expand Up @@ -143,8 +164,8 @@ public String getName() {
return name;
}

public String getAuthor() {
return author;
public List<String> getAuthors() {
return authors;
}

public Set<String> getKeys() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.marginallyclever.makelangelo.makelangelosettingspanel;
package com.marginallyclever.makelangelo.applicationsettings;

import com.marginallyclever.makelangelo.Translator;
import com.marginallyclever.util.PreferencesHelper;
Expand All @@ -13,14 +13,13 @@
import java.util.prefs.Preferences;

/**
* Application plottersettings
* Application settings
* @author Dan Royer
*
*/
public class MakelangeloSettingPanel {
private static final Logger logger = LoggerFactory.getLogger(MakelangeloSettingPanel.class);
public class ApplicationSettings {
private static final Logger logger = LoggerFactory.getLogger(ApplicationSettings.class);

public MakelangeloSettingPanel() {
public ApplicationSettings() {
super();
}

Expand All @@ -45,23 +44,18 @@ public void run(Component parentComponent) {
panel.add(top,BorderLayout.NORTH);

JTabbedPane pane = new JTabbedPane();
pane.add(Translator.get("MenuSoundsTitle"), SoundPreferences.buildPanel());
pane.add(Translator.get("MenuGraphicsTitle"), GFXPreferences.buildPanel());
pane.add(Translator.get("MenuLanguageTitle"), LanguagePreferences.buildPanel());
pane.add(Translator.get("MenuMetricsTitle"), MetricsPreferences.buildPanel());
pane.add(Translator.get("SoundPreferences.Title"), SoundPreferences.buildPanel());
pane.add(Translator.get("GFXPreferences.Title"), GFXPreferences.buildPanel());
pane.add(Translator.get("LanguagePreferences.Title"), LanguagePreferences.buildPanel());
pane.add(Translator.get("MetricsPreferences.Title"), MetricsPreferences.buildPanel());
panel.add(pane,BorderLayout.CENTER);

int result = JOptionPane.showConfirmDialog(parentComponent, panel, Translator.get("MenuPreferences"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
int result = JOptionPane.showConfirmDialog(parentComponent, panel, Translator.get("ApplicationSettings.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (result == JOptionPane.OK_OPTION) {
SoundPreferences.save();
GFXPreferences.save();
LanguagePreferences.save();
MetricsPreferences.save();
} else {
SoundPreferences.cancel();
GFXPreferences.cancel();
LanguagePreferences.cancel();
MetricsPreferences.cancel();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.marginallyclever.makelangelo.makelangelosettingspanel;
package com.marginallyclever.makelangelo.applicationsettings;

import com.marginallyclever.makelangelo.Translator;
import com.marginallyclever.makelangelo.select.SelectBoolean;
import com.marginallyclever.makelangelo.select.SelectPanel;
import com.marginallyclever.makelangelo.select.SelectSpinner;
import com.marginallyclever.util.PreferencesHelper;

import javax.swing.event.EventListenerList;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.util.prefs.Preferences;

import com.marginallyclever.makelangelo.Translator;
import com.marginallyclever.makelangelo.select.*;
import com.marginallyclever.util.PreferencesHelper;

/**
* Graphics plottersettings
* @author Dan Royer
Expand All @@ -20,18 +21,18 @@ public class GFXPreferences {
static private SelectBoolean speedOverQuality;
static private SelectBoolean showAllWhileDrawing;
static private SelectSpinner dragSpeed;
static List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
static EventListenerList listeners = new EventListenerList();

static public void addListener(PropertyChangeListener p) {
listeners.add(p);
listeners.add(PropertyChangeListener.class,p);
}

static public void removeListener(PropertyChangeListener p) {
listeners.remove(p);
listeners.remove(PropertyChangeListener.class,p);
}

static protected void firePropertyChange(PropertyChangeEvent e) {
for(PropertyChangeListener p : listeners) {
for(PropertyChangeListener p : listeners.getListeners(PropertyChangeListener.class)) {
p.propertyChange(e);
}
}
Expand Down Expand Up @@ -74,9 +75,7 @@ static public void save() {
prefs.putBoolean("Draw all while running", showAllWhileDrawing.isSelected());
prefs.putInt("dragSpeed", dragSpeed.getValue());
}

static public void cancel() {}


static public boolean getShowPenUp() {
Preferences prefs = getMyNode();
return prefs.getBoolean("show pen up",false);
Expand Down
Loading

0 comments on commit e453a73

Please sign in to comment.