Skip to content

Commit

Permalink
moved all jsesh specific i18n information and labels to jseshLabels
Browse files Browse the repository at this point in the history
  • Loading branch information
rosmord committed Sep 6, 2023
1 parent 3c42645 commit 54e36ca
Show file tree
Hide file tree
Showing 26 changed files with 722 additions and 748 deletions.
7 changes: 7 additions & 0 deletions jsesh/src/main/java/jsesh/editor/MDCEditorKeyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ private void addEditingModeAction(String actionID, char mode) {
addAction(actionID, action);
}

/**
* Add and configure an action, knowing its unique string ID, and the action itself.
*
* Post-condition: all action properties (such as label, accelerator keys, etc.) will be set.
* @param actionID
* @param action
*/
private void addAction(String actionID, Action action) {
actionMap.put(actionID, action);
BundledActionFiller.initActionProperties(action, actionID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@

import org.qenherkhopeshef.guiFramework.AppDefaults;

import jsesh.resources.JSeshMessages;

public class AppDefaultFactory {
public static AppDefaults getAppDefaults() {
AppDefaults appDefaults= new AppDefaults();
appDefaults.addResourceBundle("jsesh.editor.labels");
// Weakness of the system here : JSeshMessages
// is a bit too talkative about itself.
appDefaults.addResourceBundle(JSeshMessages.getBundleName());
return appDefaults;
}
}
4 changes: 2 additions & 2 deletions jsesh/src/main/java/jsesh/glossary/JGlossaryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import javax.swing.SwingUtilities;

import jsesh.editor.JMDCField;
import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;
import jsesh.swing.renderers.MdCTableCellRenderer;

/**
Expand Down Expand Up @@ -82,7 +82,7 @@ public JGlossaryEditor() {
// table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
fixTable();

okButton = new JButton(I18n.getString("JGlossaryEditor.add.label"));
okButton = new JButton(JSeshMessages.getString("JGlossaryEditor.add.label"));
okButton.addActionListener(EventHandler.create(ActionListener.class,
this, "addEntry"));
mdcField.getHieroglyphicTextModel().addObserver(
Expand Down
6 changes: 3 additions & 3 deletions jsesh/src/main/java/jsesh/glossary/JRemoveButtonCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;

import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;

/**
* Very specific class for 'remove' button in our glossary.
Expand All @@ -60,7 +60,7 @@ public class JRemoveButtonCell extends AbstractCellEditor implements TableCellEd

public JRemoveButtonCell(GlossaryTableModel model) {
this.model= model;
this.active= new JButton(I18n.getString("JRemoveButtonCell.remove.label"));
this.active= new JButton(JSeshMessages.getString("JRemoveButtonCell.remove.label"));
active.addActionListener(EventHandler.create(ActionListener.class, this, "remove"));
active.setMaximumSize(active.getMinimumSize());
}
Expand All @@ -86,7 +86,7 @@ public void remove() {
}

public static double getMaxWidth() {
JButton button = new JButton(I18n.getString("JRemoveButtonCell.remove.label"));
JButton button = new JButton(JSeshMessages.getString("JRemoveButtonCell.remove.label"));
return button.getPreferredSize().getWidth();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

import jsesh.graphics.export.generic.SelectionExporter;

import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;
import jsesh.swing.utils.FileSaveConfirmDialog;

import org.qenherkhopeshef.graphics.emf.EMFGraphics2D;
Expand All @@ -67,7 +67,7 @@ public class EMFExporter extends AbstractGraphicalExporter {
private String comment = "";

public EMFExporter(Component parent) {
super("emf", I18n.getString("EMFExporter.description"));
super("emf", JSeshMessages.getString("EMFExporter.description"));
this.parent = parent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import javax.swing.JOptionPane;
import jsesh.graphics.export.generic.SelectionExporter;

import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;

import org.qenherkhopeshef.graphics.eps.EncapsulatedPostscriptGraphics2D;

Expand All @@ -70,7 +70,7 @@ public class EPSExporter extends AbstractGraphicalExporter {

// private MDCView view;
public EPSExporter(Component parent) {
super("eps", I18n.getString("EPSExporter.description"));
super("eps", JSeshMessages.getString("EPSExporter.description"));
this.parent = parent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import javax.swing.filechooser.FileFilter;

import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;
import jsesh.swing.utils.FileSaveConfirmDialog;
import org.qenherkhopeshef.swingUtils.portableFileDialog.FileOperationResult;
import org.qenherkhopeshef.swingUtils.portableFileDialog.PortableFileDialog;
Expand Down Expand Up @@ -105,7 +105,7 @@ public AbstractGraphicalExporter(String extension, String description) {
public AbstractGraphicalExporter(String extensions[], String description) {
this.extensions = extensions;
this.description = description;
fileName = I18n.getString("AbstractGraphicalExporter.unnamed") + "." + extensions[0]; //$NON-NLS-1$
fileName = JSeshMessages.getString("AbstractGraphicalExporter.unnamed") + "." + extensions[0]; //$NON-NLS-1$
}

public File getExportFile() {
Expand Down Expand Up @@ -135,7 +135,7 @@ public void setDirectory(File directory) {
@Override
public void setOriginalDocumentFile(URI uri) {
if (uri == null) {
fileName = I18n.getString("AbstractGraphicalExporter.unnamed") + "." + extensions[0]; //$NON-NLS-1$
fileName = JSeshMessages.getString("AbstractGraphicalExporter.unnamed") + "." + extensions[0]; //$NON-NLS-1$
} else if (uri.getScheme() == null || uri.getScheme().equals("file")) {
fileName = new File(uri).getName();
fileName = fileName.substring(0, fileName.lastIndexOf(".")) + "." + extensions[0];
Expand Down
52 changes: 26 additions & 26 deletions jsesh/src/main/java/jsesh/graphics/export/html/HTMLExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import javax.swing.filechooser.FileFilter;
import javax.swing.text.NumberFormatter;

import jsesh.i18n.I18n;
import jsesh.mdc.model.AlphabeticText;
import jsesh.mdc.model.LineBreak;
import jsesh.mdc.model.ModelElement;
Expand All @@ -42,6 +41,7 @@
import jsesh.mdcDisplayer.preferences.DrawingSpecification;
import jsesh.mdcDisplayer.preferences.DrawingSpecificationsImplementation;
import jsesh.mdcDisplayer.preferences.PageLayout;
import jsesh.resources.JSeshMessages;
import jsesh.swing.utils.GraphicsUtils;
import org.qenherkhopeshef.swingUtils.portableFileDialog.FileOperationResult;
import org.qenherkhopeshef.swingUtils.portableFileDialog.PortableFileDialog;
Expand Down Expand Up @@ -548,43 +548,44 @@ private OptionPanel(Component popupParent, String paneltitle) {

// Title :
titleField = new JTextField(HTMLExporter.this.title, 40);
titleField.setToolTipText(I18n.getString("HTMLExporter.title.toolTip")); //$NON-NLS-1$
titleField.setToolTipText(JSeshMessages.getString("HTMLExporter.title.toolTip")); //$NON-NLS-1$

// Directory
directoryField = new JFormattedTextField();
directoryField.setValue(directory);
directoryField.setColumns(40);
browse = new JButton(I18n.getString("HTMLExporter.browse.label")); //$NON-NLS-1$
browse = new JButton(JSeshMessages.getString("HTMLExporter.browse.label")); //$NON-NLS-1$
browse.addActionListener(e -> browse());

// Base name.
baseNameField = new JTextField(baseName, 20);
baseNameField
.setToolTipText(I18n.getString("HTMLExporter.baseName.toolTip")); //$NON-NLS-1$
.setToolTipText(JSeshMessages.getString("HTMLExporter.baseName.toolTip")); //$NON-NLS-1$
// Respect pages :
respectPageField = new JCheckBox(I18n.getString("HTMLExporter.respectPage.label"), respectPages); //$NON-NLS-1$
respectPageField = new JCheckBox(JSeshMessages.getString("HTMLExporter.respectPage.label"), respectPages); //$NON-NLS-1$
respectPageField
.setToolTipText(I18n.getString("HTMLExporter.respectPage.toolTip")); //$NON-NLS-1$
.setToolTipText(JSeshMessages.getString("HTMLExporter.respectPage.toolTip")); //$NON-NLS-1$

// line height.
// NOTE : I use a java 1.4 specific class.
lineHeightField = new JFormattedTextField();
lineHeightField.setValue(lineHeight);
lineHeightField
.setToolTipText(I18n.getString("HTMLExporter.lineHeight.toolTip")); //$NON-NLS-1$
.setToolTipText(JSeshMessages.getString("HTMLExporter.lineHeight.toolTip")); //$NON-NLS-1$

// Picture top and bottom margin
pictureMarginField = new JFormattedTextField();
pictureMarginField.setValue(pictureMargin);
pictureMarginField
.setToolTipText(I18n.getString("HTMLExporter.margin.toolTip")); //$NON-NLS-1$
.setToolTipText(JSeshMessages.getString("HTMLExporter.margin.toolTip")); //$NON-NLS-1$

protectSpecialField = new JCheckBox(I18n.getString("HTMLExporter.protectHTML.label")); //$NON-NLS-1$
protectSpecialField = new JCheckBox(JSeshMessages.getString("HTMLExporter.protectHTML.label")); //$NON-NLS-1$
protectSpecialField
.setToolTipText(I18n.getString("HTMLExporter.protectHTML.toolTip")); //$NON-NLS-1$
.setToolTipText(JSeshMessages.getString("HTMLExporter.protectHTML.toolTip")); //$NON-NLS-1$
protectSpecialField.setSelected(htmlSpecialProtected);

newLineReplacementField = new JComboBox(new String[]{I18n.getString("HTMLExporter.newLineValue.label"), //$NON-NLS-1$
newLineReplacementField = new JComboBox(new String[]{
JSeshMessages.getString("HTMLExporter.newLineValue.label"), //$NON-NLS-1$
"<br>", "<p>"}); //$NON-NLS-1$ //$NON-NLS-2$
newLineReplacementField.setSelectedIndex(newLinesReplacement);

Expand All @@ -596,16 +597,16 @@ private OptionPanel(Component popupParent, String paneltitle) {
pictureScaleField.setColumns(4);

pictureScaleField
.setToolTipText(I18n.getString("HTMLExporter.scale.toolTip"));
.setToolTipText(JSeshMessages.getString("HTMLExporter.scale.toolTip"));

generatePictureSizeField = new JCheckBox(I18n.getString("HTMLExporter.pictureSize.label")); //$NON-NLS-1$
generatePictureSizeField = new JCheckBox(JSeshMessages.getString("HTMLExporter.pictureSize.label")); //$NON-NLS-1$
generatePictureSizeField
.setToolTipText(I18n.getString("HTMLExporter.pictureSize.toolTip")); //$NON-NLS-1$
.setToolTipText(JSeshMessages.getString("HTMLExporter.pictureSize.toolTip")); //$NON-NLS-1$
generatePictureSizeField.setSelected(generatePictureSize);

centerPictureField = new JCheckBox(I18n.getString("HTMLExporter.centerPictures.label")); //$NON-NLS-1$
centerPictureField = new JCheckBox(JSeshMessages.getString("HTMLExporter.centerPictures.label")); //$NON-NLS-1$
centerPictureField
.setToolTipText(I18n.getString("HTMLExporter.centerPictures.toolTip")); //$NON-NLS-1$
.setToolTipText(JSeshMessages.getString("HTMLExporter.centerPictures.toolTip")); //$NON-NLS-1$
centerPictureField.setSelected(centerPictures);

// OK, This layout is UGLY. REALLY.
Expand All @@ -618,29 +619,29 @@ private OptionPanel(Component popupParent, String paneltitle) {
c.insets = new Insets(3, 3, 3, 3);
c.gridwidth = 1;
c.anchor = GridBagConstraints.WEST;
add(new LabeledField(I18n.getString("HTMLExporter.documentTitle.label"), titleField), c); //$NON-NLS-1$
add(new LabeledField(JSeshMessages.getString("HTMLExporter.documentTitle.label"), titleField), c); //$NON-NLS-1$
c.gridy++;
add(new LabeledField(I18n.getString("HTMLExporter.directory.label"), directoryField), c); //$NON-NLS-1$
add(new LabeledField(JSeshMessages.getString("HTMLExporter.directory.label"), directoryField), c); //$NON-NLS-1$
c.gridx = 1;
add(browse, c);
c.gridx = 0;
c.gridy++;
add(new LabeledField(I18n.getString("HTMLExporter.baseName.label"), baseNameField), c); //$NON-NLS-1$
add(new LabeledField(JSeshMessages.getString("HTMLExporter.baseName.label"), baseNameField), c); //$NON-NLS-1$
c.gridy++;
add(respectPageField, c);
c.gridy++;
add(new LabeledField(I18n.getString("HTMLExporter.lineHeight.label"), lineHeightField), c); //$NON-NLS-1$
add(new LabeledField(JSeshMessages.getString("HTMLExporter.lineHeight.label"), lineHeightField), c); //$NON-NLS-1$
c.gridy++;
Insets oldInset = c.insets;
c.insets = new Insets(20, 0, 0, 0);
add(new JLabel(I18n.getString("HTMLExporter.advancedSettings.label")), c); //$NON-NLS-1$
add(new JLabel(JSeshMessages.getString("HTMLExporter.advancedSettings.label")), c); //$NON-NLS-1$
c.insets = oldInset;
c.gridy++;
add(
new LabeledField(I18n.getString("HTMLExporter.verticalMargin.label"), //$NON-NLS-1$
new LabeledField(JSeshMessages.getString("HTMLExporter.verticalMargin.label"), //$NON-NLS-1$
pictureMarginField), c);
c.gridy++;
add(new LabeledField(I18n.getString("HTMLExporter.scale.label"), pictureScaleField), c); //$NON-NLS-1$
add(new LabeledField(JSeshMessages.getString("HTMLExporter.scale.label"), pictureScaleField), c); //$NON-NLS-1$
c.gridy++;
add(protectSpecialField, c);
c.gridy++;
Expand All @@ -649,7 +650,7 @@ private OptionPanel(Component popupParent, String paneltitle) {
add(centerPictureField, c);
c.gridy++;

add(new LabeledField(I18n.getString("HTMLExporter.newLine.label"), //$NON-NLS-1$
add(new LabeledField(JSeshMessages.getString("HTMLExporter.newLine.label"), //$NON-NLS-1$
newLineReplacementField), c);
}

Expand All @@ -672,11 +673,10 @@ public void setOptions() {
private void browse() {
PortableFileDialog portableFileDialog = PortableFileDialogFactory.createDirectorySaveDialog(getPopupParent());
portableFileDialog.setCurrentDirectory(directory);
//chooser.setApproveButtonText(I18n.getString("HTMLExporter.chooseDirectory.label")); //$NON-NLS-1$
portableFileDialog.setFileFilter(new FileFilter() {
@Override
public String getDescription() {
return I18n.getString("HTMLExporter.directoryDescription.label"); //$NON-NLS-1$
return JSeshMessages.getString("HTMLExporter.directoryDescription.label"); //$NON-NLS-1$
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import jsesh.graphics.export.generic.SelectionExporter;

import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;
import jsesh.swing.utils.FileSaveConfirmDialog;

import org.qenherkhopeshef.graphics.pict.MacPictGraphics2D;
Expand All @@ -35,7 +35,7 @@ public class MacPictExporter extends AbstractGraphicalExporter {
private MacPictGraphics2D currentGraphics;

public MacPictExporter() {
super(new String[]{"pct", "pict"}, I18n.getString("MacPictExporter.description"));
super(new String[]{"pct", "pict"}, JSeshMessages.getString("MacPictExporter.description"));
frame = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import jsesh.graphics.export.generic.SelectionExporter;

import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;
import jsesh.swing.utils.FileSaveConfirmDialog;

import org.qenherkhopeshef.graphics.svg.SVGGraphics2D;
Expand All @@ -29,7 +29,7 @@ public class SVGExporter extends AbstractGraphicalExporter {
private Dimension2D scaledDimension;

public SVGExporter(final Component frame) {
super("svg", I18n.getString("SVGExporter.description"));
super("svg", JSeshMessages.getString("SVGExporter.description"));
this.frame = frame;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import javax.swing.JOptionPane;
import jsesh.graphics.export.generic.SelectionExporter;

import jsesh.i18n.I18n;
import jsesh.resources.JSeshMessages;

import org.qenherkhopeshef.graphics.wmf.WMFGraphics2D;
import org.qenherkhopeshef.swingUtils.errorHandler.UserMessage;
Expand All @@ -35,7 +35,7 @@ public class WMFExporter extends AbstractGraphicalExporter {
private Dimension2D scaledDimension;

public WMFExporter() {
super("wmf", I18n.getString("WMFExporter.description"));
super("wmf", JSeshMessages.getString("WMFExporter.description"));
frame = null;
}

Expand Down
25 changes: 0 additions & 25 deletions jsesh/src/main/java/jsesh/i18n/I18n.java

This file was deleted.

Loading

0 comments on commit 54e36ca

Please sign in to comment.