made application translatable
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>BelegScanner</groupId>
|
<groupId>BelegScanner</groupId>
|
||||||
<artifactId>BelegScanner</artifactId>
|
<artifactId>BelegScanner</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.2</version>
|
||||||
|
|
||||||
<name>BelegScanner</name>
|
<name>BelegScanner</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>tools</artifactId>
|
<artifactId>tools</artifactId>
|
||||||
<version>1.1.17</version>
|
<version>1.1.18</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<mainClass>
|
<mainClass>
|
||||||
de.srsoftware.web4rail.Application
|
de.srsoftware.belegscanner.Application
|
||||||
</mainClass>
|
</mainClass>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import de.srsoftware.belegscanner.Constants;
|
import de.srsoftware.belegscanner.Constants;
|
||||||
|
import static de.srsoftware.belegscanner.Application.*;
|
||||||
|
|
||||||
public class DocTable extends JPanel{
|
public class DocTable extends JPanel{
|
||||||
|
|
||||||
@@ -62,10 +63,10 @@ public class DocTable extends JPanel{
|
|||||||
buttons = new JPanel();
|
buttons = new JPanel();
|
||||||
buttons.setLayout(new FlowLayout());
|
buttons.setLayout(new FlowLayout());
|
||||||
|
|
||||||
buttons.add(button("🗀","Ordner öffnen",ev -> openFolder(path)));
|
buttons.add(button("🗀",t("open folder"),ev -> openFolder(path)));
|
||||||
buttons.add(joinButton = button("⎗","PDFs zusammenführen",ev -> joinDocs(path)));
|
buttons.add(joinButton = button("⎗",t("join PDFs"),ev -> joinDocs(path)));
|
||||||
buttons.add(button("🖻","Vorschau",ev -> preview(path)));
|
buttons.add(button("🖻",t("display preview"),ev -> preview(path)));
|
||||||
buttons.add(button("✓","fertig",ev -> drop(this)));
|
buttons.add(button("✓",t("done"),ev -> drop(this)));
|
||||||
|
|
||||||
constraints.gridx = 2;
|
constraints.gridx = 2;
|
||||||
add(buttons,constraints);
|
add(buttons,constraints);
|
||||||
@@ -107,15 +108,15 @@ public class DocTable extends JPanel{
|
|||||||
constraints.gridy = 0;
|
constraints.gridy = 0;
|
||||||
constraints.gridx = 0;
|
constraints.gridx = 0;
|
||||||
MatteBorder border = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black);
|
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);
|
ordner.setBorder(border);
|
||||||
add(ordner,constraints);
|
add(ordner,constraints);
|
||||||
constraints.gridx = 1;
|
constraints.gridx = 1;
|
||||||
JLabel status = new JLabel("Status",SwingConstants.CENTER);
|
JLabel status = new JLabel(t("State"),SwingConstants.CENTER);
|
||||||
status.setBorder(border);
|
status.setBorder(border);
|
||||||
add(status,constraints);
|
add(status,constraints);
|
||||||
constraints.gridx = 2;
|
constraints.gridx = 2;
|
||||||
JLabel actions = new JLabel("Aktionen",SwingConstants.CENTER);
|
JLabel actions = new JLabel(t("Actions"),SwingConstants.CENTER);
|
||||||
actions.setBorder(border);
|
actions.setBorder(border);
|
||||||
add(actions,constraints);
|
add(actions,constraints);
|
||||||
previewListeners = new HashSet<>();
|
previewListeners = new HashSet<>();
|
||||||
@@ -158,7 +159,7 @@ public class DocTable extends JPanel{
|
|||||||
builder.directory(folder);
|
builder.directory(folder);
|
||||||
try {
|
try {
|
||||||
Process process = builder.start();
|
Process process = builder.start();
|
||||||
setState(path,"Verbinde PDFs…");
|
setState(path,t("Joining PDFs…"));
|
||||||
int errorCode = process.waitFor();
|
int errorCode = process.waitFor();
|
||||||
if (errorCode != 0) {
|
if (errorCode != 0) {
|
||||||
LOG.error("error code: {} for {}",errorCode,cmd);
|
LOG.error("error code: {} for {}",errorCode,cmd);
|
||||||
@@ -167,7 +168,7 @@ public class DocTable extends JPanel{
|
|||||||
LOG.error("{} terminated: ",builder,e);
|
LOG.error("{} terminated: ",builder,e);
|
||||||
}
|
}
|
||||||
for (String page : pdfs) Path.of(path,page).toFile().delete();
|
for (String page : pdfs) Path.of(path,page).toFile().delete();
|
||||||
setState(path,"Zusammengefügt.");
|
setState(path,t("PDFs joined."));
|
||||||
preview(path);
|
preview(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,13 +179,13 @@ public class DocTable extends JPanel{
|
|||||||
process.waitFor();
|
process.waitFor();
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
LOG.error("{} terminated: ",process,e);
|
LOG.error(t("{} terminated: "),process,e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
process = new ProcessBuilder(List.of(Constants.FILE_BROWSER,path)).start();
|
process = new ProcessBuilder(List.of(Constants.FILE_BROWSER,path)).start();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error("{} terminated: ",process,e);
|
LOG.error(t("{} terminated: "),process,e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class MainFrame extends JFrame {
|
|||||||
|
|
||||||
File folder = new File(path);
|
File folder = new File(path);
|
||||||
if (!folder.exists()) {
|
if (!folder.exists()) {
|
||||||
LOG.warn("Path '{}' does not exist!",path);
|
LOG.warn(t("Path '{}' does not exist!"),path);
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,17 +161,17 @@ public class MainFrame extends JFrame {
|
|||||||
builder.directory(folder);
|
builder.directory(folder);
|
||||||
try {
|
try {
|
||||||
Process process = builder.start();
|
Process process = builder.start();
|
||||||
docTable.setState(path,t("scanning…"));
|
docTable.setState(path,t("Scanning…"));
|
||||||
int errorCode = process.waitFor();
|
int errorCode = process.waitFor();
|
||||||
if (errorCode != 0) {
|
if (errorCode != 0) {
|
||||||
LOG.error("error code: {} for {}",errorCode,cmd);
|
LOG.error(t("Error code: {} for {}"),errorCode,cmd);
|
||||||
docTable.setState(path, "Scannen fehlgeschlagen.");
|
docTable.setState(path, t("Scan failed."));
|
||||||
setScanning(false);
|
setScanning(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (InterruptedException | IOException e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
LOG.error("{} terminated: ",builder,e);
|
LOG.error(t("{} terminated: "),builder,e);
|
||||||
}
|
}
|
||||||
setScanning(false);
|
setScanning(false);
|
||||||
|
|
||||||
@@ -184,11 +184,11 @@ public class MainFrame extends JFrame {
|
|||||||
builder.directory(folder);
|
builder.directory(folder);
|
||||||
try {
|
try {
|
||||||
Process process = builder.start();
|
Process process = builder.start();
|
||||||
docTable.setState(path,"Kovertiere zu PDF…");
|
docTable.setState(path,t("Converting to PDF…"));
|
||||||
int errorCode = process.waitFor();
|
int errorCode = process.waitFor();
|
||||||
if (errorCode != 0) {
|
if (errorCode != 0) {
|
||||||
LOG.error("error code: {} for {}",errorCode,cmd);
|
LOG.error("Error code: {} for {}",errorCode,cmd);
|
||||||
docTable.setState(path, "Konvertierung fehlgeschlagen.");
|
docTable.setState(path, t("Conversion failed."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,11 +217,11 @@ public class MainFrame extends JFrame {
|
|||||||
builder.directory(folder);
|
builder.directory(folder);
|
||||||
try {
|
try {
|
||||||
Process process = builder.start();
|
Process process = builder.start();
|
||||||
docTable.setState(path,"Texterkennung…");
|
docTable.setState(path,t("Text recognition…"));
|
||||||
int errorCode = process.waitFor();
|
int errorCode = process.waitFor();
|
||||||
if (errorCode != 0) {
|
if (errorCode != 0) {
|
||||||
LOG.error("error code: {} for {}",errorCode,cmd);
|
LOG.error("error code: {} for {}",errorCode,cmd);
|
||||||
docTable.setState(path, "OCR fehlgeschlagen.");
|
docTable.setState(path, t("OCR failed."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class Toolbar extends JPanel {
|
|||||||
private JPanel resolutionSelector() {
|
private JPanel resolutionSelector() {
|
||||||
ButtonGroup group = new ButtonGroup();
|
ButtonGroup group = new ButtonGroup();
|
||||||
JPanel resolutionSelector = new JPanel(new BorderLayout());
|
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(label, BorderLayout.NORTH);
|
||||||
resolutionSelector.add(resolutionButton(group,label,150),BorderLayout.WEST);
|
resolutionSelector.add(resolutionButton(group,label,150),BorderLayout.WEST);
|
||||||
resolutionSelector.add(resolutionButton(group,label,300),BorderLayout.CENTER);
|
resolutionSelector.add(resolutionButton(group,label,300),BorderLayout.CENTER);
|
||||||
@@ -135,7 +135,7 @@ public class Toolbar extends JPanel {
|
|||||||
dummy.setLayout(new BorderLayout());
|
dummy.setLayout(new BorderLayout());
|
||||||
dummy.setMaximumSize(new Dimension(600, 40));
|
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(width = new JTextField(209+""),BorderLayout.CENTER);
|
||||||
dummy.add(new JLabel("px"),BorderLayout.EAST);
|
dummy.add(new JLabel("px"),BorderLayout.EAST);
|
||||||
add(dummy);
|
add(dummy);
|
||||||
@@ -144,7 +144,7 @@ public class Toolbar extends JPanel {
|
|||||||
dummy.setLayout(new BorderLayout());
|
dummy.setLayout(new BorderLayout());
|
||||||
dummy.setMaximumSize(new Dimension(600, 40));
|
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(height = new JTextField(297+""),BorderLayout.CENTER);
|
||||||
dummy.add(new JLabel("px"),BorderLayout.EAST);
|
dummy.add(new JLabel("px"),BorderLayout.EAST);
|
||||||
add(dummy);
|
add(dummy);
|
||||||
@@ -285,7 +285,7 @@ public class Toolbar extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Component scanButton() {
|
private Component scanButton() {
|
||||||
scanButton = new JButton("scannen!");
|
scanButton = new JButton(t("scan!"));
|
||||||
scanButton.addActionListener(this::scanPressed);
|
scanButton.addActionListener(this::scanPressed);
|
||||||
return scanButton;
|
return scanButton;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user