Localize status messages and contributions panel

This commit is contained in:
Federico Bond
2014-08-01 02:32:01 -03:00
parent 2749e12b68
commit 359a5f3c47
4 changed files with 53 additions and 28 deletions
+16 -16
View File
@@ -360,13 +360,13 @@ public abstract class Editor extends JFrame implements RunnerListener {
}
if (successful == 0) {
statusError("No files were added to the sketch.");
statusError(Language.text("editor.status.drag_and_drop.no_files_added"));
} else if (successful == 1) {
statusNotice("One file added to the sketch.");
statusNotice(Language.text("editor.status.drag_and_drop.one_file_added"));
} else {
statusNotice(successful + " files added to the sketch.");
statusNotice(String.format(Language.text("editor.status.drag_and_drop.n_files_added"), successful));
}
return true;
}
@@ -1852,7 +1852,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
}
if (formattedText.equals(source)) {
statusNotice("No changes necessary for Auto Format.");
statusNotice(Language.text("editor.status.autoformat.no_changes"));
} else {
// replace with new bootiful text
// selectionEnd hopefully at least in the neighborhood
@@ -1876,7 +1876,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
}
getSketch().setModified(true);
// mark as finished
statusNotice("Auto Format finished.");
statusNotice(Language.text("editor.status.autoformat.finished"));
}
} catch (final Exception e) {
@@ -2090,9 +2090,9 @@ public abstract class Editor extends JFrame implements RunnerListener {
} else {
String text = textarea.getSelectedText().trim();
if (text.length() == 0) {
statusNotice("First select a word to find in the reference.");
statusNotice(Language.text("editor.status.find_reference.select_word_first"));
} else {
statusNotice("No reference available for \"" + text + "\"");
statusNotice(String.format(Language.text("editor.status.find_reference.not_available"), text));
}
}
}
@@ -2525,10 +2525,10 @@ public abstract class Editor extends JFrame implements RunnerListener {
protected void handleSaveImpl() {
statusNotice("Saving...");
statusNotice(Language.text("editor.status.saving"));
try {
if (sketch.save()) {
statusNotice("Done Saving.");
statusNotice(Language.text("editor.status.saving.done"));
} else {
statusEmpty();
}
@@ -2546,7 +2546,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
public boolean handleSaveAs() {
statusNotice("Saving...");
statusNotice(Language.text("editor.status.saving"));
try {
if (sketch.saveAs()) {
// statusNotice("Done Saving.");
@@ -2558,7 +2558,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
// only one who knows whether something was renamed.
//sketchbook.rebuildMenusAsync();
} else {
statusNotice("Save Canceled.");
statusNotice(Language.text("editor.status.saving.canceled"));
return false;
}
} catch (Exception e) {
@@ -2589,7 +2589,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
* Handler for File → Print.
*/
public void handlePrint() {
statusNotice("Printing...");
statusNotice(Language.text("editor.status.printing"));
//printerJob = null;
if (printerJob == null) {
printerJob = PrinterJob.getPrinterJob();
@@ -2606,14 +2606,14 @@ public abstract class Editor extends JFrame implements RunnerListener {
if (printerJob.printDialog()) {
try {
printerJob.print();
statusNotice("Done printing.");
statusNotice(Language.text("editor.status.printing.done"));
} catch (PrinterException pe) {
statusError("Error while printing.");
statusError(Language.text("editor.status.printing.error"));
pe.printStackTrace();
}
} else {
statusNotice("Printing canceled.");
statusNotice(Language.text("editor.status.printing.canceled"));
}
//printerJob = null; // clear this out?
}
@@ -2906,4 +2906,4 @@ public abstract class Editor extends JFrame implements RunnerListener {
super.show(component, x, y);
}
}
}
}
@@ -26,6 +26,7 @@ import java.net.*;
import processing.app.Base;
import processing.app.Editor;
import processing.app.Language;
public class ContributionManager {
@@ -64,7 +65,7 @@ public class ContributionManager {
// TODO this is often -1, may need to set progress to indeterminate
int fileSize = conn.getContentLength();
// System.out.println("file size is " + fileSize);
progress.startTask("Downloading", fileSize);
progress.startTask(Language.text("contributions.progress.downloading"), fileSize);
InputStream in = conn.getInputStream();
FileOutputStream out = new FileOutputStream(dest);
@@ -40,6 +40,7 @@ import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.StyleSheet;
import processing.app.Base;
import processing.app.Language;
/**
@@ -433,14 +434,14 @@ class ContributionPanel extends JPanel {
if (contrib.isDeletionFlagged()) {
installRemoveButton.addActionListener(undoActionListener);
installRemoveButton.setText("Undo");
installRemoveButton.setText(Language.text("contributions.undo"));
} else if (contrib.isInstalled()) {
installRemoveButton.addActionListener(removeActionListener);
installRemoveButton.setText("Remove");
installRemoveButton.setText(Language.text("contributions.remove"));
installRemoveButton.setVisible(true);
} else {
installRemoveButton.addActionListener(installActionListener);
installRemoveButton.setText("Install");
installRemoveButton.setText(Language.text("contributions.install"));
}
contextMenu.removeAll();
@@ -456,9 +457,7 @@ class ContributionPanel extends JPanel {
private void installContribution(AvailableContribution info) {
if (info.link == null) {
listPanel.contribManager.status.setErrorMessage("Your operating system "
+ "doesn't appear to be supported. You should visit the "
+ info.getType() + "'s library for more info.");
listPanel.contribManager.status.setErrorMessage(String.format(Language.text("contributions.unsupported_operating_system"), info.getType()));
} else {
installContribution(info, info.link);
}
@@ -485,7 +484,7 @@ class ContributionPanel extends JPanel {
installRemoveButton.setEnabled(true);
if (isError()) {
listPanel.contribManager.status.setErrorMessage("An error occured while downloading the contribution.");
listPanel.contribManager.status.setErrorMessage(Language.text("contributions.download_error"));
}
}
};
@@ -520,7 +519,7 @@ class ContributionPanel extends JPanel {
protected void resetInstallProgressBarState() {
installProgressBar.setString("Starting");
installProgressBar.setString(Language.text("contributions.progress.starting"));
installProgressBar.setIndeterminate(false);
installProgressBar.setValue(0);
installProgressBar.setVisible(false);
@@ -540,7 +539,7 @@ class ContributionPanel extends JPanel {
if (contrib != null && !contrib.getType().requiresRestart()) {
updateButton.setVisible(isSelected() && contribListing.hasUpdates(contrib));
}
installRemoveButton.setVisible(isSelected() || installRemoveButton.getText().equals("Remove"));
installRemoveButton.setVisible(isSelected() || installRemoveButton.getText().equals(Language.text("contributions.remove")));
// for (JTextPane textPane : headerPaneSet) {
{
@@ -694,4 +693,4 @@ class ContributionPanel extends JPanel {
}
}
}
}
}
@@ -211,4 +211,29 @@ editor.header.delete = Delete
editor.header.previous_tab = Previous Tab
editor.header.next_tab = Next Tab
editor.header.delete.warning.title = Yeah, no.
editor.header.delete.warning.text = You can't delete the last tab of the last open sketch.
editor.header.delete.warning.text = You can't delete the last tab of the last open sketch.
editor.status.autoformat.no_changes = No changes necessary for Auto Format.
editor.status.autoformat.finished = Auto Format finished.
editor.status.find_reference.select_word_first = First select a word to find in the reference.
editor.status.find_reference.not_available = No reference available for "%s".
editor.status.drag_and_drop.no_files_added = No files were added to the sketch.
editor.status.drag_and_drop.one_file_added = One file added to the sketch.
editor.status.drag_and_drop.n_files_added = %d files added to the sketch.
editor.status.saving = Saving...
editor.status.saving.done = Done saving.
editor.status.saving.canceled = Save canceled.
editor.status.printing = Printing...
editor.status.printing.done = Done printing.
editor.status.printing.error = Error while printing.
editor.status.printing.canceled = Printing canceled.
# ---------------------------------------
# Contribution Panel
contributions.undo = Undo
contributions.remove = Remove
contributions.install = Install
contributions.progress.starting = Starting
contributions.progress.downloading = Downloading
contributions.download_error = An error occured while downloading the contribution.
contributions.unsupported_operating_system = Your operating system doesn't appear to be supported. You should visit the %s's library for more info.