diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java
index 9735787..9bf6972 100644
--- a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java
+++ b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationWindow.java
@@ -42,12 +42,68 @@ import javax.swing.SpringLayout;
import java.awt.FlowLayout;
import java.awt.CardLayout;
import java.awt.Component;
-
import javax.swing.SwingConstants;
import javax.swing.JComboBox;
public class ConfigurationWindow extends JFrame {
+ private static final String LABEL_HTML5 = "label_html5";
+ private static final String BUTTON_CONVERT_LABEL = "button_convert_label";
+ private static final String MESSAGE_NOT_IMPLEMENTED = "message_not_implemented";
+ private static final String BUTTON_EXIT_LABEL = "button_exit_label";
+ private static final String BUTTON_SAVE_LABEL = "button_save_label";
+ private static final String BUTTON_SAVEAS_LABEL = "button_saveas_label";
+ private static final String ARG_PAGINATION = "pagination";
+ private static final String ARG_CSV_METADATA = "csv_metadata";
+ private static final String ARG_RDF_TYPE = "rdf_type";
+ private static final String CSV_FILE_EXTENSION = "csv";
+ private static final String RDF_FILE_EXTENSION = "rdf";
+ private static final String CANT_WRITE_MESSAGE = "error_cant_write";
+ private static final String HTML_FILE_EXTENSION = "html";
+ private static final String ARG_MAX_WIDTH = "max_width";
+ private static final String LABEL_SPLIT_BY_HEADING = "label_split_by_heading";
+ private static final String DEFAULT_PAGEBREAK_STYLE_SETTINGS = "height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;";
+ private static final String EPUB_FILE_EXTENSION = "epub";
+ private static final String ODT_FILE_EXTENSION = "odt";
+ private static final String CONVERTER_TITLE_LABEL = "converter_title_label";
+ private static final String LABEL_TYPE = "label_type";
+ private static final String LABEL_METADATA_PATH = "label_metadata_path";
+ private static final String LABEL_FILETER_HARD_LINE_BREAKS = "label_fileter_hard_line_breaks";
+ private static final String LABEL_USE_MATHJAX = "label_use_mathjax";
+ private static final String LABEL_SPLIT_WHOLE_PAGES_ONLY = "label_split_whole_pages_only";
+ private static final String ARG_IGNORE_HARD_LINE_BREAKS = "ignore_hard_line_breaks";
+ private static final String ARG_IGNORE_EMPTY_PARAGRAPHS = "ignore_empty_paragraphs";
+ private static final String ARG_GREENSTONE = "greenstone";
+ private static final String ARG_SPLIT_LEVEL = "split_level";
+ private static final String ARG_ALIGN_SPLITS_TO_PAGES = "align_splits_to_pages";
+ private static final String ARG_USE_MATHJAX = "use_mathjax";
+ private static final String ARG_OUTPUT_FILE = "outputFile";
+ private static final String ARG_TARGET_FORMAT = "targetFormat";
+ private static final String ARG_INPUT_FILE = "inputFile";
+ private static final String ARG_CONVERT_TO_PX = "convert_to_px";
+ private static final String SCALING_DEFAULT_VALUE = "100%";
+ private static final String ARG_SCALING = "scaling";
+ private static final String ARG_EMBED_IMG = "embed_img";
+ private static final String ARG_EMBED_SVG = "embed_svg";
+ private static final String ARG_CSS_INLINE = "css_inline";
+ private static final String ARG_MIN_LETTER_SPACING = "min_letter_spacing";
+ private static final String LABEL_PAGINATION = "label_pagination";
+ private static final String ARG_PAGE_BREAK_STYLE = "page_break_style";
+ private static final String LABEL_BREAK_STYLE = "label_break_style";
+ private static final String LETTER_SPACING_DEFAULT_VALUE = "0.15";
+ private static final String LABEL_GREENSTONE_SPLIT = "label_greenstone_split";
+ private static final String LABEL_INGNORE_EMPTY_PARS = "label_ingnore_empty_pars";
+ private static final String LABEL_MIN_LETTER_SPACING = "label_min_letter_spacing";
+ private static final String LABEL_MAX_BODY_WIDTH = "label_max_body_width";
+ private static final String OUTPUT_FILE_PATH = "label_output_file_path";
+ private static final String LABEL_BUTTON_CHOOSE = "label_button_choose";
+ private static final String LABEL_TARGET_FORMAT = "label_target_format";
+ private static final String LABEL_INPUT_FILE_PATH = "label_input_file_path";
+ private static final String LABEL_CONVERT_TO_PX = "label_convert_to_px";
+ private static final String LABEL_SCALE = "label_scale";
+ private static final String LABEL_EMBED_RASTER = "label_embed_raster";
+ private static final String LABEL_EMBED_VECTOR = "label_embed_vector";
+ private static final String LABEL_INLINE_STYLES = "label_inline_styles";
/**
*
*/
@@ -65,22 +121,24 @@ public class ConfigurationWindow extends JFrame {
private XComponentContext context;
private String fileName = "";
+ private Localizer localizer;
/**
* Create the application.
*/
public ConfigurationWindow() {
- setTitle("Converter from ODT to HTML, ePub and RDF");
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- setIconImage(Toolkit.getDefaultToolkit().getImage(ConfigurationWindow.class.getResource("/pro/litvinovg/w2phtml/gui/resources/w2phtml.png")));
- initComponents();
- createEvents();
+ initializeConfigurationWindow();
}
public ConfigurationWindow(XComponentContext context, ODTDocument doc) {
this.context = context;
fileName = doc.getFileName();
- setTitle("Converter from ODT to HTML, ePub and RDF");
+ initializeConfigurationWindow();
+ }
+
+ private void initializeConfigurationWindow() {
+ this.localizer = new Localizer();
+ setTitle(localizer.getTranslation(CONVERTER_TITLE_LABEL));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setIconImage(Toolkit.getDefaultToolkit().getImage(ConfigurationWindow.class.getResource("/pro/litvinovg/w2phtml/gui/resources/w2phtml.png")));
initComponents();
@@ -181,83 +239,83 @@ public class ConfigurationWindow extends JFrame {
private JPanel createConfigEpubPanel(HashMap configuration) {
JPanel panel_configHTML = new JPanel();
- JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax");
+ JCheckBox cb_UseMathJax = new JCheckBox(localizer.getTranslation(LABEL_USE_MATHJAX));
cb_UseMathJax.setSelected(true);
- configuration.put("use_mathjax", cb_UseMathJax);
+ configuration.put(ARG_USE_MATHJAX, cb_UseMathJax);
- JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox("Filter empty paragraphs");
+ JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox(localizer.getTranslation(LABEL_INGNORE_EMPTY_PARS));
cb_IgnoreEmptyParagraphs.setSelected(true);
- configuration.put("ignore_empty_paragraphs", cb_IgnoreEmptyParagraphs);
+ configuration.put(ARG_IGNORE_EMPTY_PARAGRAPHS, cb_IgnoreEmptyParagraphs);
- JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox("Filter hard line breaks");
+ JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox(localizer.getTranslation(LABEL_FILETER_HARD_LINE_BREAKS));
cb_IgnoreHardLineBreaks.setSelected(true);
- configuration.put("ignore_hard_line_breaks", cb_IgnoreHardLineBreaks);
+ configuration.put(ARG_IGNORE_HARD_LINE_BREAKS, cb_IgnoreHardLineBreaks);
- JLabel lb_FilterLetterSpacing = new JLabel("Filter letter spacing less than");
+ JLabel lb_FilterLetterSpacing = new JLabel(localizer.getTranslation(LABEL_MIN_LETTER_SPACING));
JTextField tf_FilterLetterSpacing = new JTextField();
- tf_FilterLetterSpacing.setText("0.15");
- configuration.put("min_letter_spacing", tf_FilterLetterSpacing);
+ tf_FilterLetterSpacing.setText(LETTER_SPACING_DEFAULT_VALUE);
+ configuration.put(ARG_MIN_LETTER_SPACING, tf_FilterLetterSpacing);
tf_FilterLetterSpacing.setColumns(10);
- JCheckBox cb_InlineStyles = new JCheckBox("Inline styles");
+ JCheckBox cb_InlineStyles = new JCheckBox(localizer.getTranslation(LABEL_INLINE_STYLES));
cb_InlineStyles.setSelected(true);
- configuration.put("css_inline", cb_InlineStyles);
+ configuration.put(ARG_CSS_INLINE, cb_InlineStyles);
- JCheckBox cb_EmbedVectorImages = new JCheckBox("Embed vector images");
+ JCheckBox cb_EmbedVectorImages = new JCheckBox(localizer.getTranslation(LABEL_EMBED_VECTOR));
cb_EmbedVectorImages.setSelected(true);
- configuration.put("embed_svg", cb_EmbedVectorImages);
+ configuration.put(ARG_EMBED_SVG, cb_EmbedVectorImages);
- JCheckBox cb_EmbedRaster = new JCheckBox("Embed raster images");
+ JCheckBox cb_EmbedRaster = new JCheckBox(localizer.getTranslation(LABEL_EMBED_RASTER));
cb_EmbedRaster.setSelected(true);
- configuration.put("embed_img", cb_EmbedRaster);
+ configuration.put(ARG_EMBED_IMG, cb_EmbedRaster);
- JLabel lb_Scale = new JLabel("Scale");
+ JLabel lb_Scale = new JLabel(localizer.getTranslation(LABEL_SCALE));
JTextField tf_Scale = new JTextField();
- tf_Scale.setText("100%");
- configuration.put("scaling", tf_Scale);
+ tf_Scale.setText(SCALING_DEFAULT_VALUE);
+ configuration.put(ARG_SCALING, tf_Scale);
tf_Scale.setColumns(10);
- JCheckBox cb_convertToPx = new JCheckBox("Convert dimensions to pixels instead of REM (root em)");
- configuration.put("convert_to_px", cb_convertToPx);
+ JCheckBox cb_convertToPx = new JCheckBox(localizer.getTranslation(LABEL_CONVERT_TO_PX));
+ configuration.put(ARG_CONVERT_TO_PX, cb_convertToPx);
- JLabel lb_FilePath = new JLabel("Input file path");
+ JLabel lb_FilePath = new JLabel(localizer.getTranslation(LABEL_INPUT_FILE_PATH));
JTextField tf_inputFile = new JTextField(fileName);
tf_inputFile.setColumns(10);
- configuration.put("inputFile", tf_inputFile);
+ configuration.put(ARG_INPUT_FILE, tf_inputFile);
JLabel lb_TargetFormat = new JLabel("epub3");
- configuration.put("targetFormat", lb_TargetFormat);
+ configuration.put(ARG_TARGET_FORMAT, lb_TargetFormat);
- JLabel lb_TargetFormat_description = new JLabel("Target format");
+ JLabel lb_TargetFormat_description = new JLabel(localizer.getTranslation(LABEL_TARGET_FORMAT));
JTextField tf_OutputFile = new JTextField("");
- configuration.put("outputFile", tf_OutputFile);
+ configuration.put(ARG_OUTPUT_FILE, tf_OutputFile);
tf_OutputFile.setColumns(10);
- JButton btnChooseFile = new JButton("Choose");
+ JButton btnChooseFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
btnChooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),"odt");
+ String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),ODT_FILE_EXTENSION);
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_inputFile.setText(newFilePath);
- setOutputFilePath(newFilePath,tf_OutputFile,"epub");
+ setOutputFilePath(newFilePath,tf_OutputFile,EPUB_FILE_EXTENSION);
}
}
});
- JButton btn_ChooseOutputFile = new JButton("Choose");
+ JButton btn_ChooseOutputFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
btn_ChooseOutputFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),"epub");
+ String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),EPUB_FILE_EXTENSION);
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_OutputFile.setText(newFilePath);
}
@@ -266,18 +324,18 @@ public class ConfigurationWindow extends JFrame {
- JLabel lb_OutFilePath = new JLabel("Output file path");
+ JLabel lb_OutFilePath = new JLabel(localizer.getTranslation(OUTPUT_FILE_PATH));
- JLabel lb_pageBreakInlineStyle = new JLabel("Page break inline style");
+ JLabel lb_pageBreakInlineStyle = new JLabel(localizer.getTranslation(LABEL_BREAK_STYLE));
JTextField tf_pageBreakInlineStyle = new JTextField();
- configuration.put("page_break_style", tf_pageBreakInlineStyle);
- tf_pageBreakInlineStyle.setText("height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;");
+ configuration.put(ARG_PAGE_BREAK_STYLE, tf_pageBreakInlineStyle);
+ tf_pageBreakInlineStyle.setText(DEFAULT_PAGEBREAK_STYLE_SETTINGS);
tf_pageBreakInlineStyle.setColumns(10);
- JCheckBox cb_Pagination = new JCheckBox("Pagination");
+ JCheckBox cb_Pagination = new JCheckBox(localizer.getTranslation(LABEL_PAGINATION));
cb_Pagination.setSelected(true);
- configuration.put("pagination", cb_Pagination);
+ configuration.put(ARG_PAGINATION, cb_Pagination);
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
gl_panel_configHTML.setHorizontalGroup(
@@ -402,102 +460,102 @@ public class ConfigurationWindow extends JFrame {
private JPanel createConfigHTMLPanel(HashMap configuration) {
JPanel panel_configHTML = new JPanel();
- JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax");
+ JCheckBox cb_UseMathJax = new JCheckBox(localizer.getTranslation(LABEL_USE_MATHJAX));
cb_UseMathJax.setSelected(true);
- configuration.put("use_mathjax", cb_UseMathJax);
+ configuration.put(ARG_USE_MATHJAX, cb_UseMathJax);
- JCheckBox cb_SplitWholePagesOnly = new JCheckBox("Split on whole pages only");
- configuration.put("align_splits_to_pages", cb_SplitWholePagesOnly);
+ JCheckBox cb_SplitWholePagesOnly = new JCheckBox(localizer.getTranslation(LABEL_SPLIT_WHOLE_PAGES_ONLY));
+ configuration.put(ARG_ALIGN_SPLITS_TO_PAGES, cb_SplitWholePagesOnly);
- JLabel lb_SplitByLevel = new JLabel("Split into multiple files by heading level");
+ JLabel lb_SplitByLevel = new JLabel(localizer.getTranslation(LABEL_SPLIT_BY_HEADING));
JTextField tf_SplitByLevel = new JTextField();
- configuration.put("split_level", tf_SplitByLevel);
+ configuration.put(ARG_SPLIT_LEVEL, tf_SplitByLevel);
tf_SplitByLevel.setColumns(10);
- JCheckBox cb_Greenstone = new JCheckBox("Split document into subsections for Greenstone digital library");
- configuration.put("greenstone", cb_Greenstone);
+ JCheckBox cb_Greenstone = new JCheckBox(localizer.getTranslation(LABEL_GREENSTONE_SPLIT));
+ configuration.put(ARG_GREENSTONE, cb_Greenstone);
- JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox("Filter empty paragraphs");
+ JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox(localizer.getTranslation(LABEL_INGNORE_EMPTY_PARS));
cb_IgnoreEmptyParagraphs.setSelected(true);
- configuration.put("ignore_empty_paragraphs", cb_IgnoreEmptyParagraphs);
+ configuration.put(ARG_IGNORE_EMPTY_PARAGRAPHS, cb_IgnoreEmptyParagraphs);
- JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox("Filter hard line breaks");
+ JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox(localizer.getTranslation(LABEL_FILETER_HARD_LINE_BREAKS));
cb_IgnoreHardLineBreaks.setSelected(true);
- configuration.put("ignore_hard_line_breaks", cb_IgnoreHardLineBreaks);
+ configuration.put(ARG_IGNORE_HARD_LINE_BREAKS, cb_IgnoreHardLineBreaks);
- JLabel lb_FilterLetterSpacing = new JLabel("Filter letter spacing less than");
+ JLabel lb_FilterLetterSpacing = new JLabel(localizer.getTranslation(LABEL_MIN_LETTER_SPACING));
JTextField tf_FilterLetterSpacing = new JTextField();
- tf_FilterLetterSpacing.setText("0.15");
- configuration.put("min_letter_spacing", tf_FilterLetterSpacing);
+ tf_FilterLetterSpacing.setText(LETTER_SPACING_DEFAULT_VALUE);
+ configuration.put(ARG_MIN_LETTER_SPACING, tf_FilterLetterSpacing);
tf_FilterLetterSpacing.setColumns(10);
- JCheckBox cb_InlineStyles = new JCheckBox("Inline styles");
+ JCheckBox cb_InlineStyles = new JCheckBox(localizer.getTranslation(LABEL_INLINE_STYLES));
cb_InlineStyles.setSelected(true);
- configuration.put("css_inline", cb_InlineStyles);
+ configuration.put(ARG_CSS_INLINE, cb_InlineStyles);
- JCheckBox cb_EmbedVectorImages = new JCheckBox("Embed vector images");
+ JCheckBox cb_EmbedVectorImages = new JCheckBox(localizer.getTranslation(LABEL_EMBED_VECTOR));
cb_EmbedVectorImages.setSelected(true);
- configuration.put("embed_svg", cb_EmbedVectorImages);
+ configuration.put(ARG_EMBED_SVG, cb_EmbedVectorImages);
- JCheckBox cb_EmbedRaster = new JCheckBox("Embed raster images");
+ JCheckBox cb_EmbedRaster = new JCheckBox(localizer.getTranslation(LABEL_EMBED_RASTER));
cb_EmbedRaster.setSelected(true);
- configuration.put("embed_img", cb_EmbedRaster);
+ configuration.put(ARG_EMBED_IMG, cb_EmbedRaster);
- JLabel lb_Scale = new JLabel("Scale");
+ JLabel lb_Scale = new JLabel(localizer.getTranslation(LABEL_SCALE));
JTextField tf_Scale = new JTextField();
- tf_Scale.setText("100%");
- configuration.put("scaling", tf_Scale);
+ tf_Scale.setText(SCALING_DEFAULT_VALUE);
+ configuration.put(ARG_SCALING, tf_Scale);
tf_Scale.setColumns(10);
- JLabel lb_MaxWidth = new JLabel("Max body width");
+ JLabel lb_MaxWidth = new JLabel(localizer.getTranslation(LABEL_MAX_BODY_WIDTH));
JTextField tf_MaxWidth = new JTextField();
- configuration.put("max_width", tf_MaxWidth);
+ configuration.put(ARG_MAX_WIDTH, tf_MaxWidth);
tf_MaxWidth.setColumns(10);
- JCheckBox cb_convertToPx = new JCheckBox("Convert dimensions to pixels instead of REM (root em)");
- configuration.put("convert_to_px", cb_convertToPx);
+ JCheckBox cb_convertToPx = new JCheckBox(localizer.getTranslation(LABEL_CONVERT_TO_PX));
+ configuration.put(ARG_CONVERT_TO_PX, cb_convertToPx);
- JLabel lb_FilePath = new JLabel("Input file path");
+ JLabel lb_FilePath = new JLabel(localizer.getTranslation(LABEL_INPUT_FILE_PATH));
JTextField tf_inputFile = new JTextField(fileName);
tf_inputFile.setColumns(10);
- configuration.put("inputFile", tf_inputFile);
+ configuration.put(ARG_INPUT_FILE, tf_inputFile);
- JLabel lb_TargetFormat = new JLabel("html5");
- configuration.put("targetFormat", lb_TargetFormat);
- JLabel lb_TargetFormat_description = new JLabel("Target format");
+ JLabel lb_TargetFormat = new JLabel(localizer.getTranslation(LABEL_HTML5));
+ configuration.put(ARG_TARGET_FORMAT, lb_TargetFormat);
+ JLabel lb_TargetFormat_description = new JLabel(localizer.getTranslation(LABEL_TARGET_FORMAT));
- JLabel lb_OutFilePath = new JLabel("Output file path");
+ JLabel lb_OutFilePath = new JLabel(localizer.getTranslation(OUTPUT_FILE_PATH));
JTextField tf_OutputFile = new JTextField("");
tf_OutputFile.setColumns(10);
- configuration.put("outputFile", tf_OutputFile);
+ configuration.put(ARG_OUTPUT_FILE, tf_OutputFile);
- JButton btn_ChooseInputFile = new JButton("Choose");
+ JButton btn_ChooseInputFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
btn_ChooseInputFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),"odt");
+ String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),ODT_FILE_EXTENSION);
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_inputFile.setText(newFilePath);
- setOutputFilePath(newFilePath,tf_OutputFile,"html");
+ setOutputFilePath(newFilePath,tf_OutputFile,HTML_FILE_EXTENSION);
}
}
});
- JButton btn_ChooseOutputFile = new JButton("Choose");
+ JButton btn_ChooseOutputFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
btn_ChooseOutputFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),"html");
+ String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),HTML_FILE_EXTENSION);
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_OutputFile.setText(newFilePath);
}
@@ -505,15 +563,15 @@ public class ConfigurationWindow extends JFrame {
});
JTextField tf_pageBreakInlineStyle = new JTextField();
- configuration.put("page_break_style", tf_pageBreakInlineStyle);
- tf_pageBreakInlineStyle.setText("height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;");
+ configuration.put(ARG_PAGE_BREAK_STYLE, tf_pageBreakInlineStyle);
+ tf_pageBreakInlineStyle.setText(DEFAULT_PAGEBREAK_STYLE_SETTINGS);
tf_pageBreakInlineStyle.setColumns(10);
- JLabel lb_pageBreakInlineStyle = new JLabel("Page break inline style");
+ JLabel lb_pageBreakInlineStyle = new JLabel(localizer.getTranslation(LABEL_BREAK_STYLE));
- JCheckBox cb_Pagination = new JCheckBox("Pagination");
+ JCheckBox cb_Pagination = new JCheckBox(localizer.getTranslation(LABEL_PAGINATION));
cb_Pagination.setSelected(true);
- configuration.put("pagination", cb_Pagination);
+ configuration.put(ARG_PAGINATION, cb_Pagination);
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
gl_panel_configHTML.setHorizontalGroup(
@@ -521,62 +579,55 @@ public class ConfigurationWindow extends JFrame {
.addGroup(gl_panel_configHTML.createSequentialGroup()
.addGap(32)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE)
- .addContainerGap())
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
- .addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(btn_ChooseInputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
- .addContainerGap())
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
- .addGap(18)
- .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_MaxWidth)
- .addGap(18)
- .addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE)
- .addGap(18)
- .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
- .addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_Greenstone, GroupLayout.PREFERRED_SIZE, 482, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_SplitWholePagesOnly, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE)
- .addGap(42)
- .addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)))
- .addGap(340)))))
+ .addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
+ .addGap(18)
+ .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_MaxWidth)
+ .addGap(18)
+ .addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE)
+ .addGap(18)
+ .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
+ .addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_Greenstone, GroupLayout.PREFERRED_SIZE, 482, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_SplitWholePagesOnly, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 166, GroupLayout.PREFERRED_SIZE)
+ .addGap(18)
+ .addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE)
+ .addGap(42)
+ .addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.TRAILING, false)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(tf_pageBreakInlineStyle))
+ .addGroup(Alignment.LEADING, gl_panel_configHTML.createSequentialGroup()
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
+ .addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING, false)
+ .addComponent(tf_OutputFile, Alignment.TRAILING)
+ .addComponent(tf_inputFile, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE))))
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(btn_ChooseInputFile, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
+ .addComponent(btn_ChooseOutputFile, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))))
+ .addGap(128))
);
gl_panel_configHTML.setVerticalGroup(
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
@@ -588,66 +639,69 @@ public class ConfigurationWindow extends JFrame {
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(2)
- .addComponent(lb_FilePath))
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
- .addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(btn_ChooseInputFile)))
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
- .addComponent(lb_OutFilePath)
- .addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(btn_ChooseOutputFile))
- .addGap(12)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
- .addComponent(lb_pageBreakInlineStyle)
- .addComponent(tf_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(2)
- .addComponent(lb_Scale))
- .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(6)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(2)
- .addComponent(lb_MaxWidth))
- .addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(8)
- .addComponent(lb_FilterLetterSpacing)
- .addGap(4)
- .addComponent(cb_InlineStyles)
- .addGap(7)
- .addComponent(cb_EmbedVectorImages)
- .addGap(7)
- .addComponent(cb_EmbedRaster))
+ .addComponent(btn_ChooseInputFile)
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addComponent(btn_ChooseOutputFile))
.addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGap(2)
+ .addComponent(lb_FilePath))
+ .addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
+ .addComponent(lb_OutFilePath)
+ .addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addGap(12)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
+ .addComponent(lb_pageBreakInlineStyle)
+ .addComponent(tf_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGap(2)
+ .addComponent(lb_Scale))
+ .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(6)
- .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
- .addGap(7)
- .addComponent(cb_convertToPx)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(cb_IgnoreHardLineBreaks)
- .addGap(7)
- .addComponent(cb_IgnoreEmptyParagraphs)
- .addGap(4)
- .addComponent(cb_Greenstone)
- .addGap(8)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(2)
- .addComponent(lb_SplitByLevel)))
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(cb_SplitWholePagesOnly)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(cb_UseMathJax)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(cb_Pagination)
- .addContainerGap(235, Short.MAX_VALUE))
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGap(2)
+ .addComponent(lb_MaxWidth))
+ .addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGap(8)
+ .addComponent(lb_FilterLetterSpacing)
+ .addGap(4)
+ .addComponent(cb_InlineStyles)
+ .addGap(7)
+ .addComponent(cb_EmbedVectorImages)
+ .addGap(7)
+ .addComponent(cb_EmbedRaster))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGap(6)
+ .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
+ .addGap(7)
+ .addComponent(cb_convertToPx)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(cb_IgnoreHardLineBreaks)
+ .addGap(7)
+ .addComponent(cb_IgnoreEmptyParagraphs)
+ .addGap(4)
+ .addComponent(cb_Greenstone)
+ .addGap(8)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGap(2)
+ .addComponent(lb_SplitByLevel)))
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(cb_SplitWholePagesOnly)
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addComponent(cb_UseMathJax)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(cb_Pagination)))
+ .addContainerGap(228, Short.MAX_VALUE))
);
panel_configHTML.setLayout(gl_panel_configHTML);
return panel_configHTML;
@@ -665,7 +719,7 @@ public class ConfigurationWindow extends JFrame {
return;
}
if (!parent.canWrite()){
- JOptionPane.showMessageDialog(singleFrame, "Attension. Can't save file in output directory.");
+ JOptionPane.showMessageDialog(singleFrame, localizer.getTranslation(CANT_WRITE_MESSAGE));
}
}
if (newFilePath.length() < 3) {
@@ -677,7 +731,7 @@ public class ConfigurationWindow extends JFrame {
tf_OutputFile.setText(exportPath);
} else {
String importExt = newFilePath.substring(newFilePath.length()-3, newFilePath.length()).toLowerCase();
- if (importExt.equals("odt")) {
+ if (importExt.equals(ODT_FILE_EXTENSION)) {
exportPath = newFilePath.substring(0, newFilePath.length()-3) + extension;
tf_OutputFile.setText(exportPath);
}
@@ -701,7 +755,7 @@ public class ConfigurationWindow extends JFrame {
return;
}
String importExt = newFilePath.substring(newFilePath.length()-3, newFilePath.length()).toLowerCase();
- if (importExt.equals("odt")) {
+ if (importExt.equals(ODT_FILE_EXTENSION)) {
String metadataPath = newFilePath.substring(0, newFilePath.length()-3) + extension;
File metaFile = new File(metadataPath);
if (metaFile.exists() && metaFile.canRead()){
@@ -716,102 +770,100 @@ public class ConfigurationWindow extends JFrame {
private JPanel createConfigRDFPanel(HashMap configuration) {
JPanel panel_configHTML = new JPanel();
- JCheckBox cb_UseMathJax = new JCheckBox("Use MathJax");
+ JCheckBox cb_UseMathJax = new JCheckBox(localizer.getTranslation(LABEL_USE_MATHJAX));
cb_UseMathJax.setSelected(true);
- configuration.put("use_mathjax", cb_UseMathJax);
+ configuration.put(ARG_USE_MATHJAX, cb_UseMathJax);
- JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox("Filter empty paragraphs");
+ JCheckBox cb_IgnoreEmptyParagraphs = new JCheckBox(localizer.getTranslation(LABEL_INGNORE_EMPTY_PARS));
cb_IgnoreEmptyParagraphs.setSelected(true);
- configuration.put("ignore_empty_paragraphs", cb_IgnoreEmptyParagraphs);
+ configuration.put(ARG_IGNORE_EMPTY_PARAGRAPHS, cb_IgnoreEmptyParagraphs);
- JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox("Filter hard line breaks");
+ JCheckBox cb_IgnoreHardLineBreaks = new JCheckBox(localizer.getTranslation(LABEL_FILETER_HARD_LINE_BREAKS));
cb_IgnoreHardLineBreaks.setSelected(true);
- configuration.put("ignore_hard_line_breaks", cb_IgnoreHardLineBreaks);
+ configuration.put(ARG_IGNORE_HARD_LINE_BREAKS, cb_IgnoreHardLineBreaks);
- JLabel lb_FilterLetterSpacing = new JLabel("Filter letter spacing less than");
+ JLabel lb_FilterLetterSpacing = new JLabel(localizer.getTranslation(LABEL_MIN_LETTER_SPACING));
JTextField tf_FilterLetterSpacing = new JTextField();
- tf_FilterLetterSpacing.setText("0.15");
- configuration.put("min_letter_spacing", tf_FilterLetterSpacing);
+ tf_FilterLetterSpacing.setText(LETTER_SPACING_DEFAULT_VALUE);
+ configuration.put(ARG_MIN_LETTER_SPACING, tf_FilterLetterSpacing);
tf_FilterLetterSpacing.setColumns(10);
- JCheckBox cb_InlineStyles = new JCheckBox("Inline styles");
+ JCheckBox cb_InlineStyles = new JCheckBox(localizer.getTranslation(LABEL_INLINE_STYLES));
cb_InlineStyles.setEnabled(false);
cb_InlineStyles.setSelected(true);
- configuration.put("css_inline", cb_InlineStyles);
+ configuration.put(ARG_CSS_INLINE, cb_InlineStyles);
- JCheckBox cb_EmbedVectorImages = new JCheckBox("Embed vector images");
+ JCheckBox cb_EmbedVectorImages = new JCheckBox(localizer.getTranslation(LABEL_EMBED_VECTOR));
cb_EmbedVectorImages.setEnabled(false);
cb_EmbedVectorImages.setSelected(true);
- configuration.put("embed_svg", cb_EmbedVectorImages);
+ configuration.put(ARG_EMBED_SVG, cb_EmbedVectorImages);
- JCheckBox cb_EmbedRaster = new JCheckBox("Embed raster images");
+ JCheckBox cb_EmbedRaster = new JCheckBox(localizer.getTranslation(LABEL_EMBED_RASTER));
cb_EmbedRaster.setEnabled(false);
cb_EmbedRaster.setSelected(true);
- configuration.put("embed_img", cb_EmbedRaster);
+ configuration.put(ARG_EMBED_IMG, cb_EmbedRaster);
- JLabel lb_Scale = new JLabel("Scale");
+ JLabel lb_Scale = new JLabel(localizer.getTranslation(LABEL_SCALE));
JTextField tf_Scale = new JTextField();
- tf_Scale.setText("100%");
- configuration.put("scaling", tf_Scale);
+ tf_Scale.setText(SCALING_DEFAULT_VALUE);
+ configuration.put(ARG_SCALING, tf_Scale);
tf_Scale.setColumns(10);
- JCheckBox cb_convertToPx = new JCheckBox("Convert dimensions to pixels instead of REM (root em)");
- configuration.put("convert_to_px", cb_convertToPx);
+ JCheckBox cb_convertToPx = new JCheckBox(localizer.getTranslation(LABEL_CONVERT_TO_PX));
+ configuration.put(ARG_CONVERT_TO_PX, cb_convertToPx);
- JLabel lb_FilePath = new JLabel("Input file path");
+ JLabel lb_FilePath = new JLabel(localizer.getTranslation(LABEL_INPUT_FILE_PATH));
JTextField tf_inputFile = new JTextField(fileName);
tf_inputFile.setColumns(10);
- configuration.put("inputFile", tf_inputFile);
+ configuration.put(ARG_INPUT_FILE, tf_inputFile);
+ JLabel lb_TargetFormat = new JLabel(RDF_FILE_EXTENSION);
+ configuration.put(ARG_TARGET_FORMAT, lb_TargetFormat);
- JLabel lb_TargetFormat = new JLabel("rdf");
- configuration.put("targetFormat", lb_TargetFormat);
+ JLabel lb_TargetFormat_description = new JLabel(localizer.getTranslation(LABEL_TARGET_FORMAT));
-
- JLabel lb_TargetFormat_description = new JLabel("Target format");
-
- JLabel lb_OutFilePath = new JLabel("Output file path");
+ JLabel lb_OutFilePath = new JLabel(localizer.getTranslation(OUTPUT_FILE_PATH));
JTextField tf_OutputFile = new JTextField("");
- configuration.put("outputFile", tf_OutputFile);
+ configuration.put(ARG_OUTPUT_FILE, tf_OutputFile);
tf_OutputFile.setColumns(10);
String[] types = {"elenphArticle", "encArticle", "book", "journal"};
JComboBox cbox_type = new JComboBox(types);
- configuration.put("rdf_type", cbox_type);
+ configuration.put(ARG_RDF_TYPE, cbox_type);
- JLabel lb_type = new JLabel("Type");
+ JLabel lb_type = new JLabel(localizer.getTranslation(LABEL_TYPE));
- JLabel lb_metadataFilePath = new JLabel("Metadata path");
+ JLabel lb_metadataFilePath = new JLabel(localizer.getTranslation(LABEL_METADATA_PATH));
JTextField tf_metadataPath = new JTextField("");
- configuration.put("csv_metadata", tf_metadataPath);
+ configuration.put(ARG_CSV_METADATA, tf_metadataPath);
- JButton btnChooseFile = new JButton("Choose");
+ JButton btnChooseFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
btnChooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),"odt");
+ String newFilePath = fileDialog.chooseFile(tf_inputFile.getText(),ODT_FILE_EXTENSION);
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_inputFile.setText(newFilePath);
- setOutputFilePath(newFilePath,tf_OutputFile,"rdf");
- setMetadataFilePath(newFilePath,tf_metadataPath,"csv");
+ setOutputFilePath(newFilePath,tf_OutputFile,RDF_FILE_EXTENSION);
+ setMetadataFilePath(newFilePath,tf_metadataPath,CSV_FILE_EXTENSION);
}
}
});
- JButton btn_ChooseOutputFile = new JButton("Choose");
+ JButton btn_ChooseOutputFile = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
btn_ChooseOutputFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),"rdf");
+ String newFilePath = fileDialog.chooseFile(tf_OutputFile.getText(),RDF_FILE_EXTENSION);
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_OutputFile.setText(newFilePath);
}
@@ -821,135 +873,120 @@ public class ConfigurationWindow extends JFrame {
tf_metadataPath.setColumns(10);
- JButton btn_metadataChoose = new JButton("Choose");
+ JButton btn_metadataChoose = new JButton(localizer.getTranslation(LABEL_BUTTON_CHOOSE));
btn_metadataChoose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileDialog fileDialog = new FileDialog();
- String newFilePath = fileDialog.chooseFile(tf_metadataPath.getText(),"csv");
+ String newFilePath = fileDialog.chooseFile(tf_metadataPath.getText(),CSV_FILE_EXTENSION);
if (newFilePath != null && !newFilePath.isEmpty()) {
tf_metadataPath.setText(newFilePath);
}
}
});
- JLabel lb_pageBreakInlineStyle = new JLabel("Page break inline style");
+ JLabel lb_pageBreakInlineStyle = new JLabel(localizer.getTranslation(LABEL_BREAK_STYLE));
JTextField tf_pageBreakInlineStyle = new JTextField();
- configuration.put("page_break_style", tf_pageBreakInlineStyle);
+ configuration.put(ARG_PAGE_BREAK_STYLE, tf_pageBreakInlineStyle);
- tf_pageBreakInlineStyle.setText("height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;");
+ tf_pageBreakInlineStyle.setText(DEFAULT_PAGEBREAK_STYLE_SETTINGS);
tf_pageBreakInlineStyle.setColumns(10);
- JCheckBox cb_Pagination = new JCheckBox("Pagination");
- configuration.put("pagination", cb_Pagination);
+ JCheckBox cb_Pagination = new JCheckBox(localizer.getTranslation(LABEL_PAGINATION));
+ configuration.put(ARG_PAGINATION, cb_Pagination);
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
gl_panel_configHTML.setHorizontalGroup(
gl_panel_configHTML.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(23)
- .addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
- .addGap(12)
- .addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE)
- .addGap(21))
- .addGroup(Alignment.LEADING, gl_panel_configHTML.createSequentialGroup()
- .addGap(32)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(btn_metadataChoose, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
+ .addGroup(Alignment.TRAILING, gl_panel_configHTML.createSequentialGroup()
+ .addGap(32)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.TRAILING)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE))
+ .addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
+ .addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
+ .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.TRAILING)
+ .addComponent(lb_TargetFormat_description, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 311, GroupLayout.PREFERRED_SIZE)
+ .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE)
+ .addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 134, GroupLayout.PREFERRED_SIZE)
+ .addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 153, GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 655, Short.MAX_VALUE)
+ .addComponent(tf_metadataPath, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 655, Short.MAX_VALUE)
+ .addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 655, Short.MAX_VALUE)
+ .addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE))))
+ .addGap(18)
+ .addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.RELATED))))
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE))
- .addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
- .addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
- .addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE))
- .addContainerGap())
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
- .addGap(6)
- .addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(ComponentPlacement.RELATED)
- .addComponent(tf_metadataPath, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
- .addGap(32)
- .addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)))
- .addGap(6)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addComponent(btn_metadataChoose, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
- .addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))))
- .addGap(70)))))
+ .addGap(40)
+ .addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 729, Short.MAX_VALUE)))
+ .addGap(21))
);
gl_panel_configHTML.setVerticalGroup(
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addContainerGap()
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
- .addComponent(lb_TargetFormat_description)
- .addComponent(lb_TargetFormat))
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(24)
- .addComponent(lb_FilePath))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
+ .addComponent(lb_TargetFormat_description)
+ .addComponent(lb_TargetFormat))
.addGap(22)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(tf_inputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(btnChooseFile))))
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
+ .addComponent(btnChooseFile)))
.addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(23)
- .addComponent(lb_metadataFilePath))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(21)
- .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
- .addComponent(tf_metadataPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(btn_metadataChoose))))
- .addGap(29)
+ .addGap(51)
+ .addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))
+ .addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
- .addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(btn_ChooseOutputFile))
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(2)
- .addComponent(lb_OutFilePath)))
- .addGap(23)
+ .addComponent(tf_metadataPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(btn_metadataChoose))
+ .addComponent(lb_metadataFilePath))
+ .addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_panel_configHTML.createSequentialGroup()
- .addGap(2)
- .addComponent(lb_pageBreakInlineStyle))
- .addComponent(tf_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
+ .addComponent(lb_OutFilePath)
+ .addComponent(tf_OutputFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addComponent(btn_ChooseOutputFile))
.addGap(18)
+ .addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
+ .addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
+ .addComponent(tf_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addGap(61)
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.BASELINE)
.addComponent(lb_type)
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
@@ -977,7 +1014,7 @@ public class ConfigurationWindow extends JFrame {
.addComponent(cb_UseMathJax)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(cb_Pagination)
- .addContainerGap(207, Short.MAX_VALUE))
+ .addContainerGap(172, Short.MAX_VALUE))
);
panel_configHTML.setLayout(gl_panel_configHTML);
return panel_configHTML;
@@ -986,7 +1023,7 @@ public class ConfigurationWindow extends JFrame {
private JPanel createControlPanel(HashMap configuration) {
JPanel controlPanel = new JPanel();
- JButton btn_Exit = new JButton("Exit");
+ JButton btn_Exit = new JButton(localizer.getTranslation(BUTTON_EXIT_LABEL));
btn_Exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
singleFrame.setVisible(false);
@@ -994,19 +1031,19 @@ public class ConfigurationWindow extends JFrame {
}
});
- JButton btn_SaveAs = new JButton("Save As");
+ JButton btn_SaveAs = new JButton(localizer.getTranslation(BUTTON_SAVEAS_LABEL));
btn_SaveAs.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
- JOptionPane.showMessageDialog(singleFrame, "Not implemented, yet.");
+ JOptionPane.showMessageDialog(singleFrame, localizer.getTranslation(MESSAGE_NOT_IMPLEMENTED));
}
});
- JButton btn_Save = new JButton("Save");
+ JButton btn_Save = new JButton(localizer.getTranslation(BUTTON_SAVE_LABEL));
btn_Save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
- JOptionPane.showMessageDialog(singleFrame, "Not implemented, yet.");
+ JOptionPane.showMessageDialog(singleFrame, localizer.getTranslation(MESSAGE_NOT_IMPLEMENTED));
}
});
- JButton btn_startConversion = new JButton("Convert");
+ JButton btn_startConversion = new JButton(localizer.getTranslation(BUTTON_CONVERT_LABEL));
btn_startConversion.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
try {
diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/Localizer.java b/src/main/java/pro/litvinovg/w2phtml/gui/Localizer.java
new file mode 100644
index 0000000..80cd6a8
--- /dev/null
+++ b/src/main/java/pro/litvinovg/w2phtml/gui/Localizer.java
@@ -0,0 +1,32 @@
+package pro.litvinovg.w2phtml.gui;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class Localizer {
+
+ private static final String TRANSLATION_NOT_FOUND = "no translation";
+ private Locale currentLocale;
+ private String resourceBundle = "pro.litvinovg.w2phtml.gui.localizations.w2phtml";
+ private ResourceBundle translations;
+ public Localizer() {
+ currentLocale = Locale.forLanguageTag("EN");//Locale.getDefault();
+ translations = ResourceBundle.getBundle(resourceBundle, currentLocale);
+ }
+
+ public String getTranslation(String name) {
+ if (translations != null && translations.containsKey(name)) {
+ String translation = translations.getString(name);
+ try {
+ return new String(translation.getBytes("ISO-8859-1"), "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+ return TRANSLATION_NOT_FOUND;
+
+ }
+}
diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/localizations/w2phtml.properties b/src/main/java/pro/litvinovg/w2phtml/gui/localizations/w2phtml.properties
new file mode 100644
index 0000000..607f184
--- /dev/null
+++ b/src/main/java/pro/litvinovg/w2phtml/gui/localizations/w2phtml.properties
@@ -0,0 +1,29 @@
+converter_title_label=Converter from ODT to HTML, ePub and RDF
+button_saveas_label=Save As
+button_save_label=Save
+button_exit_label=Exit
+button_convert_label=Convert
+label_target_format=Output file format
+label_input_file_path=Input file path
+label_output_file_path=Output file path
+label_convert_to_px=Convert dimensions to pixels instead of REM (root em)
+label_scale=Scale
+label_embed_raster=Embed raster images
+label_embed_vector=Embed vector images
+label_inline_styles=Inline styles
+label_button_choose=Choose
+label_max_body_width=Max body width
+label_min_letter_spacing=Filter letter spacing less than
+label_ingnore_empty_pars=Filter empty paragraphs
+label_greenstone_split=Split document into subsections for Greenstone digital library
+label_break_style=Page break inline style
+label_pagination=Pagination
+label_split_whole_pages_only=Split on whole pages only
+label_use_mathjax=Use MathJax
+label_fileter_hard_line_breaks=Filter hard line breaks
+label_metadata_path=Metadata path
+label_type=Type
+label_split_by_heading=Split into multiple files by heading level
+label_html5=html5
+error_cant_write=Attention. Can't save file in output directory.
+message_not_implemented=Not implemented
\ No newline at end of file
diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/localizations/w2phtml_ru.properties b/src/main/java/pro/litvinovg/w2phtml/gui/localizations/w2phtml_ru.properties
new file mode 100644
index 0000000..9cbcf84
--- /dev/null
+++ b/src/main/java/pro/litvinovg/w2phtml/gui/localizations/w2phtml_ru.properties
@@ -0,0 +1,29 @@
+converter_title_label=Конвертер из формата ODT в HTML, ePub или RDF
+button_saveas_label=Сохранить как
+button_save_label=Сохранить
+button_exit_label=Закрыть
+button_convert_label=Запуск
+label_target_format=Целевой формат файла
+label_input_file_path=Путь к входному файлу
+label_output_file_path=Путь к выходному файлу
+label_convert_to_px=Конвертировать в пиксели (вместо rem)
+label_scale=Масштабирование
+label_embed_raster=Встроить растровые изображения
+label_embed_vector=Встроить векторные изображения
+label_inline_styles=Применить стили внутри html элементов
+label_button_choose=Выбрать
+label_max_body_width=Максимальная ширина
+label_min_letter_spacing=Отбросить межсимвольные расстояния меньше
+label_ingnore_empty_pars=Не конвертировать пустые параграфы
+label_greenstone_split=Встроить комментарии для содержаний в Greenstone
+label_break_style=Стиль разрывов страниц
+label_pagination=Требуется ли пагинация
+label_split_whole_pages_only=Разрывы только по границам страниц
+label_use_mathjax=Встроить библиотеку MathJax для формул
+label_fileter_hard_line_breaks=Не конвертировать жесткие разрывы строк
+label_metadata_path=Путь к метаданным
+label_type=Тип документа
+label_split_by_heading=Разделить на файлы по заголовкам до уровня (включительно)
+label_html5=html5
+error_cant_write=Ошибка. Не удалось сохранить файл в целевую директорию
+message_not_implemented=Данная функциональность еще не реализована
\ No newline at end of file