made application translatable

This commit is contained in:
2022-01-06 10:03:30 +01:00
parent 5241f80866
commit f1331ba5b5
4 changed files with 29 additions and 28 deletions

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>BelegScanner</groupId>
<artifactId>BelegScanner</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>BelegScanner</name>
<packaging>jar</packaging>
@@ -41,7 +41,7 @@
<dependency>
<groupId>de.srsoftware</groupId>
<artifactId>tools</artifactId>
<version>1.1.17</version>
<version>1.1.18</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -110,7 +110,7 @@
<archive>
<manifest>
<mainClass>
de.srsoftware.web4rail.Application
de.srsoftware.belegscanner.Application
</mainClass>
</manifest>
</archive>

View File

@@ -29,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.srsoftware.belegscanner.Constants;
import static de.srsoftware.belegscanner.Application.*;
public class DocTable extends JPanel{
@@ -62,10 +63,10 @@ public class DocTable extends JPanel{
buttons = new JPanel();
buttons.setLayout(new FlowLayout());
buttons.add(button("🗀","Ordner öffnen",ev -> openFolder(path)));
buttons.add(joinButton = button("","PDFs zusammenführen",ev -> joinDocs(path)));
buttons.add(button("🖻","Vorschau",ev -> preview(path)));
buttons.add(button("","fertig",ev -> drop(this)));
buttons.add(button("🗀",t("open folder"),ev -> openFolder(path)));
buttons.add(joinButton = button("",t("join PDFs"),ev -> joinDocs(path)));
buttons.add(button("🖻",t("display preview"),ev -> preview(path)));
buttons.add(button("",t("done"),ev -> drop(this)));
constraints.gridx = 2;
add(buttons,constraints);
@@ -107,15 +108,15 @@ public class DocTable extends JPanel{
constraints.gridy = 0;
constraints.gridx = 0;
MatteBorder border = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black);
JLabel ordner = new JLabel("Ordner",SwingConstants.CENTER);
JLabel ordner = new JLabel(t("Directory"),SwingConstants.CENTER);
ordner.setBorder(border);
add(ordner,constraints);
constraints.gridx = 1;
JLabel status = new JLabel("Status",SwingConstants.CENTER);
JLabel status = new JLabel(t("State"),SwingConstants.CENTER);
status.setBorder(border);
add(status,constraints);
constraints.gridx = 2;
JLabel actions = new JLabel("Aktionen",SwingConstants.CENTER);
JLabel actions = new JLabel(t("Actions"),SwingConstants.CENTER);
actions.setBorder(border);
add(actions,constraints);
previewListeners = new HashSet<>();
@@ -158,7 +159,7 @@ public class DocTable extends JPanel{
builder.directory(folder);
try {
Process process = builder.start();
setState(path,"Verbinde PDFs…");
setState(path,t("Joining PDFs…"));
int errorCode = process.waitFor();
if (errorCode != 0) {
LOG.error("error code: {} for {}",errorCode,cmd);
@@ -167,7 +168,7 @@ public class DocTable extends JPanel{
LOG.error("{} terminated: ",builder,e);
}
for (String page : pdfs) Path.of(path,page).toFile().delete();
setState(path,"Zusammengefügt.");
setState(path,t("PDFs joined."));
preview(path);
}
@@ -178,13 +179,13 @@ public class DocTable extends JPanel{
process.waitFor();
Thread.sleep(100);
} catch (IOException | InterruptedException e) {
LOG.error("{} terminated: ",process,e);
LOG.error(t("{} terminated: "),process,e);
}
try {
process = new ProcessBuilder(List.of(Constants.FILE_BROWSER,path)).start();
} catch (IOException e) {
LOG.error("{} terminated: ",process,e);
LOG.error(t("{} terminated: "),process,e);
}
}

View File

@@ -133,7 +133,7 @@ public class MainFrame extends JFrame {
File folder = new File(path);
if (!folder.exists()) {
LOG.warn("Path '{}' does not exist!",path);
LOG.warn(t("Path '{}' does not exist!"),path);
folder.mkdirs();
}
@@ -161,17 +161,17 @@ public class MainFrame extends JFrame {
builder.directory(folder);
try {
Process process = builder.start();
docTable.setState(path,t("scanning…"));
docTable.setState(path,t("Scanning…"));
int errorCode = process.waitFor();
if (errorCode != 0) {
LOG.error("error code: {} for {}",errorCode,cmd);
docTable.setState(path, "Scannen fehlgeschlagen.");
LOG.error(t("Error code: {} for {}"),errorCode,cmd);
docTable.setState(path, t("Scan failed."));
setScanning(false);
return;
}
} catch (InterruptedException | IOException e) {
LOG.error("{} terminated: ",builder,e);
LOG.error(t("{} terminated: "),builder,e);
}
setScanning(false);
@@ -184,11 +184,11 @@ public class MainFrame extends JFrame {
builder.directory(folder);
try {
Process process = builder.start();
docTable.setState(path,"Kovertiere zu PDF…");
docTable.setState(path,t("Converting to PDF…"));
int errorCode = process.waitFor();
if (errorCode != 0) {
LOG.error("error code: {} for {}",errorCode,cmd);
docTable.setState(path, "Konvertierung fehlgeschlagen.");
LOG.error("Error code: {} for {}",errorCode,cmd);
docTable.setState(path, t("Conversion failed."));
return;
}
@@ -217,11 +217,11 @@ public class MainFrame extends JFrame {
builder.directory(folder);
try {
Process process = builder.start();
docTable.setState(path,"Texterkennung");
docTable.setState(path,t("Text recognition"));
int errorCode = process.waitFor();
if (errorCode != 0) {
LOG.error("error code: {} for {}",errorCode,cmd);
docTable.setState(path, "OCR fehlgeschlagen.");
docTable.setState(path, t("OCR failed."));
return;
}

View File

@@ -108,7 +108,7 @@ public class Toolbar extends JPanel {
private JPanel resolutionSelector() {
ButtonGroup group = new ButtonGroup();
JPanel resolutionSelector = new JPanel(new BorderLayout());
JLabel label = new JLabel("aktuelle Auflösung: "+resolution+"px");
JLabel label = new JLabel(t("current resolution")+": "+resolution+"px");
resolutionSelector.add(label, BorderLayout.NORTH);
resolutionSelector.add(resolutionButton(group,label,150),BorderLayout.WEST);
resolutionSelector.add(resolutionButton(group,label,300),BorderLayout.CENTER);
@@ -135,7 +135,7 @@ public class Toolbar extends JPanel {
dummy.setLayout(new BorderLayout());
dummy.setMaximumSize(new Dimension(600, 40));
dummy.add(new JLabel(t("width")+": "),BorderLayout.WEST);
dummy.add(new JLabel(t("Width")+": "),BorderLayout.WEST);
dummy.add(width = new JTextField(209+""),BorderLayout.CENTER);
dummy.add(new JLabel("px"),BorderLayout.EAST);
add(dummy);
@@ -144,7 +144,7 @@ public class Toolbar extends JPanel {
dummy.setLayout(new BorderLayout());
dummy.setMaximumSize(new Dimension(600, 40));
dummy.add(new JLabel(t("height")+": "),BorderLayout.WEST);
dummy.add(new JLabel(t("Height")+": "),BorderLayout.WEST);
dummy.add(height = new JTextField(297+""),BorderLayout.CENTER);
dummy.add(new JLabel("px"),BorderLayout.EAST);
add(dummy);
@@ -285,7 +285,7 @@ public class Toolbar extends JPanel {
}
private Component scanButton() {
scanButton = new JButton("scannen!");
scanButton = new JButton(t("scan!"));
scanButton.addActionListener(this::scanPressed);
return scanButton;
}