Got rid of Java 8 warnings about _ as a method name

This commit is contained in:
Federico Fissore 2015-08-05 09:04:53 +02:00
parent 5dd73a1828
commit 50cacc1756
60 changed files with 704 additions and 725 deletions

View File

@ -48,7 +48,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class BuiltInCoreIsNewerCheck implements Runnable {
@ -93,7 +93,7 @@ public class BuiltInCoreIsNewerCheck implements Runnable {
SwingUtilities.invokeLater(() -> {
PreferencesData.setInteger("builtin_platform_is_newer", BaseNoGui.REVISION);
assert base.hasActiveEditor();
int chosenOption = JOptionPane.showConfirmDialog(base.getActiveEditor(), I18n.format(_("The IDE includes an updated {0} package, but you're using an older one.\nDo you want to upgrade {0}?"), installedBuiltIn.getName()), I18n.format(_("A newer {0} package is available"), installedBuiltIn.getName()), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
int chosenOption = JOptionPane.showConfirmDialog(base.getActiveEditor(), I18n.format(tr("The IDE includes an updated {0} package, but you're using an older one.\nDo you want to upgrade {0}?"), installedBuiltIn.getName()), I18n.format(tr("A newer {0} package is available"), installedBuiltIn.getName()), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (chosenOption == JOptionPane.YES_OPTION) {
Action openBoardsManager = base.getOpenBoardsManager();
Event event = new Event(base.getActiveEditor(), ActionEvent.ACTION_PERFORMED, installedBuiltIn.getName());

View File

@ -54,7 +54,7 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.I18n.format;
@SuppressWarnings("serial")
@ -72,13 +72,13 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
public ContributedLibraryTableCell() {
{
installButton = new JButton(_("Install"));
installButton = new JButton(tr("Install"));
installButton.addActionListener(e -> onInstall(editorValue.getSelected(), editorValue.getInstalled()));
int width = installButton.getPreferredSize().width;
installButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
}
downgradeButton = new JButton(_("Install"));
downgradeButton = new JButton(tr("Install"));
downgradeButton.addActionListener(e -> {
ContributedLibrary selected = (ContributedLibrary) downgradeChooser.getSelectedItem();
onInstall(selected, editorValue.getInstalled());
@ -234,7 +234,7 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
Collections.sort(uninstalledReleases, new ReverseComparator<>(new DownloadableContributionVersionComparator()));
downgradeChooser.removeAllItems();
downgradeChooser.addItem(_("Select version"));
downgradeChooser.addItem(tr("Select version"));
final List<ContributedLibrary> uninstalledPreviousReleases = Lists.newLinkedList();
final List<ContributedLibrary> uninstalledNewerReleases = Lists.newLinkedList();
@ -286,10 +286,10 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
upgradable = new DownloadableContributionVersionComparator().compare(selected, installed) > 0;
}
if (installable) {
installButton.setText(_("Install"));
installButton.setText(tr("Install"));
}
if (upgradable) {
installButton.setText(_("Update"));
installButton.setText(tr("Update"));
}
installButton.setVisible(installable || upgradable);
installButtonPlaceholder.setVisible(!(installable || upgradable));
@ -323,9 +323,9 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
if (installed != null) {
String installedVer = installed.getParsedVersion();
if (installedVer == null) {
desc += " " + _("Version unknown");
desc += " " + tr("Version unknown");
} else {
desc += " " + format(_("Version <b>{0}</b>"), installedVer);
desc += " " + format(tr("Version <b>{0}</b>"), installedVer);
}
}
desc += "</font>";

View File

@ -36,7 +36,7 @@ import cc.arduino.contributions.ui.DropdownItem;
import java.util.function.Predicate;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class DropdownInstalledLibraryItem implements DropdownItem<ContributedLibrary> {
@ -47,7 +47,7 @@ public class DropdownInstalledLibraryItem implements DropdownItem<ContributedLib
}
public String toString() {
return _("Installed");
return tr("Installed");
}
@Override

View File

@ -7,7 +7,7 @@ import cc.arduino.contributions.ui.DropdownItem;
import java.util.function.Predicate;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class DropdownUpdatableLibrariesItem implements DropdownItem<ContributedLibrary> {
@ -24,7 +24,7 @@ public class DropdownUpdatableLibrariesItem implements DropdownItem<ContributedL
@Override
public String toString() {
return _("Updatable");
return tr("Updatable");
}
@Override

View File

@ -47,7 +47,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.function.Predicate;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
@SuppressWarnings("serial")
public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
@ -91,10 +91,10 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
}
public LibraryManagerUI(Frame parent, Platform platform) {
super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues."));
super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, tr("Unable to reach Arduino.cc due to possible network issues."));
this.platform = platform;
filtersContainer.add(new JLabel(_("Topic")), 1);
filtersContainer.add(new JLabel(tr("Topic")), 1);
filtersContainer.remove(2);
typeChooser = new JComboBox();
@ -102,7 +102,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
typeChooser.setEnabled(false);
filtersContainer.add(Box.createHorizontalStrut(5), 0);
filtersContainer.add(new JLabel(_("Type")), 1);
filtersContainer.add(new JLabel(tr("Type")), 1);
filtersContainer.add(Box.createHorizontalStrut(5), 2);
filtersContainer.add(typeChooser, 3);
}
@ -236,7 +236,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
clearErrorMessage();
installerThread = new Thread(() -> {
try {
setProgressVisible(true, _("Installing..."));
setProgressVisible(true, tr("Installing..."));
installer.install(lib, replaced);
onIndexesUpdated(); // TODO: Do a better job in refreshing only the needed element
//getContribModel().updateLibrary(lib);
@ -254,7 +254,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
boolean managedByIndex = indexer.getIndex().getLibraries().contains(lib);
if (!managedByIndex) {
int chosenOption = JOptionPane.showConfirmDialog(this, _("This library is not listed on Library Manager. You won't be able to reinstall it from here.\nAre you sure you want to delete it?"), _("Please confirm library deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
int chosenOption = JOptionPane.showConfirmDialog(this, tr("This library is not listed on Library Manager. You won't be able to reinstall it from here.\nAre you sure you want to delete it?"), tr("Please confirm library deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (chosenOption != JOptionPane.YES_OPTION) {
return;
}
@ -263,7 +263,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
clearErrorMessage();
installerThread = new Thread(() -> {
try {
setProgressVisible(true, _("Removing..."));
setProgressVisible(true, tr("Removing..."));
installer.remove(lib);
onIndexesUpdated(); // TODO: Do a better job in refreshing only the needed element
//getContribModel().updateLibrary(lib);

View File

@ -55,7 +55,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.stream.Collectors;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.I18n.format;
@SuppressWarnings("serial")
@ -75,20 +75,20 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
public ContributedPlatformTableCell() {
{
installButton = new JButton(_("Install"));
installButton = new JButton(tr("Install"));
installButton.addActionListener(e -> onInstall(editorValue.getSelected(), editorValue.getInstalled()));
int width = installButton.getPreferredSize().width;
installButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
}
{
removeButton = new JButton(_("Remove"));
removeButton = new JButton(tr("Remove"));
removeButton.addActionListener(e -> onRemove(editorValue.getInstalled()));
int width = removeButton.getPreferredSize().width;
removeButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
}
downgradeButton = new JButton(_("Install"));
downgradeButton = new JButton(tr("Install"));
downgradeButton.addActionListener(e -> {
ContributedPlatform selected = (ContributedPlatform) downgradeChooser.getSelectedItem();
onInstall(selected, editorValue.getInstalled());
@ -246,7 +246,7 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
Collections.sort(uninstalledReleases, new ReverseComparator<>(new DownloadableContributionVersionComparator()));
downgradeChooser.removeAllItems();
downgradeChooser.addItem(_("Select version"));
downgradeChooser.addItem(tr("Select version"));
final java.util.List<ContributedPlatform> uninstalledPreviousReleases = Lists.newLinkedList();
final java.util.List<ContributedPlatform> uninstalledNewerReleases = Lists.newLinkedList();
@ -300,10 +300,10 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
upgradable = new DownloadableContributionVersionComparator().compare(selected, installed) > 0;
}
if (installable) {
installButton.setText(_("Install"));
installButton.setText(tr("Install"));
}
if (upgradable) {
installButton.setText(_("Update"));
installButton.setText(tr("Update"));
}
installButton.setVisible(installable || upgradable);
installButtonPlaceholder.setVisible(!(installable || upgradable));
@ -321,11 +321,11 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
desc += " " + format("by <b>{0}</b>", author);
}
if (installed != null) {
desc += " " + format(_("version <b>{0}</b>"), installed.getParsedVersion()) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
desc += " " + format(tr("version <b>{0}</b>"), installed.getParsedVersion()) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
}
desc += "<br />";
desc += _("Boards included in this package:") + "<br />";
desc += tr("Boards included in this package:") + "<br />";
for (ContributedBoard board : selected.getBoards()) {
desc += board.getName() + ", ";
}

View File

@ -45,7 +45,7 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
@SuppressWarnings("serial")
public class ContributionManagerUI extends InstallerJDialog {
@ -86,7 +86,7 @@ public class ContributionManagerUI extends InstallerJDialog {
}
public ContributionManagerUI(Frame parent, Platform platform) {
super(parent, _("Boards Manager"), Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues."));
super(parent, tr("Boards Manager"), Dialog.ModalityType.APPLICATION_MODAL, tr("Unable to reach Arduino.cc due to possible network issues."));
this.platform = platform;
}
@ -169,7 +169,7 @@ public class ContributionManagerUI extends InstallerJDialog {
installerThread = new Thread(() -> {
List<String> errors = new LinkedList<>();
try {
setProgressVisible(true, _("Installing..."));
setProgressVisible(true, tr("Installing..."));
errors.addAll(installer.install(platformToInstall));
if (platformToRemove != null && !platformToRemove.isReadOnly()) {
errors.addAll(installer.remove(platformToRemove));
@ -192,7 +192,7 @@ public class ContributionManagerUI extends InstallerJDialog {
clearErrorMessage();
if (showWarning) {
int chosenOption = JOptionPane.showConfirmDialog(this, I18n.format(_("Do you want to remove {0}?\nIf you do so you won't be able to use {0} any more."), platform.getName()), _("Please confirm boards deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
int chosenOption = JOptionPane.showConfirmDialog(this, I18n.format(tr("Do you want to remove {0}?\nIf you do so you won't be able to use {0} any more."), platform.getName()), tr("Please confirm boards deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (chosenOption != JOptionPane.YES_OPTION) {
return;
}
@ -200,7 +200,7 @@ public class ContributionManagerUI extends InstallerJDialog {
installerThread = new Thread(() -> {
try {
setProgressVisible(true, _("Removing..."));
setProgressVisible(true, tr("Removing..."));
installer.remove(platform);
onIndexesUpdated();
} catch (Exception e) {

View File

@ -35,12 +35,12 @@ import cc.arduino.contributions.ui.DropdownItem;
import java.util.function.Predicate;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class DropdownAllCoresItem implements DropdownItem<ContributedPlatform> {
public String toString() {
return _("All");
return tr("All");
}
@Override

View File

@ -7,7 +7,7 @@ import cc.arduino.contributions.ui.DropdownItem;
import java.util.function.Predicate;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class DropdownUpdatableCoresItem implements DropdownItem<ContributedPlatform> {
@ -24,7 +24,7 @@ public class DropdownUpdatableCoresItem implements DropdownItem<ContributedPlatf
@Override
public String toString() {
return _("Updatable");
return tr("Updatable");
}
@Override

View File

@ -34,12 +34,12 @@ import cc.arduino.contributions.filters.NoopPredicate;
import java.util.function.Predicate;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class DropdownAllItem implements DropdownItem<DownloadableContribution> {
public String toString() {
return _("All");
return tr("All");
}
@Override

View File

@ -43,7 +43,7 @@ import java.util.function.Predicate;
import java.util.stream.Stream;
import static cc.arduino.contributions.packages.ui.ContributionIndexTableModel.DESCRIPTION_COL;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public abstract class InstallerJDialog<T> extends JDialog {
@ -92,7 +92,7 @@ public abstract class InstallerJDialog<T> extends JDialog {
categoryChooser.setMaximumRowCount(20);
categoryChooser.setEnabled(false);
filterField = new FilterJTextField(_("Filter your search...")) {
filterField = new FilterJTextField(tr("Filter your search...")) {
@Override
protected void onFilter(String[] _filters) {
filters = _filters;
@ -106,7 +106,7 @@ public abstract class InstallerJDialog<T> extends JDialog {
filtersContainer = new JPanel();
filtersContainer.setLayout(new BoxLayout(filtersContainer, BoxLayout.X_AXIS));
filtersContainer.add(Box.createHorizontalStrut(5));
filtersContainer.add(new JLabel(_("Type")));
filtersContainer.add(new JLabel(tr("Type")));
filtersContainer.add(Box.createHorizontalStrut(5));
filtersContainer.add(categoryChooser);
filtersContainer.add(Box.createHorizontalStrut(5));
@ -169,7 +169,7 @@ public abstract class InstallerJDialog<T> extends JDialog {
errorMessage.setForeground(Color.RED);
{
JButton cancelButton = new JButton(_("Cancel"));
JButton cancelButton = new JButton(tr("Cancel"));
cancelButton.addActionListener(arg0 -> onCancelPressed());
progressBox = Box.createHorizontalBox();
@ -177,13 +177,13 @@ public abstract class InstallerJDialog<T> extends JDialog {
progressBox.add(Box.createHorizontalStrut(5));
progressBox.add(cancelButton);
dismissErrorMessageButton = new JButton(_("OK"));
dismissErrorMessageButton = new JButton(tr("OK"));
dismissErrorMessageButton.addActionListener(arg0 -> {
clearErrorMessage();
setErrorMessageVisible(false);
});
closeButton = new JButton(_("Close"));
closeButton = new JButton(tr("Close"));
closeButton.addActionListener(arg0 -> InstallerJDialog.this.dispatchEvent(new WindowEvent(InstallerJDialog.this, WindowEvent.WINDOW_CLOSING)));
errorMessageBox = Box.createHorizontalBox();

View File

@ -31,7 +31,7 @@ package cc.arduino.contributions.ui;
import javax.swing.*;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class InstallerJDialogUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
@ -45,7 +45,7 @@ public class InstallerJDialogUncaughtExceptionHandler implements Thread.Uncaught
@Override
public void uncaughtException(Thread t, final Throwable e) {
String errorMessage = _(e.getMessage().substring(e.getMessage().indexOf(":") + 1));
String errorMessage = tr(e.getMessage().substring(e.getMessage().indexOf(":") + 1));
if (errorMessage.startsWith("Error downloading")) {
errorMessage = connectionErrorMessage;
}

View File

@ -42,7 +42,7 @@ import javax.swing.text.BadLocationException;
import java.io.File;
import java.io.IOException;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class AStyle implements Tool {
@ -84,7 +84,7 @@ public class AStyle implements Tool {
String formattedText = aStyleInterface.AStyleMain(originalText, formatterConfiguration);
if (formattedText.equals(originalText)) {
editor.statusNotice(_("No changes necessary for Auto Format."));
editor.statusNotice(tr("No changes necessary for Auto Format."));
return;
}
@ -107,7 +107,7 @@ public class AStyle implements Tool {
}
// mark as finished
editor.statusNotice(_("Auto Format finished."));
editor.statusNotice(tr("Auto Format finished."));
}
private void setCaretPosition(SketchTextArea textArea, int line, int lineOffset) throws BadLocationException {
@ -140,7 +140,7 @@ public class AStyle implements Tool {
@Override
public String getMenuTitle() {
return _("Auto Format");
return tr("Auto Format");
}
}

View File

@ -40,7 +40,7 @@ import java.awt.event.WindowEvent;
import java.util.HashMap;
import java.util.Map;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class FindReplace extends javax.swing.JFrame {
@ -137,25 +137,25 @@ public class FindReplace extends javax.swing.JFrame {
replaceAllButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(_("Find"));
setTitle(tr("Find"));
findLabel.setText(_("Find:"));
findLabel.setText(tr("Find:"));
findField.setColumns(20);
replaceLabel.setText(_("Replace with:"));
replaceLabel.setText(tr("Replace with:"));
replaceField.setColumns(20);
ignoreCaseBox.setSelected(true);
ignoreCaseBox.setText(_("Ignore Case"));
ignoreCaseBox.setText(tr("Ignore Case"));
wrapAroundBox.setSelected(true);
wrapAroundBox.setText(_("Wrap Around"));
wrapAroundBox.setText(tr("Wrap Around"));
searchAllFilesBox.setText(_("Search all Sketch Tabs"));
searchAllFilesBox.setText(tr("Search all Sketch Tabs"));
findButton.setText(_("Find"));
findButton.setText(tr("Find"));
findButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
findButtonActionPerformed(evt);
@ -163,7 +163,7 @@ public class FindReplace extends javax.swing.JFrame {
});
buttonsContainer.add(findButton);
previousButton.setText(_("Previous"));
previousButton.setText(tr("Previous"));
previousButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
previousButtonActionPerformed(evt);
@ -171,7 +171,7 @@ public class FindReplace extends javax.swing.JFrame {
});
buttonsContainer.add(previousButton);
replaceFindButton.setText(_("Replace & Find"));
replaceFindButton.setText(tr("Replace & Find"));
replaceFindButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
replaceFindButtonActionPerformed(evt);
@ -179,7 +179,7 @@ public class FindReplace extends javax.swing.JFrame {
});
buttonsContainer.add(replaceFindButton);
replaceButton.setText(_("Replace"));
replaceButton.setText(tr("Replace"));
replaceButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
replaceButtonActionPerformed(evt);
@ -187,7 +187,7 @@ public class FindReplace extends javax.swing.JFrame {
});
buttonsContainer.add(replaceButton);
replaceAllButton.setText(_("Replace All"));
replaceAllButton.setText(tr("Replace All"));
replaceAllButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
replaceAllButtonActionPerformed(evt);

View File

@ -40,7 +40,7 @@ import java.awt.event.WindowEvent;
import java.util.Arrays;
import java.util.Collection;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog {
@ -70,7 +70,7 @@ public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog {
unofficialListURLLabel = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(_("Additional Boards Manager URLs"));
setTitle(tr("Additional Boards Manager URLs"));
setModal(true);
setModalExclusionType(java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
@ -79,23 +79,23 @@ public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog {
additionalBoardsManagerURLs.setName(""); // NOI18N
jScrollPane1.setViewportView(additionalBoardsManagerURLs);
cancel.setText(_("Cancel"));
cancel.setText(tr("Cancel"));
cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelActionPerformed(evt);
}
});
ok.setText(_("OK"));
ok.setText(tr("OK"));
ok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okActionPerformed(evt);
}
});
jLabel1.setText(_("Enter additional URLs, one for each row"));
jLabel1.setText(tr("Enter additional URLs, one for each row"));
unofficialListURLLabel.setText(_("Click for a list of unofficial boards support URLs"));
unofficialListURLLabel.setText(tr("Click for a list of unofficial boards support URLs"));
unofficialListURLLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
unofficialListURLLabel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {

View File

@ -42,7 +42,7 @@ import java.awt.event.WindowEvent;
import java.io.File;
import java.util.LinkedList;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class Preferences extends javax.swing.JDialog {
@ -99,92 +99,92 @@ public class Preferences extends javax.swing.JDialog {
this.base = base;
this.languages = new Language[]{
new Language(_("System Default"), "", ""),
new Language(_("Albanian"), "shqip", "sq"),
new Language(_("Arabic"), "العربية", "ar"),
new Language(_("Aragonese"), "Aragonés", "an"),
new Language(_("Belarusian"), "Беларуская мова", "be"),
new Language(_("Bulgarian"), "български", "bg"),
new Language(_("Catalan"), "Català", "ca"),
new Language(_("Chinese Simplified"), "简体中文", "zh_CN"),
new Language(_("Chinese Traditional"), "繁體中文", "zh_TW"),
new Language(_("Croatian"), "Hrvatski", "hr_HR"),
new Language(_("Czech (Czech Republic)"), "český (Czech Republic)", "cs_CZ"),
new Language(_("Danish (Denmark)"), "Dansk (Denmark)", "da_DK"),
new Language(_("Dutch"), "Nederlands", "nl"),
new Language(_("English"), "English", "en"),
new Language(_("English (United Kingdom)"), "English (United Kingdom)", "en_GB"),
new Language(_("Estonian"), "Eesti", "et"),
new Language(_("Estonian (Estonia)"), "Eesti keel", "et_EE"),
new Language(_("Filipino"), "Pilipino", "fil"),
new Language(_("Finnish"), "Suomi", "fi"),
new Language(_("French"), "Français", "fr"),
new Language(_("Canadian French"), "Canadienne-français", "fr_CA"),
new Language(_("Galician"), "Galego", "gl"),
new Language(_("Georgian"), "საქართველოს", "ka_GE"),
new Language(_("German"), "Deutsch", "de_DE"),
new Language(_("Greek"), "ελληνικά", "el_GR"),
new Language(_("Hebrew"), "עברית", "he"),
new Language(_("Hindi"), "हिंदी", "hi"),
new Language(_("Hungarian"), "Magyar", "hu"),
new Language(_("Indonesian"), "Bahasa Indonesia", "id"),
new Language(_("Italian"), "Italiano", "it_IT"),
new Language(_("Japanese"), "日本語", "ja_JP"),
new Language(_("Korean"), "한국어", "ko_KR"),
new Language(_("Latvian"), "Latviešu", "lv_LV"),
new Language(_("Lithuaninan"), "Lietuvių Kalba", "lt_LT"),
new Language(_("Norwegian Bokmål"), "Norsk bokmål", "nb_NO"),
new Language(_("Persian"), "فارسی", "fa"),
new Language(_("Polish"), "Język Polski", "pl"),
new Language(_("Portuguese (Brazil)"), "Português (Brazil)", "pt_BR"),
new Language(_("Portuguese (Portugal)"), "Português (Portugal)", "pt_PT"),
new Language(_("Romanian"), "Română", "ro"),
new Language(_("Russian"), "Русский", "ru"),
new Language(_("Slovenian"), "Slovenščina", "sl_SI"),
new Language(_("Spanish"), "Español", "es"),
new Language(_("Swedish"), "Svenska", "sv"),
new Language(_("Tamil"), "தமிழ்", "ta"),
new Language(_("Turkish"), "Türk", "tr"),
new Language(_("Ukrainian"), "Український", "uk"),
new Language(_("Vietnamese"), "Tiếng Việt", "vi"),
new Language(tr("System Default"), "", ""),
new Language(tr("Albanian"), "shqip", "sq"),
new Language(tr("Arabic"), "العربية", "ar"),
new Language(tr("Aragonese"), "Aragonés", "an"),
new Language(tr("Belarusian"), "Беларуская мова", "be"),
new Language(tr("Bulgarian"), "български", "bg"),
new Language(tr("Catalan"), "Català", "ca"),
new Language(tr("Chinese Simplified"), "简体中文", "zh_CN"),
new Language(tr("Chinese Traditional"), "繁體中文", "zh_TW"),
new Language(tr("Croatian"), "Hrvatski", "hr_HR"),
new Language(tr("Czech (Czech Republic)"), "český (Czech Republic)", "cs_CZ"),
new Language(tr("Danish (Denmark)"), "Dansk (Denmark)", "da_DK"),
new Language(tr("Dutch"), "Nederlands", "nl"),
new Language(tr("English"), "English", "en"),
new Language(tr("English (United Kingdom)"), "English (United Kingdom)", "en_GB"),
new Language(tr("Estonian"), "Eesti", "et"),
new Language(tr("Estonian (Estonia)"), "Eesti keel", "et_EE"),
new Language(tr("Filipino"), "Pilipino", "fil"),
new Language(tr("Finnish"), "Suomi", "fi"),
new Language(tr("French"), "Français", "fr"),
new Language(tr("Canadian French"), "Canadienne-français", "fr_CA"),
new Language(tr("Galician"), "Galego", "gl"),
new Language(tr("Georgian"), "საქართველოს", "ka_GE"),
new Language(tr("German"), "Deutsch", "de_DE"),
new Language(tr("Greek"), "ελληνικά", "el_GR"),
new Language(tr("Hebrew"), "עברית", "he"),
new Language(tr("Hindi"), "हिंदी", "hi"),
new Language(tr("Hungarian"), "Magyar", "hu"),
new Language(tr("Indonesian"), "Bahasa Indonesia", "id"),
new Language(tr("Italian"), "Italiano", "it_IT"),
new Language(tr("Japanese"), "日本語", "ja_JP"),
new Language(tr("Korean"), "한국어", "ko_KR"),
new Language(tr("Latvian"), "Latviešu", "lv_LV"),
new Language(tr("Lithuaninan"), "Lietuvių Kalba", "lt_LT"),
new Language(tr("Norwegian Bokmål"), "Norsk bokmål", "nb_NO"),
new Language(tr("Persian"), "فارسی", "fa"),
new Language(tr("Polish"), "Język Polski", "pl"),
new Language(tr("Portuguese (Brazil)"), "Português (Brazil)", "pt_BR"),
new Language(tr("Portuguese (Portugal)"), "Português (Portugal)", "pt_PT"),
new Language(tr("Romanian"), "Română", "ro"),
new Language(tr("Russian"), "Русский", "ru"),
new Language(tr("Slovenian"), "Slovenščina", "sl_SI"),
new Language(tr("Spanish"), "Español", "es"),
new Language(tr("Swedish"), "Svenska", "sv"),
new Language(tr("Tamil"), "தமிழ்", "ta"),
new Language(tr("Turkish"), "Türk", "tr"),
new Language(tr("Ukrainian"), "Український", "uk"),
new Language(tr("Vietnamese"), "Tiếng Việt", "vi"),
};
this.missingLanguages = new Language[]{
new Language(_("Afrikaans"), "Afrikaans", "af"),
new Language(_("Armenian"), "Հայերեն", "hy"),
new Language(_("Asturian"), "Asturianu", "ast"),
new Language(_("Basque"), "Euskara", "eu"),
new Language(_("Bengali (India)"), "বাংলা (India)", "bn_IN"),
new Language(_("Bosnian"), "Bosanski", "bs"),
new Language(_("Burmese (Myanmar)"), "ဗမာစကား", "my_MM"),
new Language(_("Chinese (China)"), "", "zh_CN"),
new Language(_("Chinese (Hong Kong)"), "", "zh_HK"),
new Language(_("Chinese (Taiwan)"), "", "zh_TW"),
new Language(_("Chinese (Taiwan) (Big5)"), "", "zh_TW.Big5"),
new Language(_("Czech"), "český", "cs"),
new Language(_("Danish"), "Dansk", "da"),
new Language(_("Dutch (Netherlands)"), "Nederlands", "nl_NL"),
new Language(_("Galician (Spain)"), "Galego (Spain)", "gl_ES"),
new Language(_("Nepali"), "नेपाली", "ne"),
new Language(_("N'Ko"), "ߒߞߏ", "nqo"),
new Language(_("Marathi"), "मराठी", "mr"),
new Language(_("Malay (Malaysia)"), "بهاس ملايو (Malaysia)", "ms_MY"),
new Language(_("Norwegian"), "Norsk", "no"),
new Language(_("Norwegian Nynorsk"), "Norsk Nynorsk", "nn"),
new Language(_("Portugese"), "Português", "pt"),
new Language(_("Persian (Iran)"), "فارسی (Iran)", "fa_IR"),
new Language(_("Slovak"), "Slovenčina", "sk"),
new Language(_("Swahili"), "كِسوَهِل", "sw"),
new Language(_("Talossan"), "Talossan", "tzl"),
new Language(_("Urdu (Pakistan)"), "اردو (Pakistan)", "ur_PK"),
new Language(_("Western Frisian"), "Western Frisian", "fy"),
new Language(tr("Afrikaans"), "Afrikaans", "af"),
new Language(tr("Armenian"), "Հայերեն", "hy"),
new Language(tr("Asturian"), "Asturianu", "ast"),
new Language(tr("Basque"), "Euskara", "eu"),
new Language(tr("Bengali (India)"), "বাংলা (India)", "bn_IN"),
new Language(tr("Bosnian"), "Bosanski", "bs"),
new Language(tr("Burmese (Myanmar)"), "ဗမာစကား", "my_MM"),
new Language(tr("Chinese (China)"), "", "zh_CN"),
new Language(tr("Chinese (Hong Kong)"), "", "zh_HK"),
new Language(tr("Chinese (Taiwan)"), "", "zh_TW"),
new Language(tr("Chinese (Taiwan) (Big5)"), "", "zh_TW.Big5"),
new Language(tr("Czech"), "český", "cs"),
new Language(tr("Danish"), "Dansk", "da"),
new Language(tr("Dutch (Netherlands)"), "Nederlands", "nl_NL"),
new Language(tr("Galician (Spain)"), "Galego (Spain)", "gl_ES"),
new Language(tr("Nepali"), "नेपाली", "ne"),
new Language(tr("N'Ko"), "ߒߞߏ", "nqo"),
new Language(tr("Marathi"), "मराठी", "mr"),
new Language(tr("Malay (Malaysia)"), "بهاس ملايو (Malaysia)", "ms_MY"),
new Language(tr("Norwegian"), "Norsk", "no"),
new Language(tr("Norwegian Nynorsk"), "Norsk Nynorsk", "nn"),
new Language(tr("Portugese"), "Português", "pt"),
new Language(tr("Persian (Iran)"), "فارسی (Iran)", "fa_IR"),
new Language(tr("Slovak"), "Slovenčina", "sk"),
new Language(tr("Swahili"), "كِسوَهِل", "sw"),
new Language(tr("Talossan"), "Talossan", "tzl"),
new Language(tr("Urdu (Pakistan)"), "اردو (Pakistan)", "ur_PK"),
new Language(tr("Western Frisian"), "Western Frisian", "fy"),
};
this.warningItems = new WarningItem[]{
new WarningItem("none", _("None")),
new WarningItem("default", _("Default")),
new WarningItem("more", _("More")),
new WarningItem("all", _("All"))
new WarningItem("none", tr("None")),
new WarningItem("default", tr("Default")),
new WarningItem("more", tr("More")),
new WarningItem("all", tr("All"))
};
initComponents();
@ -234,11 +234,11 @@ public class Preferences extends javax.swing.JDialog {
saveVerifyUploadBox = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(_("Preferences"));
setTitle(tr("Preferences"));
setModal(true);
setResizable(false);
sketchbookLocationLabel.setText(_("Sketchbook location:"));
sketchbookLocationLabel.setText(tr("Sketchbook location:"));
sketchbookLocationField.setColumns(40);
@ -249,26 +249,26 @@ public class Preferences extends javax.swing.JDialog {
}
});
comboLanguageLabel.setText(_("Editor language: "));
comboLanguageLabel.setText(tr("Editor language: "));
requiresRestartLabel.setText(_(" (requires restart of Arduino)"));
requiresRestartLabel.setText(tr(" (requires restart of Arduino)"));
fontSizeLabel.setText(_("Editor font size: "));
fontSizeLabel.setText(tr("Editor font size: "));
fontSizeField.setColumns(4);
showVerboseLabel.setText(_("Show verbose output during: "));
showVerboseLabel.setText(tr("Show verbose output during: "));
verboseCompilationBox.setText(_("compilation "));
verboseCompilationBox.setText(tr("compilation "));
verboseUploadBox.setText(_("upload"));
verboseUploadBox.setText(tr("upload"));
comboWarningsLabel.setText(_("Compiler warnings: "));
comboWarningsLabel.setText(tr("Compiler warnings: "));
additionalBoardsManagerLabel.setText(_("Additional Boards Manager URLs: "));
additionalBoardsManagerLabel.setToolTipText(_("Enter a comma separated list of urls"));
additionalBoardsManagerLabel.setText(tr("Additional Boards Manager URLs: "));
additionalBoardsManagerLabel.setToolTipText(tr("Enter a comma separated list of urls"));
additionalBoardsManagerField.setToolTipText(_("Enter a comma separated list of urls"));
additionalBoardsManagerField.setToolTipText(tr("Enter a comma separated list of urls"));
extendedAdditionalUrlFieldWindow.setIcon(new ImageIcon(Base.getThemeImage("newwindow.gif", this)));
extendedAdditionalUrlFieldWindow.setMargin(new java.awt.Insets(1, 1, 1, 1));
@ -279,7 +279,7 @@ public class Preferences extends javax.swing.JDialog {
});
morePreferencesLabel.setForeground(Color.GRAY);
morePreferencesLabel.setText(_("More preferences can be edited directly in the file"));
morePreferencesLabel.setText(tr("More preferences can be edited directly in the file"));
preferencesFileLabel.setText(PreferencesData.getPreferencesFile().getAbsolutePath());
preferencesFileLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
@ -298,7 +298,7 @@ public class Preferences extends javax.swing.JDialog {
});
arduinoNotRunningLabel.setForeground(Color.GRAY);
arduinoNotRunningLabel.setText(_("(edit only when Arduino is not running)"));
arduinoNotRunningLabel.setText(tr("(edit only when Arduino is not running)"));
okButton.setText(I18n.PROMPT_OK);
okButton.addActionListener(new java.awt.event.ActionListener() {
@ -316,25 +316,25 @@ public class Preferences extends javax.swing.JDialog {
checkboxesContainer.setLayout(new javax.swing.BoxLayout(checkboxesContainer, javax.swing.BoxLayout.Y_AXIS));
displayLineNumbersBox.setText(_("Display line numbers"));
displayLineNumbersBox.setText(tr("Display line numbers"));
checkboxesContainer.add(displayLineNumbersBox);
enableCodeFoldingBox.setText(_("Enable Code Folding"));
enableCodeFoldingBox.setText(tr("Enable Code Folding"));
checkboxesContainer.add(enableCodeFoldingBox);
verifyUploadBox.setText(_("Verify code after upload"));
verifyUploadBox.setText(tr("Verify code after upload"));
checkboxesContainer.add(verifyUploadBox);
externalEditorBox.setText(_("Use external editor"));
externalEditorBox.setText(tr("Use external editor"));
checkboxesContainer.add(externalEditorBox);
checkUpdatesBox.setText(_("Check for updates on startup"));
checkUpdatesBox.setText(tr("Check for updates on startup"));
checkboxesContainer.add(checkUpdatesBox);
updateExtensionBox.setText(_("Update sketch files to new extension on save (.pde -> .ino)"));
updateExtensionBox.setText(tr("Update sketch files to new extension on save (.pde -> .ino)"));
checkboxesContainer.add(updateExtensionBox);
saveVerifyUploadBox.setText(_("Save when verifying or uploading"));
saveVerifyUploadBox.setText(tr("Save when verifying or uploading"));
checkboxesContainer.add(saveVerifyUploadBox);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@ -442,7 +442,7 @@ public class Preferences extends javax.swing.JDialog {
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
File dflt = new File(sketchbookLocationField.getText());
File file = Base.selectFolder(_("Select new sketchbook location"), dflt, this);
File file = Base.selectFolder(tr("Select new sketchbook location"), dflt, this);
if (file != null) {
String path = file.getAbsolutePath();
if (BaseNoGui.getPortableFolder() != null) {
@ -481,7 +481,7 @@ public class Preferences extends javax.swing.JDialog {
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
java.util.List<String> errors = validateData();
if (!errors.isEmpty()) {
Base.showWarning(_("Error"), errors.get(0), null);
Base.showWarning(tr("Error"), errors.get(0), null);
return;
}
@ -511,7 +511,7 @@ public class Preferences extends javax.swing.JDialog {
private java.util.List<String> validateData() {
java.util.List<String> errors = new LinkedList<>();
if (FileUtils.isSubDirectory(new File(sketchbookLocationField.getText()), new File(PreferencesData.get("runtime.ide.path")))) {
errors.add(_("The specified sketchbook folder contains your copy of the IDE.\nPlease choose a different folder for your sketchbook."));
errors.add(tr("The specified sketchbook folder contains your copy of the IDE.\nPlease choose a different folder for your sketchbook."));
}
return errors;
}
@ -542,7 +542,7 @@ public class Preferences extends javax.swing.JDialog {
PreferencesData.set("editor.font", PApplet.join(pieces, ','));
} catch (Exception e) {
System.err.println(I18n.format(_("ignoring invalid font size {0}"), newSizeText));
System.err.println(I18n.format(tr("ignoring invalid font size {0}"), newSizeText));
}
// put each of the settings into the table

View File

@ -1,11 +1,7 @@
package processing.app;
import static processing.app.I18n._;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
@ -14,20 +10,12 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.AbstractAction;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.border.EmptyBorder;
import javax.swing.text.DefaultCaret;
import cc.arduino.packages.BoardPort;
import processing.app.debug.TextAreaFIFO;
import processing.app.legacy.PApplet;
@SuppressWarnings("serial")

View File

@ -1,38 +1,29 @@
package processing.app;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.AbstractAction;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import javax.swing.text.DefaultCaret;
import cc.arduino.packages.BoardPort;
import processing.app.debug.TextAreaFIFO;
import processing.app.legacy.PApplet;
@SuppressWarnings("serial")
public abstract class AbstractTextMonitor extends AbstractMonitor {
@ -76,7 +67,7 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
upperPane.setBorder(new EmptyBorder(4, 4, 4, 4));
textField = new JTextField(40);
sendButton = new JButton(_("Send"));
sendButton = new JButton(tr("Send"));
upperPane.add(textField);
upperPane.add(Box.createRigidArea(new Dimension(4, 0)));
@ -88,16 +79,16 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS));
pane.setBorder(new EmptyBorder(4, 4, 4, 4));
autoscrollBox = new JCheckBox(_("Autoscroll"), true);
autoscrollBox = new JCheckBox(tr("Autoscroll"), true);
noLineEndingAlert = new JLabel(I18n.format(_("You've pressed {0} but nothing was sent. Should you select a line ending?"), _("Send")));
noLineEndingAlert = new JLabel(I18n.format(tr("You've pressed {0} but nothing was sent. Should you select a line ending?"), tr("Send")));
noLineEndingAlert.setToolTipText(noLineEndingAlert.getText());
noLineEndingAlert.setForeground(pane.getBackground());
Dimension minimumSize = new Dimension(noLineEndingAlert.getMinimumSize());
minimumSize.setSize(minimumSize.getWidth() / 3, minimumSize.getHeight());
noLineEndingAlert.setMinimumSize(minimumSize);
lineEndings = new JComboBox(new String[]{_("No line ending"), _("Newline"), _("Carriage return"), _("Both NL & CR")});
lineEndings = new JComboBox(new String[]{tr("No line ending"), tr("Newline"), tr("Carriage return"), tr("Both NL & CR")});
lineEndings.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
PreferencesData.setInteger("serial.line_ending", lineEndings.getSelectedIndex());
@ -111,7 +102,7 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
serialRates = new JComboBox();
for (String rate : serialRateStrings) {
serialRates.addItem(rate + " " + _("baud"));
serialRates.addItem(rate + " " + tr("baud"));
}
serialRates.setMaximumSize(serialRates.getMinimumSize());
@ -157,4 +148,4 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
}
});
}
}
}

View File

@ -69,7 +69,7 @@ import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
@ -129,7 +129,7 @@ public class Base {
System.setProperty("swing.aatext", "true");
System.setProperty("java.net.useSystemProxies", "true");
splashScreenHelper.splashText(_("Loading configuration..."));
splashScreenHelper.splashText(tr("Loading configuration..."));
if (OSUtils.isMacOS()) {
ThinkDifferent.init();
@ -292,9 +292,9 @@ public class Base {
}
}
splashScreenHelper.splashText(_("Initializing packages..."));
splashScreenHelper.splashText(tr("Initializing packages..."));
BaseNoGui.initPackages();
splashScreenHelper.splashText(_("Preparing boards..."));
splashScreenHelper.splashText(tr("Preparing boards..."));
rebuildBoardsMenu();
rebuildProgrammerMenu();
@ -326,7 +326,7 @@ public class Base {
if (!parser.isForceSavePrefs())
PreferencesData.setDoSave(showEditor);
if (handleOpen(file, nextEditorLocation(), showEditor, false) == null) {
String mess = I18n.format(_("Failed to open sketch: \"{0}\""), path);
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
// Open failure is fatal in upload/verify mode
if (parser.isVerifyOrUploadMode())
showError(null, mess, 2);
@ -371,7 +371,7 @@ public class Base {
}
}
if (selected == null) {
System.out.println(_("Selected board is not available"));
System.out.println(tr("Selected board is not available"));
System.exit(1);
}
@ -420,7 +420,7 @@ public class Base {
}
}
if (selected == null) {
System.out.println(_("Selected library is not available"));
System.out.println(tr("Selected library is not available"));
System.exit(1);
}
@ -448,10 +448,10 @@ public class Base {
Editor editor = editors.get(0);
if (parser.isUploadMode()) {
splashScreenHelper.splashText(_("Verifying and uploading..."));
splashScreenHelper.splashText(tr("Verifying and uploading..."));
editor.exportHandler.run();
} else {
splashScreenHelper.splashText(_("Verifying..."));
splashScreenHelper.splashText(tr("Verifying..."));
editor.runHandler.run();
}
@ -463,7 +463,7 @@ public class Base {
// No errors exit gracefully
System.exit(0);
} else if (parser.isGuiMode()) {
splashScreenHelper.splashText(_("Starting..."));
splashScreenHelper.splashText(tr("Starting..."));
installKeyboardInputMap();
@ -726,13 +726,13 @@ public class Base {
if (index == 26*26) {
// In 0166, avoid running past zz by sending people outdoors.
if (!breakTime) {
showWarning(_("Time for a Break"),
_("You've reached the limit for auto naming of new sketches\n" +
showWarning(tr("Time for a Break"),
tr("You've reached the limit for auto naming of new sketches\n" +
"for the day. How about going for a walk instead?"), null);
breakTime = true;
} else {
showWarning(_("Sunshine"),
_("No really, time for some fresh air for you."), null);
showWarning(tr("Sunshine"),
tr("No really, time for some fresh air for you."), null);
}
return null;
}
@ -841,7 +841,7 @@ public class Base {
*/
public void handleOpenPrompt() throws Exception {
// get the frontmost window frame for placing file dialog
FileDialog fd = new FileDialog(activeEditor, _("Open an Arduino sketch..."), FileDialog.LOAD);
FileDialog fd = new FileDialog(activeEditor, tr("Open an Arduino sketch..."), FileDialog.LOAD);
File lastFolder = new File(PreferencesData.get("last.folder", BaseNoGui.getSketchbookFolder().getAbsolutePath()));
if (lastFolder.exists() && lastFolder.isFile()) {
lastFolder = lastFolder.getParentFile();
@ -1104,7 +1104,7 @@ public class Base {
menu.removeAll();
// Add the single "Open" item
item = Editor.newJMenuItem(_("Open..."), 'O');
item = Editor.newJMenuItem(tr("Open..."), 'O');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
@ -1165,7 +1165,7 @@ public class Base {
return;
importMenu.removeAll();
JMenuItem menu = new JMenuItem(_("Manage Libraries..."));
JMenuItem menu = new JMenuItem(tr("Manage Libraries..."));
menu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
openManageLibrariesDialog();
@ -1174,7 +1174,7 @@ public class Base {
importMenu.add(menu);
importMenu.addSeparator();
JMenuItem addLibraryMenuItem = new JMenuItem(_("Add .ZIP Library..."));
JMenuItem addLibraryMenuItem = new JMenuItem(tr("Add .ZIP Library..."));
addLibraryMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.this.handleAddLibrary();
@ -1198,7 +1198,7 @@ public class Base {
importMenu.addSeparator();
}
lastLibType = lib.getTypes().get(0);
JMenuItem platformItem = new JMenuItem(I18n.format(_("{0} libraries"), lastLibType));
JMenuItem platformItem = new JMenuItem(I18n.format(tr("{0} libraries"), lastLibType));
platformItem.setEnabled(false);
importMenu.add(platformItem);
}
@ -1209,7 +1209,7 @@ public class Base {
try {
activeEditor.getSketch().importLibrary(l);
} catch (IOException e) {
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", l.getSrcFolder()), e);
showWarning(tr("Error"), I18n.format("Unable to list header files in {0}", l.getSrcFolder()), e);
}
}
};
@ -1313,11 +1313,11 @@ public class Base {
boardsCustomMenus = new LinkedList<>();
// The first custom menu is the "Board" selection submenu
JMenu boardMenu = new JMenu(_("Board"));
JMenu boardMenu = new JMenu(tr("Board"));
boardMenu.putClientProperty("removeOnWindowDeactivation", true);
MenuScroller.setScrollerFor(boardMenu);
openBoardsManager = new AbstractAction(_("Boards Manager...")) {
openBoardsManager = new AbstractAction(tr("Boards Manager...")) {
public void actionPerformed(ActionEvent actionevent) {
String filterText = "";
if (actionevent instanceof cc.arduino.view.Event) {
@ -1349,7 +1349,7 @@ public class Base {
}
}
for (String customMenuTitle : customMenusTitles) {
JMenu customMenu = new JMenu(_(customMenuTitle));
JMenu customMenu = new JMenu(tr(customMenuTitle));
customMenu.putClientProperty("removeOnWindowDeactivation", true);
boardsCustomMenus.add(customMenu);
}
@ -1373,7 +1373,7 @@ public class Base {
// Add a title for each platform
String platformLabel = targetPlatform.getPreferences().get("name");
if (platformLabel != null && !targetPlatform.getBoards().isEmpty()) {
JMenuItem menuLabel = new JMenuItem(_(platformLabel));
JMenuItem menuLabel = new JMenuItem(tr(platformLabel));
menuLabel.setEnabled(false);
boardMenu.add(menuLabel);
}
@ -1436,13 +1436,13 @@ public class Base {
PreferencesMap customMenus = targetPlatform.getCustomMenus();
for (final String menuId : customMenus.keySet()) {
String title = customMenus.get(menuId);
JMenu menu = getBoardCustomMenu(_(title));
JMenu menu = getBoardCustomMenu(tr(title));
if (board.hasMenu(menuId)) {
PreferencesMap boardCustomMenu = board.getMenuLabels(menuId);
for (String customMenuOption : boardCustomMenu.keySet()) {
@SuppressWarnings("serial")
Action subAction = new AbstractAction(_(boardCustomMenu.get(customMenuOption))) {
Action subAction = new AbstractAction(tr(boardCustomMenu.get(customMenuOption))) {
public void actionPerformed(ActionEvent e) {
PreferencesData.set("custom_" + menuId, ((TargetBoard) getValue("board")).getId() + "_" + getValue("custom_menu_option"));
onBoardOrPortChange();
@ -1628,8 +1628,8 @@ public class Base {
e1.printStackTrace();
}
} else {
showWarning(_("Sketch Does Not Exist"),
_("The selected sketch no longer exists.\n"
showWarning(tr("Sketch Does Not Exist"),
tr("The selected sketch no longer exists.\n"
+ "You may need to restart Arduino to update\n"
+ "the sketchbook menu."), null);
}
@ -1647,13 +1647,13 @@ public class Base {
if (!builtOnce) {
String complaining = I18n
.format(
_("The sketch \"{0}\" cannot be used.\n"
tr("The sketch \"{0}\" cannot be used.\n"
+ "Sketch names must contain only basic letters and numbers\n"
+ "(ASCII-only with no spaces, "
+ "and it cannot start with a number).\n"
+ "To get rid of this message, remove the sketch from\n"
+ "{1}"), name, entry.getAbsolutePath());
showMessage(_("Ignoring sketch with bad name"), complaining);
showMessage(tr("Ignoring sketch with bad name"), complaining);
}
return false;
}
@ -1692,7 +1692,7 @@ public class Base {
try {
activeEditor.getSketch().importLibrary(l);
} catch (IOException e) {
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", l.getSrcFolder()), e);
showWarning(tr("Error"), I18n.format("Unable to list header files in {0}", l.getSrcFolder()), e);
}
}
};
@ -1792,8 +1792,8 @@ public class Base {
}
if (!result) {
showError(_("You forgot your sketchbook"),
_("Arduino cannot run because it could not\n" +
showError(tr("You forgot your sketchbook"),
tr("Arduino cannot run because it could not\n" +
"create a folder to store your sketchbook."), null);
}
@ -1813,7 +1813,7 @@ public class Base {
return folder;
}
String prompt = _("Select (or create new) folder for sketches...");
String prompt = tr("Select (or create new) folder for sketches...");
folder = selectFolder(prompt, null, null);
if (folder == null) {
System.exit(0);
@ -1837,8 +1837,8 @@ public class Base {
BaseNoGui.getPlatform().openURL(url);
} catch (Exception e) {
showWarning(_("Problem Opening URL"),
I18n.format(_("Could not open the URL\n{0}"), url), e);
showWarning(tr("Problem Opening URL"),
I18n.format(tr("Could not open the URL\n{0}"), url), e);
}
}
@ -1862,8 +1862,8 @@ public class Base {
BaseNoGui.getPlatform().openFolder(file);
} catch (Exception e) {
showWarning(_("Problem Opening Folder"),
I18n.format(_("Could not open the folder\n{0}"), file.getAbsolutePath()), e);
showWarning(tr("Problem Opening Folder"),
I18n.format(tr("Could not open the folder\n{0}"), file.getAbsolutePath()), e);
}
}
@ -1943,7 +1943,7 @@ public class Base {
if(referenceFile.exists()){
openURL(referenceFile.getAbsolutePath());
}else{
showWarning(_("Problem Opening URL"), I18n.format(_("Could not open the URL\n{0}"), referenceFile), null);
showWarning(tr("Problem Opening URL"), I18n.format(tr("Could not open the URL\n{0}"), referenceFile), null);
}
}
@ -2268,9 +2268,9 @@ public class Base {
public void handleAddLibrary() {
JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home"));
fileChooser.setDialogTitle(_("Select a zip file or a folder containing the library you'd like to add"));
fileChooser.setDialogTitle(tr("Select a zip file or a folder containing the library you'd like to add"));
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setFileFilter(new FileNameExtensionFilter(_("ZIP files or folders"), "zip"));
fileChooser.setFileFilter(new FileNameExtensionFilter(tr("ZIP files or folders"), "zip"));
Dimension preferredSize = fileChooser.getPreferredSize();
fileChooser.setPreferredSize(new Dimension(preferredSize.width + 200, preferredSize.height + 200));
@ -2293,7 +2293,7 @@ public class Base {
zipDeflater.deflate();
File[] foldersInTmpFolder = tmpFolder.listFiles(new OnlyDirs());
if (foldersInTmpFolder.length != 1) {
throw new IOException(_("Zip doesn't contain a library"));
throw new IOException(tr("Zip doesn't contain a library"));
}
sourceFile = foldersInTmpFolder[0];
} catch (IOException e) {
@ -2304,18 +2304,18 @@ public class Base {
File libFolder = sourceFile;
if (FileUtils.isSubDirectory(new File(PreferencesData.get("sketchbook.path")), libFolder)) {
activeEditor.statusError(_("A subfolder of your sketchbook is not a valid library"));
activeEditor.statusError(tr("A subfolder of your sketchbook is not a valid library"));
return;
}
if (FileUtils.isSubDirectory(libFolder, new File(PreferencesData.get("sketchbook.path")))) {
activeEditor.statusError(_("You can't import a folder that contains your sketchbook"));
activeEditor.statusError(tr("You can't import a folder that contains your sketchbook"));
return;
}
String libName = libFolder.getName();
if (!BaseNoGui.isSanitaryName(libName)) {
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
String mess = I18n.format(tr("The library \"{0}\" cannot be used.\n"
+ "Library names must contain only basic letters and numbers.\n"
+ "(ASCII only and no spaces, and it cannot start with a number)"),
libName);
@ -2330,14 +2330,14 @@ public class Base {
headers = BaseNoGui.headerListFromIncludePath(libFolder);
}
if (headers.length == 0) {
activeEditor.statusError(_("Specified folder/zip file does not contain a valid library"));
activeEditor.statusError(tr("Specified folder/zip file does not contain a valid library"));
return;
}
// copy folder
File destinationFolder = new File(BaseNoGui.getSketchbookLibrariesFolder(), sourceFile.getName());
if (!destinationFolder.mkdir()) {
activeEditor.statusError(I18n.format(_("A library named {0} already exists"), sourceFile.getName()));
activeEditor.statusError(I18n.format(tr("A library named {0} already exists"), sourceFile.getName()));
return;
}
try {
@ -2346,7 +2346,7 @@ public class Base {
activeEditor.statusError(e);
return;
}
activeEditor.statusNotice(_("Library added to your libraries. Check \"Include library\" menu"));
activeEditor.statusNotice(tr("Library added to your libraries. Check \"Include library\" menu"));
} catch (IOException e) {
// FIXME error when importing. ignoring :(
} finally {

View File

@ -75,7 +75,7 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
* Main editor panel for the Processing Development Environment.
@ -106,7 +106,7 @@ public class Editor extends JFrame implements RunnerListener {
}
private final static List<String> BOARD_PROTOCOLS_ORDER = Arrays.asList("serial", "network");
private final static List<String> BOARD_PROTOCOLS_ORDER_TRANSLATIONS = Arrays.asList(_("Serial ports"), _("Network ports"));
private final static List<String> BOARD_PROTOCOLS_ORDER_TRANSLATIONS = Arrays.asList(tr("Serial ports"), tr("Network ports"));
final Base base;
@ -416,14 +416,14 @@ public class Editor extends JFrame implements RunnerListener {
}
if (successful == 0) {
statusError(_("No files were added to the sketch."));
statusError(tr("No files were added to the sketch."));
} else if (successful == 1) {
statusNotice(_("One file added to the sketch."));
statusNotice(tr("One file added to the sketch."));
} else {
statusNotice(
I18n.format(_("{0} files added to the sketch."), successful));
I18n.format(tr("{0} files added to the sketch."), successful));
}
return true;
}
@ -550,7 +550,7 @@ public class Editor extends JFrame implements RunnerListener {
menubar.add(buildEditMenu());
final JMenu sketchMenu = new JMenu(_("Sketch"));
final JMenu sketchMenu = new JMenu(tr("Sketch"));
sketchMenu.setMnemonic(KeyEvent.VK_S);
sketchMenu.addMenuListener(new StubMenuListener() {
@ -594,10 +594,10 @@ public class Editor extends JFrame implements RunnerListener {
private JMenu buildFileMenu() {
JMenuItem item;
fileMenu = new JMenu(_("File"));
fileMenu = new JMenu(tr("File"));
fileMenu.setMnemonic(KeyEvent.VK_F);
item = newJMenuItem(_("New"), 'N');
item = newJMenuItem(tr("New"), 'N');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
@ -609,7 +609,7 @@ public class Editor extends JFrame implements RunnerListener {
});
fileMenu.add(item);
item = Editor.newJMenuItem(_("Open..."), 'O');
item = Editor.newJMenuItem(tr("Open..."), 'O');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
@ -622,7 +622,7 @@ public class Editor extends JFrame implements RunnerListener {
fileMenu.add(item);
base.rebuildRecentSketchesMenuItems();
recentSketchesMenu = new JMenu(_("Open Recent"));
recentSketchesMenu = new JMenu(tr("Open Recent"));
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
@ -632,20 +632,20 @@ public class Editor extends JFrame implements RunnerListener {
fileMenu.add(recentSketchesMenu);
if (sketchbookMenu == null) {
sketchbookMenu = new JMenu(_("Sketchbook"));
sketchbookMenu = new JMenu(tr("Sketchbook"));
MenuScroller.setScrollerFor(sketchbookMenu);
base.rebuildSketchbookMenu(sketchbookMenu);
}
fileMenu.add(sketchbookMenu);
if (examplesMenu == null) {
examplesMenu = new JMenu(_("Examples"));
examplesMenu = new JMenu(tr("Examples"));
MenuScroller.setScrollerFor(examplesMenu);
base.rebuildExamplesMenu(examplesMenu);
}
fileMenu.add(examplesMenu);
item = Editor.newJMenuItem(_("Close"), 'W');
item = Editor.newJMenuItem(tr("Close"), 'W');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.handleClose(Editor.this);
@ -653,7 +653,7 @@ public class Editor extends JFrame implements RunnerListener {
});
fileMenu.add(item);
saveMenuItem = newJMenuItem(_("Save"), 'S');
saveMenuItem = newJMenuItem(tr("Save"), 'S');
saveMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleSave(false);
@ -661,7 +661,7 @@ public class Editor extends JFrame implements RunnerListener {
});
fileMenu.add(saveMenuItem);
saveAsMenuItem = newJMenuItemShift(_("Save As..."), 'S');
saveAsMenuItem = newJMenuItemShift(tr("Save As..."), 'S');
saveAsMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleSaveAs();
@ -671,7 +671,7 @@ public class Editor extends JFrame implements RunnerListener {
fileMenu.addSeparator();
item = newJMenuItemShift(_("Page Setup"), 'P');
item = newJMenuItemShift(tr("Page Setup"), 'P');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handlePageSetup();
@ -679,7 +679,7 @@ public class Editor extends JFrame implements RunnerListener {
});
fileMenu.add(item);
item = newJMenuItem(_("Print"), 'P');
item = newJMenuItem(tr("Print"), 'P');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handlePrint();
@ -691,7 +691,7 @@ public class Editor extends JFrame implements RunnerListener {
if (!OSUtils.isMacOS()) {
fileMenu.addSeparator();
item = newJMenuItem(_("Preferences"), ',');
item = newJMenuItem(tr("Preferences"), ',');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.handlePrefs();
@ -701,7 +701,7 @@ public class Editor extends JFrame implements RunnerListener {
fileMenu.addSeparator();
item = newJMenuItem(_("Quit"), 'Q');
item = newJMenuItem(tr("Quit"), 'Q');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.handleQuit();
@ -722,7 +722,7 @@ public class Editor extends JFrame implements RunnerListener {
private void buildSketchMenu(JMenu sketchMenu) {
sketchMenu.removeAll();
JMenuItem item = newJMenuItem(_("Verify / Compile"), 'R');
JMenuItem item = newJMenuItem(tr("Verify / Compile"), 'R');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleRun(false, Editor.this.presentHandler, Editor.this.runHandler);
@ -730,7 +730,7 @@ public class Editor extends JFrame implements RunnerListener {
});
sketchMenu.add(item);
item = newJMenuItem(_("Upload"), 'U');
item = newJMenuItem(tr("Upload"), 'U');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleExport(false);
@ -738,7 +738,7 @@ public class Editor extends JFrame implements RunnerListener {
});
sketchMenu.add(item);
item = newJMenuItemShift(_("Upload Using Programmer"), 'U');
item = newJMenuItemShift(tr("Upload Using Programmer"), 'U');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleExport(true);
@ -747,7 +747,7 @@ public class Editor extends JFrame implements RunnerListener {
sketchMenu.add(item);
item = newJMenuItemAlt(_("Export compiled Binary"), 'S');
item = newJMenuItemAlt(tr("Export compiled Binary"), 'S');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleRun(false, new ShouldSaveReadOnly(), Editor.this.presentAndSaveHandler, Editor.this.runAndSaveHandler);
@ -765,7 +765,7 @@ public class Editor extends JFrame implements RunnerListener {
sketchMenu.addSeparator();
item = newJMenuItem(_("Show Sketch Folder"), 'K');
item = newJMenuItem(tr("Show Sketch Folder"), 'K');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.openFolder(sketch.getFolder());
@ -775,13 +775,13 @@ public class Editor extends JFrame implements RunnerListener {
item.setEnabled(Base.openFolderAvailable());
if (importMenu == null) {
importMenu = new JMenu(_("Include Library"));
importMenu = new JMenu(tr("Include Library"));
MenuScroller.setScrollerFor(importMenu);
base.rebuildImportMenu(importMenu);
}
sketchMenu.add(importMenu);
item = new JMenuItem(_("Add File..."));
item = new JMenuItem(tr("Add File..."));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
sketch.handleAddFile();
@ -792,16 +792,16 @@ public class Editor extends JFrame implements RunnerListener {
private JMenu buildToolsMenu() {
toolsMenu = new JMenu(_("Tools"));
toolsMenu = new JMenu(tr("Tools"));
toolsMenu.setMnemonic(KeyEvent.VK_T);
addInternalTools(toolsMenu);
JMenuItem item = newJMenuItemShift(_("Serial Monitor"), 'M');
JMenuItem item = newJMenuItemShift(tr("Serial Monitor"), 'M');
item.addActionListener(e -> handleSerial());
toolsMenu.add(item);
item = newJMenuItemShift(_("Serial Plotter"), 'L');
item = newJMenuItemShift(tr("Serial Plotter"), 'L');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handlePlotter();
@ -823,17 +823,17 @@ public class Editor extends JFrame implements RunnerListener {
base.getBoardsCustomMenus().stream().forEach(toolsMenu::add);
if (portMenu == null)
portMenu = new JMenu(_("Port"));
portMenu = new JMenu(tr("Port"));
populatePortMenu();
toolsMenu.add(portMenu);
toolsMenu.addSeparator();
base.rebuildProgrammerMenu();
programmersMenu = new JMenu(_("Programmer"));
programmersMenu = new JMenu(tr("Programmer"));
base.getProgrammerMenus().stream().forEach(programmersMenu::add);
toolsMenu.add(programmersMenu);
item = new JMenuItem(_("Burn Bootloader"));
item = new JMenuItem(tr("Burn Bootloader"));
item.addActionListener(e -> handleBurnBootloader());
toolsMenu.add(item);
@ -1116,11 +1116,11 @@ public class Editor extends JFrame implements RunnerListener {
private void selectSerialPort(String name) {
if(portMenu == null) {
System.out.println(_("serialMenu is null"));
System.out.println(tr("serialMenu is null"));
return;
}
if (name == null) {
System.out.println(_("name is null"));
System.out.println(tr("name is null"));
return;
}
JCheckBoxMenuItem selection = null;
@ -1192,7 +1192,7 @@ public class Editor extends JFrame implements RunnerListener {
} else {
lastProtocolTranslated = port.getProtocol();
}
JMenuItem lastProtocolMenuItem = new JMenuItem(_(lastProtocolTranslated));
JMenuItem lastProtocolMenuItem = new JMenuItem(tr(lastProtocolTranslated));
lastProtocolMenuItem.setEnabled(false);
portMenu.add(lastProtocolMenuItem);
}
@ -1211,7 +1211,7 @@ public class Editor extends JFrame implements RunnerListener {
private JMenu buildHelpMenu() {
// To deal with a Mac OS X 10.5 bug, add an extra space after the name
// so that the OS doesn't try to insert its slow help menu.
JMenu menu = new JMenu(_("Help"));
JMenu menu = new JMenu(tr("Help"));
menu.setMnemonic(KeyEvent.VK_H);
JMenuItem item;
@ -1251,7 +1251,7 @@ public class Editor extends JFrame implements RunnerListener {
menu.add(item);
*/
item = new JMenuItem(_("Getting Started"));
item = new JMenuItem(tr("Getting Started"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showArduinoGettingStarted();
@ -1259,7 +1259,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = new JMenuItem(_("Environment"));
item = new JMenuItem(tr("Environment"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showEnvironment();
@ -1267,7 +1267,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = new JMenuItem(_("Troubleshooting"));
item = new JMenuItem(tr("Troubleshooting"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showTroubleshooting();
@ -1275,7 +1275,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = new JMenuItem(_("Reference"));
item = new JMenuItem(tr("Reference"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showReference();
@ -1285,18 +1285,18 @@ public class Editor extends JFrame implements RunnerListener {
menu.addSeparator();
item = new JMenuItem(_("Galileo Help"));
item = new JMenuItem(tr("Galileo Help"));
item.setEnabled(false);
menu.add(item);
item = new JMenuItem(_("Getting Started"));
item = new JMenuItem(tr("Getting Started"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showReference("reference/Galileo_help_files", "ArduinoIDE_guide_galileo");
}
});
menu.add(item);
item = new JMenuItem(_("Troubleshooting"));
item = new JMenuItem(tr("Troubleshooting"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showReference("reference/Galileo_help_files", "Guide_Troubleshooting_Galileo");
@ -1306,18 +1306,18 @@ public class Editor extends JFrame implements RunnerListener {
menu.addSeparator();
item = new JMenuItem(_("Edison Help"));
item = new JMenuItem(tr("Edison Help"));
item.setEnabled(false);
menu.add(item);
item = new JMenuItem(_("Getting Started"));
item = new JMenuItem(tr("Getting Started"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showReference("reference/Edison_help_files", "ArduinoIDE_guide_edison");
}
});
menu.add(item);
item = new JMenuItem(_("Troubleshooting"));
item = new JMenuItem(tr("Troubleshooting"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showReference("reference/Edison_help_files", "Guide_Troubleshooting_Edison");
@ -1327,7 +1327,7 @@ public class Editor extends JFrame implements RunnerListener {
menu.addSeparator();
item = newJMenuItemShift(_("Find in Reference"), 'F');
item = newJMenuItemShift(tr("Find in Reference"), 'F');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// if (textarea.isSelectionActive()) {
@ -1338,7 +1338,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = new JMenuItem(_("Frequently Asked Questions"));
item = new JMenuItem(tr("Frequently Asked Questions"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showFAQ();
@ -1346,10 +1346,10 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = new JMenuItem(_("Visit Arduino.cc"));
item = new JMenuItem(tr("Visit Arduino.cc"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.openURL(_("http://www.arduino.cc/"));
Base.openURL(tr("http://www.arduino.cc/"));
}
});
menu.add(item);
@ -1357,7 +1357,7 @@ public class Editor extends JFrame implements RunnerListener {
// macosx already has its own about menu
if (!OSUtils.isMacOS()) {
menu.addSeparator();
item = new JMenuItem(_("About Arduino"));
item = new JMenuItem(tr("About Arduino"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.handleAbout();
@ -1371,19 +1371,19 @@ public class Editor extends JFrame implements RunnerListener {
private JMenu buildEditMenu() {
JMenu menu = new JMenu(_("Edit"));
JMenu menu = new JMenu(tr("Edit"));
menu.setName("menuEdit");
menu.setMnemonic(KeyEvent.VK_E);
undoItem = newJMenuItem(_("Undo"), 'Z');
undoItem = newJMenuItem(tr("Undo"), 'Z');
undoItem.setName("menuEditUndo");
undoItem.addActionListener(undoAction = new UndoAction());
menu.add(undoItem);
if (!OSUtils.isMacOS()) {
redoItem = newJMenuItem(_("Redo"), 'Y');
redoItem = newJMenuItem(tr("Redo"), 'Y');
} else {
redoItem = newJMenuItemShift(_("Redo"), 'Z');
redoItem = newJMenuItemShift(tr("Redo"), 'Z');
}
redoItem.setName("menuEditRedo");
redoItem.addActionListener(redoAction = new RedoAction());
@ -1393,7 +1393,7 @@ public class Editor extends JFrame implements RunnerListener {
// TODO "cut" and "copy" should really only be enabled
// if some text is currently selected
JMenuItem cutItem = newJMenuItem(_("Cut"), 'X');
JMenuItem cutItem = newJMenuItem(tr("Cut"), 'X');
cutItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleCut();
@ -1401,7 +1401,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(cutItem);
JMenuItem copyItem = newJMenuItem(_("Copy"), 'C');
JMenuItem copyItem = newJMenuItem(tr("Copy"), 'C');
copyItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textarea.copy();
@ -1409,7 +1409,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(copyItem);
JMenuItem copyForumItem = newJMenuItemShift(_("Copy for Forum"), 'C');
JMenuItem copyForumItem = newJMenuItemShift(tr("Copy for Forum"), 'C');
copyForumItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// SwingUtilities.invokeLater(new Runnable() {
@ -1421,7 +1421,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(copyForumItem);
JMenuItem copyHTMLItem = newJMenuItemAlt(_("Copy as HTML"), 'C');
JMenuItem copyHTMLItem = newJMenuItemAlt(tr("Copy as HTML"), 'C');
copyHTMLItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// SwingUtilities.invokeLater(new Runnable() {
@ -1433,7 +1433,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(copyHTMLItem);
JMenuItem pasteItem = newJMenuItem(_("Paste"), 'V');
JMenuItem pasteItem = newJMenuItem(tr("Paste"), 'V');
pasteItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textarea.paste();
@ -1442,7 +1442,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(pasteItem);
JMenuItem selectAllItem = newJMenuItem(_("Select All"), 'A');
JMenuItem selectAllItem = newJMenuItem(tr("Select All"), 'A');
selectAllItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textarea.selectAll();
@ -1452,7 +1452,7 @@ public class Editor extends JFrame implements RunnerListener {
menu.addSeparator();
JMenuItem commentItem = newJMenuItem(_("Comment/Uncomment"), '/');
JMenuItem commentItem = newJMenuItem(tr("Comment/Uncomment"), '/');
commentItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleCommentUncomment();
@ -1460,7 +1460,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(commentItem);
JMenuItem increaseIndentItem = new JMenuItem(_("Increase Indent"));
JMenuItem increaseIndentItem = new JMenuItem(tr("Increase Indent"));
increaseIndentItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
increaseIndentItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -1469,7 +1469,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(increaseIndentItem);
JMenuItem decreseIndentItem = new JMenuItem(_("Decrease Indent"));
JMenuItem decreseIndentItem = new JMenuItem(tr("Decrease Indent"));
decreseIndentItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
decreseIndentItem.setName("menuDecreaseIndent");
decreseIndentItem.addActionListener(new ActionListener() {
@ -1481,7 +1481,7 @@ public class Editor extends JFrame implements RunnerListener {
menu.addSeparator();
JMenuItem findItem = newJMenuItem(_("Find..."), 'F');
JMenuItem findItem = newJMenuItem(tr("Find..."), 'F');
findItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (find == null) {
@ -1496,7 +1496,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(findItem);
JMenuItem findNextItem = newJMenuItem(_("Find Next"), 'G');
JMenuItem findNextItem = newJMenuItem(tr("Find Next"), 'G');
findNextItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (find != null) {
@ -1506,7 +1506,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(findNextItem);
JMenuItem findPreviousItem = newJMenuItemShift(_("Find Previous"), 'G');
JMenuItem findPreviousItem = newJMenuItemShift(tr("Find Previous"), 'G');
findPreviousItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (find != null) {
@ -1517,7 +1517,7 @@ public class Editor extends JFrame implements RunnerListener {
menu.add(findPreviousItem);
if (OSUtils.isMacOS()) {
JMenuItem useSelectionForFindItem = newJMenuItem(_("Use Selection For Find"), 'E');
JMenuItem useSelectionForFindItem = newJMenuItem(tr("Use Selection For Find"), 'E');
useSelectionForFindItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (find == null) {
@ -1598,7 +1598,7 @@ public class Editor extends JFrame implements RunnerListener {
} else {
this.setEnabled(false);
undoItem.setEnabled(false);
undoItem.setText(_("Undo"));
undoItem.setText(tr("Undo"));
putValue(Action.NAME, "Undo");
}
}
@ -1631,7 +1631,7 @@ public class Editor extends JFrame implements RunnerListener {
} else {
this.setEnabled(false);
redoItem.setEnabled(false);
redoItem.setText(_("Redo"));
redoItem.setText(tr("Redo"));
putValue(Action.NAME, "Redo");
}
}
@ -1925,7 +1925,7 @@ public class Editor extends JFrame implements RunnerListener {
String referenceFile = base.getPdeKeywords().getReference(text);
if (referenceFile == null) {
statusNotice(I18n.format(_("No reference available for \"{0}\""), text));
statusNotice(I18n.format(tr("No reference available for \"{0}\""), text));
} else {
Base.showReference("Reference/" + referenceFile);
}
@ -1951,7 +1951,7 @@ public class Editor extends JFrame implements RunnerListener {
handleSave(true);
}
toolbar.activateRun();
status.progress(_("Compiling sketch..."));
status.progress(tr("Compiling sketch..."));
// do this to advance/clear the terminal window / dos prompt / etc
for (int i = 0; i < 10; i++) System.out.println();
@ -1990,10 +1990,10 @@ public class Editor extends JFrame implements RunnerListener {
textarea.removeAllLineHighlights();
sketch.prepare();
sketch.build(verbose, saveHex);
statusNotice(_("Done compiling."));
statusNotice(tr("Done compiling."));
} catch (PreferencesMapException e) {
statusError(I18n.format(
_("Error while compiling: missing '{0}' configuration parameter"),
tr("Error while compiling: missing '{0}' configuration parameter"),
e.getMessage()));
} catch (Exception e) {
status.unprogress();
@ -2053,11 +2053,11 @@ public class Editor extends JFrame implements RunnerListener {
toFront();
String prompt = I18n.format(_("Save changes to \"{0}\"? "), sketch.getName());
String prompt = I18n.format(tr("Save changes to \"{0}\"? "), sketch.getName());
if (!OSUtils.isMacOS()) {
int result =
JOptionPane.showConfirmDialog(this, prompt, _("Close"),
JOptionPane.showConfirmDialog(this, prompt, tr("Close"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
@ -2083,7 +2083,7 @@ public class Editor extends JFrame implements RunnerListener {
// I think it's nifty that they treat their developers like dirt.
JOptionPane pane =
new JOptionPane(_("<html> " +
new JOptionPane(tr("<html> " +
"<head> <style type=\"text/css\">"+
"b { font: 13pt \"Lucida Grande\" }"+
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px }"+
@ -2094,7 +2094,7 @@ public class Editor extends JFrame implements RunnerListener {
JOptionPane.QUESTION_MESSAGE);
String[] options = new String[] {
_("Save"), _("Cancel"), _("Don't Save")
tr("Save"), tr("Cancel"), tr("Don't Save")
};
pane.setOptions(options);
@ -2147,8 +2147,8 @@ public class Editor extends JFrame implements RunnerListener {
{
if (!fileName.endsWith(".ino") && !fileName.endsWith(".pde")) {
Base.showWarning(_("Bad file selected"),
_("Arduino can only open its own sketches\n" +
Base.showWarning(tr("Bad file selected"),
tr("Arduino can only open its own sketches\n" +
"and other files ending in .ino or .pde"), null);
return false;
@ -2156,8 +2156,8 @@ public class Editor extends JFrame implements RunnerListener {
String properParent =
fileName.substring(0, fileName.length() - 4);
Object[] options = { _("OK"), _("Cancel") };
String prompt = I18n.format(_("The file \"{0}\" needs to be inside\n" +
Object[] options = { tr("OK"), tr("Cancel") };
String prompt = I18n.format(tr("The file \"{0}\" needs to be inside\n" +
"a sketch folder named \"{1}\".\n" +
"Create this folder, move the file, and continue?"),
fileName,
@ -2165,7 +2165,7 @@ public class Editor extends JFrame implements RunnerListener {
int result = JOptionPane.showOptionDialog(this,
prompt,
_("Moving"),
tr("Moving"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
@ -2176,9 +2176,9 @@ public class Editor extends JFrame implements RunnerListener {
// create properly named folder
File properFolder = new File(sketchFile.getParent(), properParent);
if (properFolder.exists()) {
Base.showWarning(_("Error"),
Base.showWarning(tr("Error"),
I18n.format(
_("A folder named \"{0}\" already exists. " +
tr("A folder named \"{0}\" already exists. " +
"Can't open sketch."),
properParent
),
@ -2187,8 +2187,8 @@ public class Editor extends JFrame implements RunnerListener {
}
if (!properFolder.mkdirs()) {
//throw new IOException("Couldn't create sketch folder");
Base.showWarning(_("Error"),
_("Could not create the sketch folder."), null);
Base.showWarning(tr("Error"),
tr("Could not create the sketch folder."), null);
return false;
}
// copy the sketch inside
@ -2196,7 +2196,7 @@ public class Editor extends JFrame implements RunnerListener {
try {
Base.copyFile(sketchFile, properPdeFile);
} catch (IOException e) {
Base.showWarning(_("Error"), _("Could not copy to a proper location."), e);
Base.showWarning(tr("Error"), tr("Could not copy to a proper location."), e);
return false;
}
@ -2215,7 +2215,7 @@ public class Editor extends JFrame implements RunnerListener {
try {
sketch = new Sketch(this, file);
} catch (IOException e) {
Base.showWarning(_("Error"), _("Could not create the sketch."), e);
Base.showWarning(tr("Error"), tr("Could not create the sketch."), e);
return false;
}
header.rebuild();
@ -2238,9 +2238,9 @@ public class Editor extends JFrame implements RunnerListener {
return;
}
if (sketch.getName().equals(sketch.getCurrentCode().getPrettyName())) {
setTitle(I18n.format(_("{0} | Arduino {1}"), sketch.getName(), BaseNoGui.VERSION_NAME_LONG));
setTitle(I18n.format(tr("{0} | Arduino {1}"), sketch.getName(), BaseNoGui.VERSION_NAME_LONG));
} else {
setTitle(I18n.format(_("{0} - {1} | Arduino {2}"), sketch.getName(), sketch.getCurrentCode().getFileName(), BaseNoGui.VERSION_NAME_LONG));
setTitle(I18n.format(tr("{0} - {1} | Arduino {2}"), sketch.getName(), sketch.getCurrentCode().getFileName(), BaseNoGui.VERSION_NAME_LONG));
}
}
@ -2279,14 +2279,14 @@ public class Editor extends JFrame implements RunnerListener {
private boolean handleSave2() {
toolbar.activateSave();
statusNotice(_("Saving..."));
statusNotice(tr("Saving..."));
boolean saved = false;
try {
boolean wasReadOnly = sketch.isReadOnly();
String previousMainFilePath = sketch.getMainFilePath();
saved = sketch.save();
if (saved) {
statusNotice(_("Done Saving."));
statusNotice(tr("Done Saving."));
if (wasReadOnly) {
base.removeRecentSketchPath(previousMainFilePath);
}
@ -2325,18 +2325,18 @@ public class Editor extends JFrame implements RunnerListener {
//SwingUtilities.invokeLater(new Runnable() {
//public void run() {
statusNotice(_("Saving..."));
statusNotice(tr("Saving..."));
try {
if (sketch.saveAs()) {
base.storeRecentSketches(sketch);
base.rebuildRecentSketchesMenuItems();
statusNotice(_("Done Saving."));
statusNotice(tr("Done Saving."));
// Disabling this for 0125, instead rebuild the menu inside
// the Save As method of the Sketch object, since that's the
// only one who knows whether something was renamed.
//sketchbook.rebuildMenusAsync();
} else {
statusNotice(_("Save Canceled."));
statusNotice(tr("Save Canceled."));
return false;
}
} catch (Exception e) {
@ -2362,7 +2362,7 @@ public class Editor extends JFrame implements RunnerListener {
String result = (String)
JOptionPane.showInputDialog(this,
I18n.format(
_("Serial port {0} not found.\n" +
tr("Serial port {0} not found.\n" +
"Retry the upload with another serial port?"),
PreferencesData.get("serial.port")
),
@ -2401,7 +2401,7 @@ public class Editor extends JFrame implements RunnerListener {
}
toolbar.activateExport();
console.clear();
status.progress(_("Uploading to I/O Board..."));
status.progress(tr("Uploading to I/O Board..."));
new Thread(usingProgrammer ? exportAppHandler : exportHandler).start();
}
@ -2423,15 +2423,15 @@ public class Editor extends JFrame implements RunnerListener {
boolean success = sketch.exportApplet(false);
if (success) {
statusNotice(_("Done uploading."));
statusNotice(tr("Done uploading."));
}
} catch (SerialNotFoundException e) {
if (portMenu.getItemCount() == 0) statusError(e);
else if (serialPrompt()) run();
else statusNotice(_("Upload canceled."));
else statusNotice(tr("Upload canceled."));
} catch (PreferencesMapException e) {
statusError(I18n.format(
_("Error while uploading: missing '{0}' configuration parameter"),
tr("Error while uploading: missing '{0}' configuration parameter"),
e.getMessage()));
} catch (RunnerException e) {
//statusError("Error during upload.");
@ -2518,15 +2518,15 @@ public class Editor extends JFrame implements RunnerListener {
boolean success = sketch.exportApplet(true);
if (success) {
statusNotice(_("Done uploading."));
statusNotice(tr("Done uploading."));
}
} catch (SerialNotFoundException e) {
if (portMenu.getItemCount() == 0) statusError(e);
else if (serialPrompt()) run();
else statusNotice(_("Upload canceled."));
else statusNotice(tr("Upload canceled."));
} catch (PreferencesMapException e) {
statusError(I18n.format(
_("Error while uploading: missing '{0}' configuration parameter"),
tr("Error while uploading: missing '{0}' configuration parameter"),
e.getMessage()));
} catch (RunnerException e) {
//statusError("Error during upload.");
@ -2605,12 +2605,12 @@ public class Editor extends JFrame implements RunnerListener {
boolean success = false;
do {
if (serialMonitor.requiresAuthorization() && !PreferencesData.has(serialMonitor.getAuthorizationKey())) {
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(this, _("Type board password to access its console"));
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(this, tr("Type board password to access its console"));
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);
if (dialog.isCancelled()) {
statusNotice(_("Unable to open serial monitor"));
statusNotice(tr("Unable to open serial monitor"));
return;
}
@ -2622,9 +2622,9 @@ public class Editor extends JFrame implements RunnerListener {
serialMonitor.setVisible(true);
success = true;
} catch (ConnectException e) {
statusError(_("Unable to connect: is the sketch using the bridge?"));
statusError(tr("Unable to connect: is the sketch using the bridge?"));
} catch (JSchException e) {
statusError(_("Unable to connect: wrong password?"));
statusError(tr("Unable to connect: wrong password?"));
} catch (SerialException e) {
String errorMessage = e.getMessage();
if (e.getCause() != null && e.getCause() instanceof SerialPortException) {
@ -2701,12 +2701,12 @@ public class Editor extends JFrame implements RunnerListener {
boolean success = false;
do {
if (serialPlotter.requiresAuthorization() && !PreferencesData.has(serialPlotter.getAuthorizationKey())) {
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(this, _("Type board password to access its console"));
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(this, tr("Type board password to access its console"));
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);
if (dialog.isCancelled()) {
statusNotice(_("Unable to open serial plotter"));
statusNotice(tr("Unable to open serial plotter"));
return;
}
@ -2718,9 +2718,9 @@ public class Editor extends JFrame implements RunnerListener {
serialPlotter.setVisible(true);
success = true;
} catch (ConnectException e) {
statusError(_("Unable to connect: is the sketch using the bridge?"));
statusError(tr("Unable to connect: is the sketch using the bridge?"));
} catch (JSchException e) {
statusError(_("Unable to connect: wrong password?"));
statusError(tr("Unable to connect: wrong password?"));
} catch (SerialException e) {
String errorMessage = e.getMessage();
if (e.getCause() != null && e.getCause() instanceof SerialPortException) {
@ -2741,25 +2741,25 @@ public class Editor extends JFrame implements RunnerListener {
private void handleBurnBootloader() {
console.clear();
statusNotice(_("Burning bootloader to I/O Board (this may take a minute)..."));
statusNotice(tr("Burning bootloader to I/O Board (this may take a minute)..."));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
Uploader uploader = new SerialUploader();
if (uploader.burnBootloader()) {
statusNotice(_("Done burning bootloader."));
statusNotice(tr("Done burning bootloader."));
} else {
statusError(_("Error while burning bootloader."));
statusError(tr("Error while burning bootloader."));
// error message will already be visible
}
} catch (PreferencesMapException e) {
statusError(I18n.format(
_("Error while burning bootloader: missing '{0}' configuration parameter"),
tr("Error while burning bootloader: missing '{0}' configuration parameter"),
e.getMessage()));
} catch (RunnerException e) {
statusError(e.getMessage());
} catch (Exception e) {
statusError(_("Error while burning bootloader."));
statusError(tr("Error while burning bootloader."));
e.printStackTrace();
}
}
@ -2783,7 +2783,7 @@ public class Editor extends JFrame implements RunnerListener {
* Handler for File &rarr; Print.
*/
private void handlePrint() {
statusNotice(_("Printing..."));
statusNotice(tr("Printing..."));
//printerJob = null;
PrinterJob printerJob = PrinterJob.getPrinterJob();
if (pageFormat != null) {
@ -2798,14 +2798,14 @@ public class Editor extends JFrame implements RunnerListener {
if (printerJob.printDialog()) {
try {
printerJob.print();
statusNotice(_("Done printing."));
statusNotice(tr("Done printing."));
} catch (PrinterException pe) {
statusError(_("Error while printing."));
statusError(tr("Error while printing."));
pe.printStackTrace();
}
} else {
statusNotice(_("Printing canceled."));
statusNotice(tr("Printing canceled."));
}
//printerJob = null; // clear this out?
}
@ -2854,7 +2854,7 @@ public class Editor extends JFrame implements RunnerListener {
}
}
if (line < 0 || line >= textarea.getLineCount()) {
System.err.println(I18n.format(_("Bad error line: {0}"), line));
System.err.println(I18n.format(tr("Bad error line: {0}"), line));
} else {
try {
textarea.addLineHighlight(line, new Color(1, 0, 0, 0.2f));
@ -2927,7 +2927,7 @@ public class Editor extends JFrame implements RunnerListener {
menu.add(item);
item = newJMenuItem(_("Comment/Uncomment"), '/');
item = newJMenuItem(tr("Comment/Uncomment"), '/');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleCommentUncomment();
@ -2935,7 +2935,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = newJMenuItem(_("Increase Indent"), ']');
item = newJMenuItem(tr("Increase Indent"), ']');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleIndentOutdent(true);
@ -2943,7 +2943,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = newJMenuItem(_("Decrease Indent"), '[');
item = newJMenuItem(tr("Decrease Indent"), '[');
item.setName("menuDecreaseIndent");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -2952,7 +2952,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = new JMenuItem(_("Copy for Forum"));
item = new JMenuItem(tr("Copy for Forum"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleDiscourseCopy();
@ -2960,7 +2960,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
item = new JMenuItem(_("Copy as HTML"));
item = new JMenuItem(tr("Copy as HTML"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleHTMLCopy();
@ -2968,7 +2968,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
final JMenuItem referenceItem = new JMenuItem(_("Find in Reference"));
final JMenuItem referenceItem = new JMenuItem(tr("Find in Reference"));
referenceItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleFindReference();
@ -2976,7 +2976,7 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(referenceItem);
final JMenuItem openURLItem = new JMenuItem(_("Open URL"));
final JMenuItem openURLItem = new JMenuItem(tr("Open URL"));
openURLItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.openURL(e.getActionCommand());

View File

@ -24,7 +24,7 @@
package processing.app;
import processing.app.helpers.OSUtils;
import processing.app.tools.MenuScroller;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import java.awt.*;
import java.awt.event.*;
@ -293,7 +293,7 @@ public class EditorHeader extends JComponent {
*/
//item = new JMenuItem("New Tab");
item = Editor.newJMenuItemShift(_("New Tab"), 'N');
item = Editor.newJMenuItemShift(tr("New Tab"), 'N');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editor.getSketch().handleNewCode();
@ -301,7 +301,7 @@ public class EditorHeader extends JComponent {
});
menu.add(item);
item = new JMenuItem(_("Rename"));
item = new JMenuItem(tr("Rename"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editor.getSketch().handleRenameCode();
@ -315,7 +315,7 @@ public class EditorHeader extends JComponent {
});
menu.add(item);
item = new JMenuItem(_("Delete"));
item = new JMenuItem(tr("Delete"));
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editor.getSketch().handleDeleteCode();
@ -327,7 +327,7 @@ public class EditorHeader extends JComponent {
// KeyEvent.VK_LEFT and VK_RIGHT will make Windows beep
item = new JMenuItem(_("Previous Tab"));
item = new JMenuItem(tr("Previous Tab"));
KeyStroke ctrlAltLeft = KeyStroke
.getKeyStroke(KeyEvent.VK_LEFT, Editor.SHORTCUT_ALT_KEY_MASK);
item.setAccelerator(ctrlAltLeft);
@ -339,7 +339,7 @@ public class EditorHeader extends JComponent {
});
menu.add(item);
item = new JMenuItem(_("Next Tab"));
item = new JMenuItem(tr("Next Tab"));
KeyStroke ctrlAltRight = KeyStroke
.getKeyStroke(KeyEvent.VK_RIGHT, Editor.SHORTCUT_ALT_KEY_MASK);
item.setAccelerator(ctrlAltRight);

View File

@ -32,7 +32,7 @@ import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
@ -335,19 +335,19 @@ public class EditorStatus extends JPanel {
add(progressBar);
progressBar.setVisible(false);
copyErrorButton = new JButton(_("Copy error messages"));
copyErrorButton = new JButton(tr("Copy error messages"));
add(copyErrorButton);
copyErrorButton.setVisible(false);
copyErrorButton.addActionListener(e -> {
String message1 = "";
message1 += _("Arduino: ") + BaseNoGui.VERSION_NAME_LONG + " (" + System.getProperty("os.name") + "), ";
message1 += _("Board: ") + "\"" + BaseNoGui.getBoardPreferences().get("name") + "\"\n\n";
message1 += tr("Arduino: ") + BaseNoGui.VERSION_NAME_LONG + " (" + System.getProperty("os.name") + "), ";
message1 += tr("Board: ") + "\"" + BaseNoGui.getBoardPreferences().get("name") + "\"\n\n";
message1 += editor.console.getText();
if (!(PreferencesData.getBoolean("build.verbose"))) {
message1 += "\n\n";
message1 += " " + _("This report would have more information with") + "\n";
message1 += " \"" + _("Show verbose output during compilation") + "\"\n";
message1 += " " + _("enabled in File > Preferences.") + "\n";
message1 += " " + tr("This report would have more information with") + "\n";
message1 += " \"" + tr("Show verbose output during compilation") + "\"\n";
message1 += " " + tr("enabled in File > Preferences.") + "\n";
}
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection data = new StringSelection(message1);

View File

@ -30,7 +30,7 @@ import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
@ -42,14 +42,14 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
* Rollover titles for each button.
*/
private static final String[] title = {
_("Verify"), _("Upload"), _("New"), _("Open"), _("Save"), _("Serial Monitor")
tr("Verify"), tr("Upload"), tr("New"), tr("Open"), tr("Save"), tr("Serial Monitor")
};
/**
* Titles for each button when the shift key is pressed.
*/
private static final String[] titleShift = {
_("Verify"), _("Upload Using Programmer"), _("New"), _("Open"), _("Save As..."), _("Serial Monitor")
tr("Verify"), tr("Upload Using Programmer"), tr("New"), tr("Open"), tr("Save As..."), tr("Serial Monitor")
};
private static final int BUTTON_COUNT = title.length;

View File

@ -19,7 +19,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
@SuppressWarnings("serial")
public class NetworkMonitor extends AbstractTextMonitor implements MessageConsumer {
@ -110,7 +110,7 @@ public class NetworkMonitor extends AbstractTextMonitor implements MessageConsum
// ignore
}
if (channel.isConnected()) {
NetworkMonitor.this.message(_("connected!") + '\n');
NetworkMonitor.this.message(tr("connected!") + '\n');
}
}
@ -129,7 +129,7 @@ public class NetworkMonitor extends AbstractTextMonitor implements MessageConsum
}
}
if (connectionAttempts < MAX_CONNECTION_ATTEMPTS) {
s = "\n" + _("Unable to connect: retrying") + " (" + connectionAttempts + ")... ";
s = "\n" + tr("Unable to connect: retrying") + " (" + connectionAttempts + ")... ";
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -144,7 +144,7 @@ public class NetworkMonitor extends AbstractTextMonitor implements MessageConsum
}
});
} else {
s = "\n" + _("Unable to connect: is the sketch using the bridge?");
s = "\n" + tr("Unable to connect: is the sketch using the bridge?");
}
}
super.message(s);

View File

@ -25,7 +25,7 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
@SuppressWarnings("serial")
public class SerialMonitor extends AbstractTextMonitor {
@ -37,7 +37,7 @@ public class SerialMonitor extends AbstractTextMonitor {
super(port);
serialRate = PreferencesData.getInteger("serial.debug_rate");
serialRates.setSelectedItem(serialRate + " " + _("baud"));
serialRates.setSelectedItem(serialRate + " " + tr("baud"));
onSerialRateChange(new ActionListener() {
public void actionPerformed(ActionEvent event) {
String wholeString = (String) serialRates.getSelectedItem();

View File

@ -21,17 +21,14 @@ package processing.app;
import cc.arduino.packages.BoardPort;
import processing.app.legacy.PApplet;
import processing.app.debug.MessageConsumer;
import processing.app.helpers.*;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.text.*;
public class SerialPlotter extends AbstractMonitor {
private StringBuffer messageBuffer;
@ -126,7 +123,7 @@ public class SerialPlotter extends AbstractMonitor {
super(port);
serialRate = PreferencesData.getInteger("serial.debug_rate");
serialRates.setSelectedItem(serialRate + " " + _("baud"));
serialRates.setSelectedItem(serialRate + " " + tr("baud"));
onSerialRateChange(new ActionListener() {
public void actionPerformed(ActionEvent event) {
String wholeString = (String) serialRates.getSelectedItem();
@ -166,7 +163,7 @@ public class SerialPlotter extends AbstractMonitor {
serialRates = new JComboBox();
for (int i = 0; i < serialRateStrings.length; i++)
serialRates.addItem(serialRateStrings[i] + " " + _("baud"));
serialRates.addItem(serialRateStrings[i] + " " + tr("baud"));
serialRates.setMaximumSize(serialRates.getMinimumSize());

View File

@ -40,7 +40,7 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
@ -135,15 +135,15 @@ public class Sketch {
// if read-only, give an error
if (isReadOnly()) {
// if the files are read-only, need to first do a "save as".
Base.showMessage(_("Sketch is Read-Only"),
_("Some files are marked \"read-only\", so you'll\n" +
Base.showMessage(tr("Sketch is Read-Only"),
tr("Some files are marked \"read-only\", so you'll\n" +
"need to re-save the sketch in another location,\n" +
"and try again."));
return;
}
renamingCode = false;
editor.status.edit(_("Name for new file:"), "");
editor.status.edit(tr("Name for new file:"), "");
}
@ -155,8 +155,8 @@ public class Sketch {
ensureExistence();
if (currentIndex == 0 && editor.untitled) {
Base.showMessage(_("Sketch is Untitled"),
_("How about saving the sketch first \n" +
Base.showMessage(tr("Sketch is Untitled"),
tr("How about saving the sketch first \n" +
"before trying to rename it?"));
return;
}
@ -164,8 +164,8 @@ public class Sketch {
// if read-only, give an error
if (isReadOnly()) {
// if the files are read-only, need to first do a "save as".
Base.showMessage(_("Sketch is Read-Only"),
_("Some files are marked \"read-only\", so you'll\n" +
Base.showMessage(tr("Sketch is Read-Only"),
tr("Some files are marked \"read-only\", so you'll\n" +
"need to re-save the sketch in another location,\n" +
"and try again."));
return;
@ -216,16 +216,16 @@ public class Sketch {
int dot = newName.indexOf('.');
if (dot == 0) {
Base.showWarning(_("Problem with rename"),
_("The name cannot start with a period."), null);
Base.showWarning(tr("Problem with rename"),
tr("The name cannot start with a period."), null);
return;
}
String newExtension = newName.substring(dot+1).toLowerCase();
if (!validExtension(newExtension)) {
Base.showWarning(_("Problem with rename"),
Base.showWarning(tr("Problem with rename"),
I18n.format(
_("\".{0}\" is not a valid extension."), newExtension
tr("\".{0}\" is not a valid extension."), newExtension
), null);
return;
}
@ -234,8 +234,8 @@ public class Sketch {
if (!isDefaultExtension(newExtension)) {
if (renamingCode) { // If creating a new tab, don't show this error
if (current.getCode() == data.getCode(0)) { // If this is the main tab, disallow
Base.showWarning(_("Problem with rename"),
_("The main file can't use an extension.\n" +
Base.showWarning(tr("Problem with rename"),
tr("The main file can't use an extension.\n" +
"(It may be time for your to graduate to a\n" +
"\"real\" programming environment)"), null);
return;
@ -257,9 +257,9 @@ public class Sketch {
// might cause problems: http://dev.processing.org/bugs/show_bug.cgi?id=543
for (SketchCode c : data.getCodes()) {
if (newName.equalsIgnoreCase(c.getFileName()) && OSUtils.isWindows()) {
Base.showMessage(_("Nope"),
Base.showMessage(tr("Nope"),
I18n.format(
_("A file named \"{0}\" already exists in \"{1}\""),
tr("A file named \"{0}\" already exists in \"{1}\""),
c.getFileName(),
data.getFolder().getAbsolutePath()
));
@ -271,8 +271,8 @@ public class Sketch {
// because the sketch is concatenated into a file with that name as part
// of the build process.
if (newName.equals(getName() + ".cpp")) {
Base.showMessage(_("Nope"),
_("You can't have a .cpp file with the same name as the sketch."));
Base.showMessage(tr("Nope"),
tr("You can't have a .cpp file with the same name as the sketch."));
return;
}
@ -280,8 +280,8 @@ public class Sketch {
for (SketchCode code : data.getCodes()) {
if (sanitaryName.equalsIgnoreCase(code.getPrettyName()) &&
code.isExtension("cpp")) {
Base.showMessage(_("Nope"),
I18n.format(_("You can't rename the sketch to \"{0}\"\n"
Base.showMessage(tr("Nope"),
I18n.format(tr("You can't rename the sketch to \"{0}\"\n"
+ "because the sketch already has a .cpp file with that name."),
sanitaryName));
return;
@ -314,9 +314,9 @@ public class Sketch {
String folderName = newName.substring(0, newName.indexOf('.'));
File newFolder = new File(data.getFolder().getParentFile(), folderName);
if (newFolder.exists()) {
Base.showWarning(_("Cannot Rename"),
Base.showWarning(tr("Cannot Rename"),
I18n.format(
_("Sorry, a sketch (or folder) named " +
tr("Sorry, a sketch (or folder) named " +
"\"{0}\" already exists."),
newName
), null);
@ -334,15 +334,15 @@ public class Sketch {
// save this new SketchCode
current.getCode().save();
} catch (Exception e) {
Base.showWarning(_("Error"), _("Could not rename the sketch. (0)"), e);
Base.showWarning(tr("Error"), tr("Could not rename the sketch. (0)"), e);
return;
}
}
if (!current.getCode().renameTo(newFile)) {
Base.showWarning(_("Error"),
Base.showWarning(tr("Error"),
I18n.format(
_("Could not rename \"{0}\" to \"{1}\""),
tr("Could not rename \"{0}\" to \"{1}\""),
current.getCode().getFileName(),
newFile.getName()
), null);
@ -355,14 +355,14 @@ public class Sketch {
code.save();
}
} catch (Exception e) {
Base.showWarning(_("Error"), _("Could not rename the sketch. (1)"), e);
Base.showWarning(tr("Error"), tr("Could not rename the sketch. (1)"), e);
return;
}
// now rename the sketch folder and re-open
boolean success = data.getFolder().renameTo(newFolder);
if (!success) {
Base.showWarning(_("Error"), _("Could not rename the sketch. (2)"), null);
Base.showWarning(tr("Error"), tr("Could not rename the sketch. (2)"), null);
return;
}
// if successful, set base properties for the sketch
@ -384,9 +384,9 @@ public class Sketch {
} else { // else if something besides code[0]
if (!current.getCode().renameTo(newFile)) {
Base.showWarning(_("Error"),
Base.showWarning(tr("Error"),
I18n.format(
_("Could not rename \"{0}\" to \"{1}\""),
tr("Could not rename \"{0}\" to \"{1}\""),
current.getCode().getFileName(),
newFile.getName()
), null);
@ -398,10 +398,10 @@ public class Sketch {
try {
if (!newFile.createNewFile()) {
// Already checking for IOException, so make our own.
throw new IOException(_("createNewFile() returned false"));
throw new IOException(tr("createNewFile() returned false"));
}
} catch (IOException e) {
Base.showWarning(_("Error"),
Base.showWarning(tr("Error"),
I18n.format(
"Could not create the file \"{0}\" in \"{1}\"",
newFile,
@ -434,21 +434,21 @@ public class Sketch {
// if read-only, give an error
if (isReadOnly()) {
// if the files are read-only, need to first do a "save as".
Base.showMessage(_("Sketch is Read-Only"),
_("Some files are marked \"read-only\", so you'll\n" +
Base.showMessage(tr("Sketch is Read-Only"),
tr("Some files are marked \"read-only\", so you'll\n" +
"need to re-save the sketch in another location,\n" +
"and try again."));
return;
}
// confirm deletion with user, yes/no
Object[] options = { _("OK"), _("Cancel") };
Object[] options = { tr("OK"), tr("Cancel") };
String prompt = (currentIndex == 0) ?
_("Are you sure you want to delete this sketch?") :
I18n.format(_("Are you sure you want to delete \"{0}\"?"), current.getCode().getFileNameWithExtensionIfNotIno());
tr("Are you sure you want to delete this sketch?") :
I18n.format(tr("Are you sure you want to delete \"{0}\"?"), current.getCode().getFileNameWithExtensionIfNotIno());
int result = JOptionPane.showOptionDialog(editor,
prompt,
_("Delete"),
tr("Delete"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
@ -473,8 +473,8 @@ public class Sketch {
} else {
// delete the file
if (!current.getCode().deleteFile(tempBuildFolder)) {
Base.showMessage(_("Couldn't do it"),
I18n.format(_("Could not delete \"{0}\"."), current.getCode().getFileName()));
Base.showMessage(tr("Couldn't do it"),
I18n.format(tr("Could not delete \"{0}\"."), current.getCode().getFileName()));
return;
}
@ -560,8 +560,8 @@ public class Sketch {
if (isReadOnly()) {
// if the files are read-only, need to first do a "save as".
Base.showMessage(_("Sketch is read-only"),
_("Some files are marked \"read-only\", so you'll\n" +
Base.showMessage(tr("Sketch is read-only"),
tr("Some files are marked \"read-only\", so you'll\n" +
"need to re-save this sketch to another location."));
// if the user cancels, give up on the save()
if (!saveAs()) return false;
@ -575,16 +575,16 @@ public class Sketch {
if (pdeFiles != null && pdeFiles.length > 0) {
if (PreferencesData.get("editor.update_extension") == null) {
Object[] options = { _("OK"), _("Cancel") };
Object[] options = { tr("OK"), tr("Cancel") };
int result = JOptionPane.showOptionDialog(editor,
_("In Arduino 1.0, the default file extension has changed\n" +
tr("In Arduino 1.0, the default file extension has changed\n" +
"from .pde to .ino. New sketches (including those created\n" +
"by \"Save-As\") will use the new extension. The extension\n" +
"of existing sketches will be updated on save, but you can\n" +
"disable this in the Preferences dialog.\n" +
"\n" +
"Save sketch and update its extension?"),
_(".pde -> .ino"),
tr(".pde -> .ino"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
@ -636,7 +636,7 @@ public class Sketch {
*/
protected boolean saveAs() throws IOException {
// get new name for folder
FileDialog fd = new FileDialog(editor, _("Save sketch folder as..."), FileDialog.SAVE);
FileDialog fd = new FileDialog(editor, tr("Save sketch folder as..."), FileDialog.SAVE);
if (isReadOnly() || isUntitled()) {
// default to the sketchbook folder
fd.setDirectory(BaseNoGui.getSketchbookFolder().getAbsolutePath());
@ -664,9 +664,9 @@ public class Sketch {
// resaved (with the same name) to another location/folder.
for (SketchCode code : data.getCodes()) {
if (newName.equalsIgnoreCase(code.getPrettyName()) && code.isExtension("cpp")) {
Base.showMessage(_("Nope"),
Base.showMessage(tr("Nope"),
I18n.format(
_("You can't save the sketch as \"{0}\"\n" +
tr("You can't save the sketch as \"{0}\"\n" +
"because the sketch already has a .cpp file with that name."),
newName
));
@ -687,8 +687,8 @@ public class Sketch {
String oldPath = data.getFolder().getCanonicalPath() + File.separator;
if (newPath.indexOf(oldPath) == 0) {
Base.showWarning(_("How very Borges of you"),
_("You cannot save the sketch into a folder\n" +
Base.showWarning(tr("How very Borges of you"),
tr("You cannot save the sketch into a folder\n" +
"inside itself. This would go on forever."), null);
return false;
}
@ -774,15 +774,15 @@ public class Sketch {
// if read-only, give an error
if (isReadOnly()) {
// if the files are read-only, need to first do a "save as".
Base.showMessage(_("Sketch is Read-Only"),
_("Some files are marked \"read-only\", so you'll\n" +
Base.showMessage(tr("Sketch is Read-Only"),
tr("Some files are marked \"read-only\", so you'll\n" +
"need to re-save the sketch in another location,\n" +
"and try again."));
return;
}
// get a dialog, select a file to add to the sketch
FileDialog fd = new FileDialog(editor, _("Select an image or other data file to copy to your sketch"), FileDialog.LOAD);
FileDialog fd = new FileDialog(editor, tr("Select an image or other data file to copy to your sketch"), FileDialog.LOAD);
fd.setVisible(true);
String directory = fd.getDirectory();
@ -797,7 +797,7 @@ public class Sketch {
boolean result = addFile(sourceFile);
if (result) {
editor.statusNotice(_("One file added to the sketch."));
editor.statusNotice(tr("One file added to the sketch."));
PreferencesData.set("last.folder", sourceFile.getAbsolutePath());
}
}
@ -848,11 +848,11 @@ public class Sketch {
// check whether this file already exists
if (destFile.exists()) {
Object[] options = { _("OK"), _("Cancel") };
String prompt = I18n.format(_("Replace the existing version of {0}?"), filename);
Object[] options = { tr("OK"), tr("Cancel") };
String prompt = I18n.format(tr("Replace the existing version of {0}?"), filename);
int result = JOptionPane.showOptionDialog(editor,
prompt,
_("Replace"),
tr("Replace"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
@ -871,8 +871,8 @@ public class Sketch {
if (replacement) {
boolean muchSuccess = destFile.delete();
if (!muchSuccess) {
Base.showWarning(_("Error adding file"),
I18n.format(_("Could not delete the existing ''{0}'' file."), filename),
Base.showWarning(tr("Error adding file"),
I18n.format(tr("Could not delete the existing ''{0}'' file."), filename),
null);
return false;
}
@ -880,8 +880,8 @@ public class Sketch {
// make sure they aren't the same file
if ((codeExtension == null) && sourceFile.equals(destFile)) {
Base.showWarning(_("You can't fool me"),
_("This file has already been copied to the\n" +
Base.showWarning(tr("You can't fool me"),
tr("This file has already been copied to the\n" +
"location from which where you're trying to add it.\n" +
"I ain't not doin nuthin'."), null);
return false;
@ -894,8 +894,8 @@ public class Sketch {
Base.copyFile(sourceFile, destFile);
} catch (IOException e) {
Base.showWarning(_("Error adding file"),
I18n.format(_("Could not add ''{0}'' to the sketch."), filename),
Base.showWarning(tr("Error adding file"),
I18n.format(tr("Could not add ''{0}'' to the sketch."), filename),
e);
return false;
}
@ -1128,7 +1128,7 @@ public class Sketch {
prepare();
// build the sketch
editor.status.progressNotice(_("Compiling sketch..."));
editor.status.progressNotice(tr("Compiling sketch..."));
String foundName = build(appletPath, false, false);
// (already reported) error during export, exit this function
if (foundName == null) return false;
@ -1142,7 +1142,7 @@ public class Sketch {
// return false;
// }
editor.status.progressNotice(_("Uploading..."));
editor.status.progressNotice(tr("Uploading..."));
boolean success = upload(appletPath, foundName, usingProgrammer);
editor.status.progressUpdate(100);
return success;
@ -1155,12 +1155,12 @@ public class Sketch {
boolean success = false;
do {
if (uploader.requiresAuthorization() && !PreferencesData.has(uploader.getAuthorizationKey())) {
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(editor, _("Type board password to upload a new sketch"));
PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(editor, tr("Type board password to upload a new sketch"));
dialog.setLocationRelativeTo(editor);
dialog.setVisible(true);
if (dialog.isCancelled()) {
editor.statusNotice(_("Upload cancelled"));
editor.statusNotice(tr("Upload cancelled"));
return false;
}
@ -1177,7 +1177,7 @@ public class Sketch {
}
for (String warning : warningsAccumulator) {
System.out.print(_("Warning"));
System.out.print(tr("Warning"));
System.out.print(": ");
System.out.println(warning);
}
@ -1196,8 +1196,8 @@ public class Sketch {
private void ensureExistence() {
if (data.getFolder().exists()) return;
Base.showWarning(_("Sketch Disappeared"),
_("The sketch folder has disappeared.\n " +
Base.showWarning(tr("Sketch Disappeared"),
tr("The sketch folder has disappeared.\n " +
"Will attempt to re-save in the same location,\n" +
"but anything besides the code will be lost."), null);
try {
@ -1210,8 +1210,8 @@ public class Sketch {
calcModified();
} catch (Exception e) {
Base.showWarning(_("Could not re-save sketch"),
_("Could not properly re-save the sketch. " +
Base.showWarning(tr("Could not re-save sketch"),
tr("Could not properly re-save the sketch. " +
"You may be in trouble at this point,\n" +
"and it might be time to copy and paste " +
"your code to another text editor."), e);
@ -1393,7 +1393,7 @@ public class Sketch {
if (!newName.equals(origName)) {
String msg =
_("The sketch name had to be modified. Sketch names can only consist\n" +
tr("The sketch name had to be modified. Sketch names can only consist\n" +
"of ASCII characters and numbers (but cannot start with a number).\n" +
"They should also be less than 64 characters long.");
System.out.println(msg);

View File

@ -33,7 +33,7 @@ import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
* Storage class for theme settings. This was separated from the Preferences
@ -55,7 +55,7 @@ public class Theme {
try {
table.load(new File(BaseNoGui.getContentFile("lib"), "theme/theme.txt"));
} catch (Exception te) {
Base.showError(null, _("Could not read color theme settings.\n" +
Base.showError(null, tr("Could not read color theme settings.\n" +
"You'll need to reinstall Arduino."), te);
}

View File

@ -33,7 +33,7 @@ import java.net.URL;
import java.net.URLEncoder;
import java.util.Random;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
@ -51,7 +51,7 @@ import static processing.app.I18n._;
*/
public class UpdateCheck implements Runnable {
Base base;
String downloadURL = _("http://www.arduino.cc/latest.txt");
String downloadURL = tr("http://www.arduino.cc/latest.txt");
static final long ONE_DAY = 24 * 60 * 60 * 1000;
@ -101,22 +101,22 @@ public class UpdateCheck implements Runnable {
PreferencesData.set("update.last", String.valueOf(now));
String prompt =
_("A new version of Arduino is available,\n" +
tr("A new version of Arduino is available,\n" +
"would you like to visit the Arduino download page?");
if (base.activeEditor != null) {
if (latest > BaseNoGui.REVISION) {
Object[] options = { _("Yes"), _("No") };
Object[] options = { tr("Yes"), tr("No") };
int result = JOptionPane.showOptionDialog(base.activeEditor,
prompt,
_("Update"),
tr("Update"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
if (result == JOptionPane.YES_OPTION) {
Base.openURL(_("http://www.arduino.cc/en/Main/Software"));
Base.openURL(tr("http://www.arduino.cc/en/Main/Software"));
}
}
}

View File

@ -8,7 +8,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import java.io.File;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class PasswordAuthorizationDialog extends JDialog {
@ -36,15 +36,15 @@ public class PasswordAuthorizationDialog extends JDialog {
icon.setIcon(new ImageIcon(new File(Base.getContentFile("lib"), "theme/lock.png").getAbsolutePath()));
passwordLabel.setText(_("Password:"));
passwordLabel.setText(tr("Password:"));
passwordField.setText("");
passwordField.addActionListener(PasswordAuthorizationDialog.this::uploadButtonPressed);
uploadButton.setText(_("Upload"));
uploadButton.setText(tr("Upload"));
uploadButton.addActionListener(PasswordAuthorizationDialog.this::uploadButtonPressed);
cancelButton.setText(_("Cancel"));
cancelButton.setText(tr("Cancel"));
cancelButton.addActionListener(PasswordAuthorizationDialog.this::cancelButtonPressed);
Base.registerWindowCloseKeys(getRootPane(), this::cancelButtonPressed);

View File

@ -2,9 +2,7 @@ package processing.app.helpers;
import processing.app.Base;
import static processing.app.I18n._;
import java.awt.Frame;
import static processing.app.I18n.tr;
import javax.swing.JOptionPane;
@ -22,7 +20,7 @@ public class GUIUserNotifier extends UserNotifier {
* for errors that allow P5 to continue running.
*/
public void showError(String title, String message, Throwable e, int exit_code) {
if (title == null) title = _("Error");
if (title == null) title = tr("Error");
JOptionPane.showMessageDialog(base.getActiveEditor(), message, title,
JOptionPane.ERROR_MESSAGE);
@ -36,7 +34,7 @@ public class GUIUserNotifier extends UserNotifier {
* much of a bummer, but something to notify the user about.
*/
public void showMessage(String title, String message) {
if (title == null) title = _("Message");
if (title == null) title = tr("Message");
JOptionPane.showMessageDialog(base.getActiveEditor(), message, title,
JOptionPane.INFORMATION_MESSAGE);
@ -46,7 +44,7 @@ public class GUIUserNotifier extends UserNotifier {
* Non-fatal error message with optional stack trace side dish.
*/
public void showWarning(String title, String message, Exception e) {
if (title == null) title = _("Warning");
if (title == null) title = tr("Warning");
JOptionPane.showMessageDialog(base.getActiveEditor(), message, title,
JOptionPane.WARNING_MESSAGE);

View File

@ -38,7 +38,7 @@ import java.util.Date;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class Archiver implements Tool {
@ -53,7 +53,7 @@ public class Archiver implements Tool {
public String getMenuTitle() {
return _("Archive Sketch");
return tr("Archive Sketch");
}
@ -79,8 +79,8 @@ public class Archiver implements Tool {
e.printStackTrace();
}
if (!success) {
Base.showWarning(_("Couldn't archive sketch"),
_("Archiving the sketch has been canceled because\nthe sketch couldn't save properly."), null);
Base.showWarning(tr("Couldn't archive sketch"),
tr("Archiving the sketch has been canceled because\nthe sketch couldn't save properly."), null);
return;
}
@ -113,7 +113,7 @@ public class Archiver implements Tool {
} while (newbie.exists());
// open up a prompt for where to save this fella
FileDialog fd = new FileDialog(editor, _("Archive sketch as:"), FileDialog.SAVE);
FileDialog fd = new FileDialog(editor, tr("Archive sketch as:"), FileDialog.SAVE);
fd.setDirectory(parent.getAbsolutePath());
fd.setFile(newbie.getName());
fd.setVisible(true);
@ -142,7 +142,7 @@ public class Archiver implements Tool {
IOUtils.closeQuietly(zos);
}
} else {
editor.statusNotice(_("Archive sketch canceled."));
editor.statusNotice(tr("Archive sketch canceled."));
}
}

View File

@ -31,7 +31,7 @@ import javax.swing.JOptionPane;
import org.apache.commons.compress.utils.IOUtils;
import processing.app.*;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class FixEncoding implements Tool {
@ -39,7 +39,7 @@ public class FixEncoding implements Tool {
public String getMenuTitle() {
return _("Fix Encoding & Reload");
return tr("Fix Encoding & Reload");
}
@ -55,8 +55,8 @@ public class FixEncoding implements Tool {
if (sketch.isModified()) {
int result =
JOptionPane.showConfirmDialog(editor,
_("Discard all changes and reload sketch?"),
_("Fix Encoding & Reload"),
tr("Discard all changes and reload sketch?"),
tr("Fix Encoding & Reload"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
@ -75,9 +75,9 @@ public class FixEncoding implements Tool {
} catch (IOException e) {
String msg =
_("An error occurred while trying to fix the file encoding.\nDo not attempt to save this sketch as it may overwrite\nthe old version. Use Open to re-open the sketch and try again.\n") +
tr("An error occurred while trying to fix the file encoding.\nDo not attempt to save this sketch as it may overwrite\nthe old version. Use Open to re-open the sketch and try again.\n") +
e.getMessage();
Base.showWarning(_("Fix Encoding & Reload"), msg, e);
Base.showWarning(tr("Fix Encoding & Reload"), msg, e);
}
}

View File

@ -40,7 +40,7 @@ import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.I18n.format;
public class DownloadableContributionsDownloader {
@ -68,13 +68,13 @@ public class DownloadableContributionsDownloader {
}
// Test checksum
progress.setStatus(_("Verifying archive integrity..."));
progress.setStatus(tr("Verifying archive integrity..."));
onProgress(progress);
String checksum = contribution.getChecksum();
if (hasChecksum(contribution)) {
String algo = checksum.split(":")[0];
if (!FileHash.hash(outputFile.toFile(), algo).equalsIgnoreCase(checksum)) {
throw new Exception(_("CRC doesn't match. File is corrupted."));
throw new Exception(tr("CRC doesn't match. File is corrupted."));
}
}
@ -102,7 +102,7 @@ public class DownloadableContributionsDownloader {
if (me.getDownloadSize() != null) {
long downloaded = (me.getInitialSize() + me.getDownloaded()) / 1000;
long total = (me.getInitialSize() + me.getDownloadSize()) / 1000;
msg = format(_("Downloaded {0}kb of {1}kb."), downloaded, total);
msg = format(tr("Downloaded {0}kb of {1}kb."), downloaded, total);
}
progress.setStatus(statusText + " " + msg);
progress.setProgress(me.getProgress());
@ -110,7 +110,7 @@ public class DownloadableContributionsDownloader {
});
downloader.download();
if (!downloader.isCompleted()) {
throw new Exception(format(_("Error downloading {0}"), url), downloader.getError());
throw new Exception(format(tr("Error downloading {0}"), url), downloader.getError());
}
}

View File

@ -31,15 +31,15 @@ package cc.arduino.contributions;
import processing.app.I18n;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class SignatureVerificationFailedException extends Exception {
public SignatureVerificationFailedException(String filename) {
super(I18n.format(_("{0} file signature verification failed"), filename));
super(I18n.format(tr("{0} file signature verification failed"), filename));
}
public SignatureVerificationFailedException(String filename, Throwable cause) {
super(I18n.format(_("{0} file signature verification failed"), filename), cause);
super(I18n.format(tr("{0} file signature verification failed"), filename), cause);
}
}

View File

@ -35,7 +35,7 @@ import processing.app.I18n;
import java.util.Comparator;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public abstract class ContributedLibrary extends DownloadableContribution {
@ -94,7 +94,7 @@ public abstract class ContributedLibrary extends DownloadableContribution {
@Override
public String toString() {
return I18n.format(_("Version {0}"), getParsedVersion());
return I18n.format(tr("Version {0}"), getParsedVersion());
}
public String info() {

View File

@ -53,7 +53,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class LibrariesIndexer {
@ -137,11 +137,11 @@ public class LibrariesIndexer {
badLibNotified.add(subfolder.getName());
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
String mess = I18n.format(tr("The library \"{0}\" cannot be used.\n"
+ "Library names must contain only basic letters and numbers.\n"
+ "(ASCII only and no spaces, and it cannot start with a number)"),
subfolder.getName());
BaseNoGui.showMessage(_("Ignoring bad library name"), mess);
BaseNoGui.showMessage(tr("Ignoring bad library name"), mess);
}
continue;
}
@ -149,7 +149,7 @@ public class LibrariesIndexer {
try {
scanLibrary(subfolder, isSketchbook);
} catch (IOException e) {
System.out.println(I18n.format(_("Invalid library found in {0}: {1}"), subfolder, e.getMessage()));
System.out.println(I18n.format(tr("Invalid library found in {0}: {1}"), subfolder, e.getMessage()));
}
}
}

View File

@ -42,7 +42,7 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class LibraryInstaller {
@ -83,7 +83,7 @@ public class LibraryInstaller {
File tmpFile = new File(outputFile.getAbsolutePath() + ".tmp");
try {
GZippedJsonDownloader gZippedJsonDownloader = new GZippedJsonDownloader(downloader, new URL(LIBRARY_INDEX_URL), new URL(LIBRARY_INDEX_URL_GZ));
gZippedJsonDownloader.download(tmpFile, progress, _("Downloading libraries index..."));
gZippedJsonDownloader.download(tmpFile, progress, tr("Downloading libraries index..."));
} catch (InterruptedException e) {
// Download interrupted... just exit
return;
@ -96,7 +96,7 @@ public class LibraryInstaller {
if (outputFile.exists())
outputFile.delete();
if (!tmpFile.renameTo(outputFile))
throw new Exception(_("An error occurred while updating libraries index!"));
throw new Exception(tr("An error occurred while updating libraries index!"));
// Step 2: Rescan index
rescanLibraryIndex(progress);
@ -104,7 +104,7 @@ public class LibraryInstaller {
public void install(ContributedLibrary lib, ContributedLibrary replacedLib) throws Exception {
if (lib.isInstalled()) {
System.out.println(I18n.format(_("Library is already installed: {0} version {1}"), lib.getName(), lib.getParsedVersion()));
System.out.println(I18n.format(tr("Library is already installed: {0} version {1}"), lib.getName(), lib.getParsedVersion()));
return;
}
@ -112,7 +112,7 @@ public class LibraryInstaller {
// Step 1: Download library
try {
downloader.download(lib, progress, I18n.format(_("Downloading library: {0}"), lib.getName()));
downloader.download(lib, progress, I18n.format(tr("Downloading library: {0}"), lib.getName()));
} catch (InterruptedException e) {
// Download interrupted... just exit
return;
@ -123,7 +123,7 @@ public class LibraryInstaller {
// all the temporary folders and abort installation.
// Step 2: Unpack library on the correct location
progress.setStatus(I18n.format(_("Installing library: {0}"), lib.getName()));
progress.setStatus(I18n.format(tr("Installing library: {0}"), lib.getName()));
onProgress(progress);
File libsFolder = indexer.getSketchbookLibrariesFolder();
File tmpFolder = FileUtils.createTempFolderIn(libsFolder);
@ -154,7 +154,7 @@ public class LibraryInstaller {
final MultiStepProgress progress = new MultiStepProgress(2);
// Step 1: Remove library
progress.setStatus(I18n.format(_("Removing library: {0}"), lib.getName()));
progress.setStatus(I18n.format(tr("Removing library: {0}"), lib.getName()));
onProgress(progress);
FileUtils.recursiveDelete(lib.getInstalledFolder());
progress.stepDone();
@ -164,7 +164,7 @@ public class LibraryInstaller {
}
private void rescanLibraryIndex(MultiStepProgress progress) {
progress.setStatus(_("Updating list of installed libraries"));
progress.setStatus(tr("Updating list of installed libraries"));
onProgress(progress);
indexer.rescanLibraries();
progress.stepDone();

View File

@ -55,7 +55,7 @@ import java.net.URL;
import java.nio.file.Files;
import java.util.*;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.I18n.format;
public class ContributionInstaller {
@ -91,7 +91,7 @@ public class ContributionInstaller {
ContributedTool tool = toolsIterator.next();
DownloadableContribution downloadable = tool.getDownloadableContribution(platform);
if (downloadable == null) {
throw new Exception(format(_("Tool {0} is not available for your operating system."), tool.getName()));
throw new Exception(format(tr("Tool {0} is not available for your operating system."), tool.getName()));
}
if (downloadable.isInstalled()) {
toolsIterator.remove();
@ -104,13 +104,13 @@ public class ContributionInstaller {
// Download all
try {
// Download platform
downloader.download(contributedPlatform, progress, _("Downloading boards definitions."));
downloader.download(contributedPlatform, progress, tr("Downloading boards definitions."));
progress.stepDone();
// Download tools
int i = 1;
for (ContributedTool tool : tools) {
String msg = format(_("Downloading tools ({0}/{1})."), i, tools.size());
String msg = format(tr("Downloading tools ({0}/{1})."), i, tools.size());
i++;
downloader.download(tool.getDownloadableContribution(platform), progress, msg);
progress.stepDone();
@ -131,7 +131,7 @@ public class ContributionInstaller {
File toolsFolder = new File(packageFolder, "tools");
int i = 1;
for (ContributedTool tool : tools) {
progress.setStatus(format(_("Installing tools ({0}/{1})..."), i, tools.size()));
progress.setStatus(format(tr("Installing tools ({0}/{1})..."), i, tools.size()));
onProgress(progress);
i++;
DownloadableContribution toolContrib = tool.getDownloadableContribution(platform);
@ -143,7 +143,7 @@ public class ContributionInstaller {
try {
findAndExecutePostInstallScriptIfAny(destFolder, contributedPlatform.getParentPackage().isTrusted(), PreferencesData.getBoolean(Constants.PREF_CONTRIBUTIONS_TRUST_ALL));
} catch (IOException e) {
errors.add(_("Error running post install script"));
errors.add(tr("Error running post install script"));
}
toolContrib.setInstalled(true);
toolContrib.setInstalledFolder(destFolder);
@ -151,7 +151,7 @@ public class ContributionInstaller {
}
// Unpack platform on the correct location
progress.setStatus(_("Installing boards..."));
progress.setStatus(tr("Installing boards..."));
onProgress(progress);
File platformFolder = new File(packageFolder, "hardware" + File.separator + contributedPlatform.getArchitecture());
File destFolder = new File(platformFolder, contributedPlatform.getParsedVersion());
@ -163,11 +163,11 @@ public class ContributionInstaller {
findAndExecutePostInstallScriptIfAny(destFolder, contributedPlatform.getParentPackage().isTrusted(), PreferencesData.getBoolean(Constants.PREF_CONTRIBUTIONS_TRUST_ALL));
} catch (IOException e) {
e.printStackTrace();
errors.add(_("Error running post install script"));
errors.add(tr("Error running post install script"));
}
progress.stepDone();
progress.setStatus(_("Installation completed!"));
progress.setStatus(tr("Installation completed!"));
onProgress(progress);
return errors;
@ -209,12 +209,12 @@ public class ContributionInstaller {
File script = postInstallScripts.iterator().next();
if (!trusted && !trustAll) {
System.err.println(I18n.format(_("Warning: non trusted contribution, skipping script execution ({0})"), script));
System.err.println(I18n.format(tr("Warning: non trusted contribution, skipping script execution ({0})"), script));
return;
}
if (trustAll) {
System.err.println(I18n.format(_("Warning: forced untrusted script execution ({0})"), script));
System.err.println(I18n.format(tr("Warning: forced untrusted script execution ({0})"), script));
}
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
@ -242,7 +242,7 @@ public class ContributionInstaller {
try {
findAndExecutePreUninstallScriptIfAny(contributedPlatform.getInstalledFolder(), contributedPlatform.getParentPackage().isTrusted(), PreferencesData.getBoolean(Constants.PREF_CONTRIBUTIONS_TRUST_ALL));
} catch (IOException e) {
errors.add(_("Error running post install script"));
errors.add(tr("Error running post install script"));
}
FileUtils.recursiveDelete(contributedPlatform.getInstalledFolder());
@ -307,7 +307,7 @@ public class ContributionInstaller {
downloadedPackagedIndexFilesAccumulator.remove(packageIndex.getName());
Files.delete(packageIndex.toPath());
Files.delete(packageIndexSignature.toPath());
System.err.println(I18n.format(_("{0} file signature verification failed. File ignored."), packageIndexUrl));
System.err.println(I18n.format(tr("{0} file signature verification failed. File ignored."), packageIndexUrl));
}
} catch (Exception e) {
//ignore errors
@ -315,7 +315,7 @@ public class ContributionInstaller {
}
private File download(MultiStepProgress progress, String packageIndexUrl) throws Exception {
String statusText = _("Downloading platforms index...");
String statusText = tr("Downloading platforms index...");
URL url = new URL(packageIndexUrl);
String[] urlPathParts = url.getFile().split("/");
File outputFile = indexer.getIndexFile(urlPathParts[urlPathParts.length - 1]);

View File

@ -60,7 +60,7 @@ import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
public class ContributionsIndexer {
@ -130,7 +130,7 @@ public class ContributionsIndexer {
} else {
if (contributedPackage.isTrusted() || !isPackageNameProtected(contributedPackage)) {
if (isPackageNameProtected(contributedPackage) && trustall) {
System.err.println(I18n.format(_("Warning: forced trusting untrusted contributions")));
System.err.println(I18n.format(tr("Warning: forced trusting untrusted contributions")));
}
List<ContributedPlatform> platforms = contributedPackage.getPlatforms();
if (platforms == null) {

View File

@ -35,7 +35,7 @@ import cc.arduino.packages.discoverers.SerialDiscovery;
import java.util.ArrayList;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class DiscoveryManager {
@ -51,7 +51,7 @@ public class DiscoveryManager {
try {
d.start();
} catch (Exception e) {
System.err.println(_("Error starting discovery method: ") + d.getClass());
System.err.println(tr("Error starting discovery method: ") + d.getClass());
e.printStackTrace();
}
}

View File

@ -37,7 +37,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public abstract class Uploader implements MessageConsumer {
@ -145,19 +145,19 @@ public abstract class Uploader implements MessageConsumer {
return;
}
if (notFoundError) {
error = I18n.format(_("the selected serial port {0} does not exist or your board is not connected"), s);
error = I18n.format(tr("the selected serial port {0} does not exist or your board is not connected"), s);
return;
}
if (s.contains("Device is not responding")) {
error = _("Device is not responding, check the right serial port is selected or RESET the board right before exporting");
error = tr("Device is not responding, check the right serial port is selected or RESET the board right before exporting");
return;
}
if (StringUtils.stringContainsOneOf(s, AVRDUDE_PROBLEMS)) {
error = _("Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.");
error = tr("Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.");
return;
}
if (s.contains("Expected signature")) {
error = _("Wrong microcontroller found. Did you select the right board from the Tools > Board menu?");
error = tr("Wrong microcontroller found. Did you select the right board from the Tools > Board menu?");
return;
}
}

View File

@ -46,7 +46,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class SSHUploader extends Uploader {
@ -70,7 +70,7 @@ public class SSHUploader extends Uploader {
@Override
public boolean uploadUsingPreferences(File sourcePath, String buildPath, String className, boolean usingProgrammer, List<String> warningsAccumulator) throws RunnerException, PreferencesMapException {
if (usingProgrammer) {
throw new RunnerException(_("Network upload using programmer not supported"));
throw new RunnerException(tr("Network upload using programmer not supported"));
}
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
@ -198,11 +198,11 @@ public class SSHUploader extends Uploader {
return false;
}
if (!www.canExecute()) {
warningsAccumulator.add(_("Problem accessing files in folder ") + www);
warningsAccumulator.add(tr("Problem accessing files in folder ") + www);
return false;
}
if (!ssh.execSyncCommand("special-storage-available")) {
warningsAccumulator.add(_("Problem accessing board folder /www/sd"));
warningsAccumulator.add(tr("Problem accessing board folder /www/sd"));
return false;
}
return true;

View File

@ -38,7 +38,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class SerialUploader extends Uploader {
@ -116,7 +116,7 @@ public class SerialUploader extends Uploader {
if (before.contains(userSelectedUploadPort)) {
if (verbose)
System.out.println(
I18n.format(_("Forcing reset using 1200bps open/close on port {0}"), userSelectedUploadPort));
I18n.format(tr("Forcing reset using 1200bps open/close on port {0}"), userSelectedUploadPort));
Serial.touchForCDCReset(userSelectedUploadPort);
}
Thread.sleep(400);
@ -242,7 +242,7 @@ public class SerialUploader extends Uploader {
}
// Something happened while detecting port
throw new RunnerException(_("Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload."), false);
throw new RunnerException(tr("Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload."), false);
}
private boolean uploadUsingProgrammer(String buildPath, String className) throws Exception {
@ -263,7 +263,7 @@ public class SerialUploader extends Uploader {
PreferencesMap programmerPrefs = targetPlatform.getProgrammer(programmer);
if (programmerPrefs == null)
throw new RunnerException(
_("Please select a programmer from Tools->Programmer menu"));
tr("Please select a programmer from Tools->Programmer menu"));
prefs.putAll(targetPlatform.getTool(programmerPrefs.getOrExcept("program.tool")));
prefs.putAll(programmerPrefs);
@ -308,7 +308,7 @@ public class SerialUploader extends Uploader {
}
if (programmerPrefs == null)
throw new RunnerException(
_("Please select a programmer from Tools->Programmer menu"));
tr("Please select a programmer from Tools->Programmer menu"));
// Build configuration for the current programmer
PreferencesMap prefs = PreferencesData.getMap();
@ -327,11 +327,11 @@ public class SerialUploader extends Uploader {
tool = split[1];
toolPrefs.putAll(platform.getTool(tool));
if (toolPrefs.size() == 0)
throw new RunnerException(I18n.format(_("Could not find tool {0} from package {1}"), tool, split[0]));
throw new RunnerException(I18n.format(tr("Could not find tool {0} from package {1}"), tool, split[0]));
}
toolPrefs.putAll(targetPlatform.getTool(tool));
if (toolPrefs.size() == 0)
throw new RunnerException(I18n.format(_("Could not find tool {0}"), tool));
throw new RunnerException(I18n.format(tr("Could not find tool {0}"), tool));
// Merge tool with global configuration
prefs.putAll(toolPrefs);

View File

@ -44,7 +44,7 @@ import java.io.*;
import java.util.HashMap;
import java.util.Map;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class ArchiveExtractor {
@ -194,7 +194,7 @@ public class ArchiveExtractor {
// Symbolic links are referenced with relative paths
outputLinkedFile = new File(linkName);
if (outputLinkedFile.isAbsolute()) {
System.err.println(I18n.format(_("Warning: file {0} links to an absolute path {1}"), outputFile, outputLinkedFile));
System.err.println(I18n.format(tr("Warning: file {0} links to an absolute path {1}"), outputFile, outputLinkedFile));
System.err.println();
}
}

View File

@ -30,7 +30,7 @@ import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class BaseNoGui {
@ -282,16 +282,16 @@ public class BaseNoGui {
try {
settingsFolder = getPlatform().getSettingsFolder();
} catch (Exception e) {
showError(_("Problem getting data folder"),
_("Error getting the Arduino data folder."), e);
showError(tr("Problem getting data folder"),
tr("Error getting the Arduino data folder."), e);
}
}
// create the folder if it doesn't exist already
if (!settingsFolder.exists()) {
if (!settingsFolder.mkdirs()) {
showError(_("Settings issues"),
_("Arduino cannot run because it could not\n" +
showError(tr("Settings issues"),
tr("Arduino cannot run because it could not\n" +
"create a folder to store your settings."), null);
}
}
@ -315,7 +315,7 @@ public class BaseNoGui {
try {
libdir.mkdirs();
freadme = new FileWriter(new File(libdir, "readme.txt"));
freadme.write(_("For information on installing libraries, see: " +
freadme.write(tr("For information on installing libraries, see: " +
"http://www.arduino.cc/en/Guide/Libraries\n"));
} catch (Exception e) {
} finally {
@ -338,8 +338,8 @@ public class BaseNoGui {
else
sketchbookFolder = absoluteFile(sketchbookPath);
if (!sketchbookFolder.exists()) {
showWarning(_("Sketchbook folder disappeared"),
_("The sketchbook folder no longer exists.\n" +
showWarning(tr("Sketchbook folder disappeared"),
tr("The sketchbook folder no longer exists.\n" +
"Arduino will switch to the default sketchbook\n" +
"location, and create a new sketchbook folder if\n" +
"necessary. Arduino will then stop talking about\n" +
@ -432,7 +432,7 @@ public class BaseNoGui {
if (BaseNoGui.getPortableFolder() != null)
PreferencesData.set("sketchbook.path", getPortableSketchbookFolder());
else
showError(_("No sketchbook"), _("Sketchbook path not defined"), null);
showError(tr("No sketchbook"), tr("Sketchbook path not defined"), null);
}
BaseNoGui.initPackages();
@ -459,12 +459,12 @@ public class BaseNoGui {
}
if (!parser.isVerifyOrUploadMode() && !parser.isGetPrefMode())
showError(_("Mode not supported"), _("Only --verify, --upload or --get-pref are supported"), null);
showError(tr("Mode not supported"), tr("Only --verify, --upload or --get-pref are supported"), null);
if (!parser.isForceSavePrefs())
PreferencesData.setDoSave(false);
if (!file.exists()) {
String mess = I18n.format(_("Failed to open sketch: \"{0}\""), path);
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
// Open failure is fatal in upload/verify mode
showError(null, mess, 2);
}
@ -488,7 +488,7 @@ public class BaseNoGui {
if (parser.getFilenames().size() != 1)
{
showError(_("Multiple files not supported"), _("The --upload option supports only one file at a time"), null);
showError(tr("Multiple files not supported"), tr("The --upload option supports only one file at a time"), null);
}
List<String> warningsAccumulator = new LinkedList<String>();
@ -509,33 +509,33 @@ public class BaseNoGui {
// - calls Sketch.build(verbose=false) that calls Sketch.ensureExistence(), set progressListener and calls Compiler.build()
// - calls Sketch.upload() (see later...)
if (!data.getFolder().exists()) {
showError(_("No sketch"), _("Can't find the sketch in the specified path"), null);
showError(tr("No sketch"), tr("Can't find the sketch in the specified path"), null);
}
String suggestedClassName = Compiler.build(data, tempBuildFolder.getAbsolutePath(), tempBuildFolder, null, parser.isDoVerboseBuild(), false);
if (suggestedClassName == null) {
showError(_("Error while verifying"), _("An error occurred while verifying the sketch"), null);
showError(tr("Error while verifying"), tr("An error occurred while verifying the sketch"), null);
}
showMessage(_("Done compiling"), _("Done compiling"));
showMessage(tr("Done compiling"), tr("Done compiling"));
Uploader uploader = Compiler.getUploaderByPreferences(parser.isNoUploadPort());
if (uploader.requiresAuthorization() && !PreferencesData.has(uploader.getAuthorizationKey())) showError("...", "...", null);
try {
success = Compiler.upload(data, uploader, tempBuildFolder.getAbsolutePath(), suggestedClassName, parser.isDoUseProgrammer(), parser.isNoUploadPort(), warningsAccumulator);
showMessage(_("Done uploading"), _("Done uploading"));
showMessage(tr("Done uploading"), tr("Done uploading"));
} finally {
if (uploader.requiresAuthorization() && !success) {
PreferencesData.remove(uploader.getAuthorizationKey());
}
}
} catch (Exception e) {
showError(_("Error while verifying/uploading"), _("An error occurred while verifying/uploading the sketch"), e);
showError(tr("Error while verifying/uploading"), tr("An error occurred while verifying/uploading the sketch"), e);
}
for (String warning : warningsAccumulator) {
System.out.print(_("Warning"));
System.out.print(tr("Warning"));
System.out.print(": ");
System.out.println(warning);
}
if (!success) showError(_("Error while uploading"), _("An error occurred while uploading the sketch"), null);
if (!success) showError(tr("Error while uploading"), tr("An error occurred while uploading the sketch"), null);
} else {
for (String path : parser.getFilenames())
@ -556,12 +556,12 @@ public class BaseNoGui {
// This translates here as:
// if (!data.getFolder().exists()) showError(...);
// String ... = Compiler.build(data, tempBuildFolder.getAbsolutePath(), tempBuildFolder, null, verbose);
if (!data.getFolder().exists()) showError(_("No sketch"), _("Can't find the sketch in the specified path"), null);
if (!data.getFolder().exists()) showError(tr("No sketch"), tr("Can't find the sketch in the specified path"), null);
String suggestedClassName = Compiler.build(data, tempBuildFolder.getAbsolutePath(), tempBuildFolder, null, parser.isDoVerboseBuild(), false);
if (suggestedClassName == null) showError(_("Error while verifying"), _("An error occurred while verifying the sketch"), null);
showMessage(_("Done compiling"), _("Done compiling"));
if (suggestedClassName == null) showError(tr("Error while verifying"), tr("An error occurred while verifying the sketch"), null);
showMessage(tr("Done compiling"), tr("Done compiling"));
} catch (Exception e) {
showError(_("Error while verifying"), _("An error occurred while verifying the sketch"), e);
showError(tr("Error while verifying"), tr("An error occurred while verifying the sketch"), e);
}
}
@ -680,8 +680,8 @@ public class BaseNoGui {
}
platform = (Platform) platformClass.newInstance();
} catch (Exception e) {
showError(_("Problem Setting the Platform"),
_("An unknown error occurred while trying to load\n" +
showError(tr("Problem Setting the Platform"),
tr("An unknown error occurred while trying to load\n" +
"platform-specific code for your machine."), e);
}
}
@ -744,7 +744,7 @@ public class BaseNoGui {
static public void main(String args[]) throws Exception {
if (args.length == 0) {
showError(_("No parameters"), _("No command line parameters found"), null);
showError(tr("No parameters"), tr("No command line parameters found"), null);
}
System.setProperty("java.net.useSystemProxies", "true");
@ -765,10 +765,10 @@ public class BaseNoGui {
public static void checkInstallationFolder() {
if (isIDEInstalledIntoSettingsFolder()) {
showError(_("Incorrect IDE installation folder"), _("Your copy of the IDE is installed in a subfolder of your settings folder.\nPlease move the IDE to another folder."), 10);
showError(tr("Incorrect IDE installation folder"), tr("Your copy of the IDE is installed in a subfolder of your settings folder.\nPlease move the IDE to another folder."), 10);
}
if (isIDEInstalledIntoSketchbookFolder()) {
showError(_("Incorrect IDE installation folder"), _("Your copy of the IDE is installed in a subfolder of your sketchbook.\nPlease move the IDE to another folder."), 10);
showError(tr("Incorrect IDE installation folder"), tr("Your copy of the IDE is installed in a subfolder of your sketchbook.\nPlease move the IDE to another folder."), 10);
}
}
@ -937,7 +937,7 @@ public class BaseNoGui {
}
}
} catch (IOException e) {
showWarning(_("Error"), I18n
showWarning(tr("Error"), I18n
.format("Unable to list header files in {0}", lib.getSrcFolder()), e);
}
}
@ -1003,7 +1003,7 @@ public class BaseNoGui {
if (!PreferencesData.getBoolean("compiler.save_build_files")) {
if (!dead.delete()) {
// temporarily disabled
System.err.println(I18n.format(_("Could not delete {0}"), dead));
System.err.println(I18n.format(tr("Could not delete {0}"), dead));
}
}
} else {
@ -1020,7 +1020,7 @@ public class BaseNoGui {
if (dir.exists()) {
removeDescendants(dir);
if (!dir.delete()) {
System.err.println(I18n.format(_("Could not delete {0}"), dir));
System.err.println(I18n.format(tr("Could not delete {0}"), dir));
}
}
}
@ -1080,7 +1080,7 @@ public class BaseNoGui {
if (!result) {
throw new IOException(
I18n.format(
_("Could not remove old version of {0}"),
tr("Could not remove old version of {0}"),
file.getAbsolutePath()));
}
}
@ -1088,7 +1088,7 @@ public class BaseNoGui {
if (!result) {
throw new IOException(
I18n.format(
_("Could not replace {0}"),
tr("Could not replace {0}"),
file.getAbsolutePath()));
}
}

View File

@ -43,14 +43,19 @@ public class I18n {
// there might be a null pointer exception ... most likely will never happen but the jvm gets mad
Locale.setDefault(locale);
i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", Locale.getDefault());
PROMPT_YES = _("Yes");
PROMPT_NO = _("No");
PROMPT_CANCEL = _("Cancel");
PROMPT_OK = _("OK");
PROMPT_BROWSE = _("Browse");
PROMPT_YES = tr("Yes");
PROMPT_NO = tr("No");
PROMPT_CANCEL = tr("Cancel");
PROMPT_OK = tr("OK");
PROMPT_BROWSE = tr("Browse");
}
@Deprecated
public static String _(String s) {
return tr(s);
}
public static String tr(String s) {
String res;
try {
if (i18n == null)
@ -87,10 +92,10 @@ public class I18n {
*/
protected static void unusedStrings() {
// These phrases are defined in the "platform.txt".
_("Arduino AVR Boards");
_("Arduino ARM (32-bits) Boards");
tr("Arduino AVR Boards");
tr("Arduino ARM (32-bits) Boards");
// This word is defined in the "boards.txt".
_("Processor");
tr("Processor");
}
}

View File

@ -36,7 +36,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
@ -202,8 +202,8 @@ public class Platform {
protected void showLauncherWarning() {
BaseNoGui.showWarning(_("No launcher available"),
_("Unspecified platform, no launcher available.\nTo enable opening URLs or folders, add a \n\"launcher=/path/to/app\" line to preferences.txt"),
BaseNoGui.showWarning(tr("No launcher available"),
tr("Unspecified platform, no launcher available.\nTo enable opening URLs or folders, add a \n\"launcher=/path/to/app\" line to preferences.txt"),
null);
}

View File

@ -16,7 +16,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.MissingResourceException;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class PreferencesData {
@ -52,7 +52,7 @@ public class PreferencesData {
try {
prefs.load(new File(BaseNoGui.getContentFile("lib"), PREFS_FILE));
} catch (IOException e) {
BaseNoGui.showError(null, _("Could not read default settings.\n" +
BaseNoGui.showError(null, tr("Could not read default settings.\n" +
"You'll need to reinstall Arduino."), e);
}
@ -69,8 +69,8 @@ public class PreferencesData {
try {
prefs.load(preferencesFile);
} catch (IOException ex) {
BaseNoGui.showError(_("Error reading preferences"),
I18n.format(_("Error reading the preferences file. "
BaseNoGui.showError(tr("Error reading preferences"),
I18n.format(tr("Error reading the preferences file. "
+ "Please delete (or move)\n"
+ "{0} and restart Arduino."),
preferencesFile.getAbsolutePath()), ex);

View File

@ -31,7 +31,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.I18n.format;
public class Serial implements SerialPortEventListener {
@ -84,7 +84,7 @@ public class Serial implements SerialPortEventListener {
serialPort.closePort();
return true;
} catch (SerialPortException e) {
throw new SerialException(format(_("Error touching serial port ''{0}''."), iname), e);
throw new SerialException(format(tr("Error touching serial port ''{0}''."), iname), e);
} finally {
if (serialPort.isOpened()) {
try {
@ -116,13 +116,13 @@ public class Serial implements SerialPortEventListener {
port.addEventListener(this);
} catch (SerialPortException e) {
if (e.getPortName().startsWith("/dev") && SerialPortException.TYPE_PERMISSION_DENIED.equals(e.getExceptionType())) {
throw new SerialException(format(_("Error opening serial port ''{0}''. Try consulting the documentation at http://playground.arduino.cc/Linux/All#Permission"), iname));
throw new SerialException(format(tr("Error opening serial port ''{0}''. Try consulting the documentation at http://playground.arduino.cc/Linux/All#Permission"), iname));
}
throw new SerialException(format(_("Error opening serial port ''{0}''."), iname), e);
throw new SerialException(format(tr("Error opening serial port ''{0}''."), iname), e);
}
if (port == null) {
throw new SerialNotFoundException(format(_("Serial port ''{0}'' not found. Did you select the right one from the Tools > Serial Port menu?"), iname));
throw new SerialNotFoundException(format(tr("Serial port ''{0}'' not found. Did you select the right one from the Tools > Serial Port menu?"), iname));
}
}
@ -231,7 +231,7 @@ public class Serial implements SerialPortEventListener {
* I think of something slightly more intelligent to do.
*/
private static void errorMessage(String where, Throwable e) {
System.err.println(format(_("Error inside Serial.{0}()"), where));
System.err.println(format(tr("Error inside Serial.{0}()"), where));
e.printStackTrace();
}
}

View File

@ -30,7 +30,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
/**
* Represents a single tab of a sketch.
@ -72,7 +72,7 @@ public class SketchCode {
load();
} catch (IOException e) {
System.err.println(
I18n.format(_("Error while loading code {0}"), file.getName()));
I18n.format(tr("Error while loading code {0}"), file.getName()));
}
}
@ -196,7 +196,7 @@ public class SketchCode {
if (program.indexOf('\uFFFD') != -1) {
System.err.println(
I18n.format(
_("\"{0}\" contains unrecognized characters." +
tr("\"{0}\" contains unrecognized characters." +
"If this code was created with an older version of Arduino," +
"you may need to use Tools -> Fix Encoding & Reload to update" +
"the sketch to use UTF-8 encoding. If not, you may need to" +

View File

@ -2,7 +2,7 @@ package processing.app;
import com.google.common.collect.FluentIterable;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import java.io.File;
import java.io.IOException;
@ -135,7 +135,7 @@ public class SketchData {
}
if (getCodeCount() == 0)
throw new IOException(_("No valid code files found"));
throw new IOException(tr("No valid code files found"));
// move the main class to the first tab
// start at 1, if it's at zero, don't bother

View File

@ -58,7 +58,7 @@ import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class Compiler implements MessageConsumer {
@ -91,8 +91,8 @@ public class Compiler implements MessageConsumer {
static public String build(SketchData data, String buildPath, File tempBuildFolder, ProgressListener progListener, boolean verbose, boolean save) throws RunnerException, PreferencesMapException {
if (SketchData.checkSketchFile(data.getPrimaryFile()) == null)
BaseNoGui.showError(_("Bad file selected"),
_("Bad sketch primary file or bad sketch directory structure"), null);
BaseNoGui.showError(tr("Bad file selected"),
tr("Bad sketch primary file or bad sketch directory structure"), null);
String primaryClassName = data.getName() + ".cpp";
Compiler compiler = new Compiler(data, buildPath, primaryClassName);
@ -110,7 +110,7 @@ public class Compiler implements MessageConsumer {
out = new PrintWriter(buildPrefsFile);
out.print(newBuildPrefs);
} catch (IOException e) {
System.err.println(_("Could not write build preferences file"));
System.err.println(tr("Could not write build preferences file"));
} finally {
IOUtils.closeQuietly(out);
}
@ -154,8 +154,8 @@ public class Compiler implements MessageConsumer {
boolean success = false;
if (uploader.requiresAuthorization() && !PreferencesData.has(uploader.getAuthorizationKey())) {
BaseNoGui.showError(_("Authorization required"),
_("No authorization data found"), null);
BaseNoGui.showError(tr("Authorization required"),
tr("No authorization data found"), null);
}
boolean useNewWarningsAccumulator = false;
@ -174,7 +174,7 @@ public class Compiler implements MessageConsumer {
if (useNewWarningsAccumulator) {
for (String warning : warningsAccumulator) {
System.out.print(_("Warning"));
System.out.print(tr("Warning"));
System.out.print(": ");
System.out.println(warning);
}
@ -197,7 +197,7 @@ public class Compiler implements MessageConsumer {
map(File::new).
filter(File::exists).
findFirst();
return sketch.orElseThrow(() -> new IllegalStateException(_("No compiled sketch found")));
return sketch.orElseThrow(() -> new IllegalStateException(tr("No compiled sketch found")));
}
@ -236,12 +236,12 @@ public class Compiler implements MessageConsumer {
try {
previousPrefs = FileUtils.readFileToString(buildPrefsFile);
} catch (IOException e) {
System.err.println(_("Could not read prevous build preferences file, rebuilding all"));
System.err.println(tr("Could not read prevous build preferences file, rebuilding all"));
return true;
}
if (!previousPrefs.equals(newBuildPrefs)) {
System.out.println(_("Build options changed, rebuilding all"));
System.out.println(tr("Build options changed, rebuilding all"));
return true;
} else {
return false;
@ -330,7 +330,7 @@ public class Compiler implements MessageConsumer {
try {
sizes = sizer.computeSize();
} catch (RunnerException e) {
System.err.println(I18n.format(_("Couldn't determine program size: {0}"),
System.err.println(I18n.format(tr("Couldn't determine program size: {0}"),
e.getMessage()));
return;
}
@ -339,33 +339,33 @@ public class Compiler implements MessageConsumer {
long dataSize = sizes[1];
System.out.println();
System.out.println(I18n
.format(_("Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes."),
.format(tr("Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes."),
textSize, maxTextSize, textSize * 100 / maxTextSize));
if (dataSize >= 0) {
if (maxDataSize > 0) {
System.out
.println(I18n
.format(
_("Global variables use {0} bytes ({2}%%) of dynamic memory, leaving {3} bytes for local variables. Maximum is {1} bytes."),
tr("Global variables use {0} bytes ({2}%%) of dynamic memory, leaving {3} bytes for local variables. Maximum is {1} bytes."),
dataSize, maxDataSize, dataSize * 100 / maxDataSize,
maxDataSize - dataSize));
} else {
System.out.println(I18n
.format(_("Global variables use {0} bytes of dynamic memory."), dataSize));
.format(tr("Global variables use {0} bytes of dynamic memory."), dataSize));
}
}
if (textSize > maxTextSize)
throw new RunnerException(
_("Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it."));
tr("Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it."));
if (maxDataSize > 0 && dataSize > maxDataSize)
throw new RunnerException(
_("Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint."));
tr("Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint."));
int warnDataPercentage = Integer.parseInt(prefs.get("build.warn_data_percentage"));
if (maxDataSize > 0 && dataSize > maxDataSize*warnDataPercentage/100)
System.err.println(_("Low memory available, stability problems may occur."));
System.err.println(tr("Low memory available, stability problems may occur."));
}
/**
@ -405,9 +405,9 @@ public class Compiler implements MessageConsumer {
}
if (lib.getParsedVersion() == null) {
System.out.println(I18n.format(_("Using library {0} in folder: {1} {2}"), lib.getName(), lib.getInstalledFolder(), legacy));
System.out.println(I18n.format(tr("Using library {0} in folder: {1} {2}"), lib.getName(), lib.getInstalledFolder(), legacy));
} else {
System.out.println(I18n.format(_("Using library {0} at version {1} in folder: {2} {3}"), lib.getName(), lib.getParsedVersion(), lib.getInstalledFolder(), legacy));
System.out.println(I18n.format(tr("Using library {0} at version {1} in folder: {2} {3}"), lib.getName(), lib.getParsedVersion(), lib.getInstalledFolder(), legacy));
}
}
includeFolders.add(lib.getSrcFolder());
@ -426,7 +426,7 @@ public class Compiler implements MessageConsumer {
for (UserLibrary lib : importedLibraries) {
if (!lib.supportsArchitecture(archs)) {
System.err.println(I18n
.format(_("WARNING: library {0} claims to run on {1} "
.format(tr("WARNING: library {0} claims to run on {1} "
+ "architecture(s) and may be incompatible with your"
+ " current board which runs on {2} architecture(s)."), lib
.getName(), lib.getArchitectures(), archs));
@ -517,16 +517,16 @@ public class Compiler implements MessageConsumer {
return;
}
for (int i=0; i < importedDuplicateHeaders.size(); i++) {
System.out.println(I18n.format(_("Multiple libraries were found for \"{0}\""),
System.out.println(I18n.format(tr("Multiple libraries were found for \"{0}\""),
importedDuplicateHeaders.get(i)));
boolean first = true;
for (UserLibrary lib : importedDuplicateLibraries.get(i)) {
if (first) {
System.out.println(I18n.format(_(" Used: {0}"),
System.out.println(I18n.format(tr(" Used: {0}"),
lib.getInstalledFolder().getPath()));
first = false;
} else {
System.out.println(I18n.format(_(" Not used: {0}"),
System.out.println(I18n.format(tr(" Not used: {0}"),
lib.getInstalledFolder().getPath()));
}
}
@ -539,7 +539,7 @@ public class Compiler implements MessageConsumer {
if (BaseNoGui.getBoardPreferences() == null) {
RunnerException re = new RunnerException(
_("No board selected; please choose a board from the Tools > Board menu."));
tr("No board selected; please choose a board from the Tools > Board menu."));
re.hideStackTrace();
throw re;
}
@ -555,7 +555,7 @@ public class Compiler implements MessageConsumer {
corePlatform = BaseNoGui.getTargetPlatform(split[0], targetPlatform.getId());
if (corePlatform == null) {
RunnerException re = new RunnerException(I18n
.format(_("Selected board depends on '{0}' core (not installed)."),
.format(tr("Selected board depends on '{0}' core (not installed)."),
split[0]));
re.hideStackTrace();
throw re;
@ -585,7 +585,7 @@ public class Compiler implements MessageConsumer {
// avr-specific) default for it, but this should be removed at some
// point.
if (!buildPref.containsKey("compiler.path")) {
System.err.println(_("Third-party platform.txt does not define compiler.path. Please report this to the third-party hardware maintainer."));
System.err.println(tr("Third-party platform.txt does not define compiler.path. Please report this to the third-party hardware maintainer."));
buildPref.put("compiler.path", BaseNoGui.getAvrBasePath());
}
@ -774,7 +774,7 @@ public class Compiler implements MessageConsumer {
IOUtils.closeQuietly(reader);
}
if (ret && verbose) {
System.out.println(I18n.format(_("Using previously compiled file: {0}"), obj.getPath()));
System.out.println(I18n.format(tr("Using previously compiled file: {0}"), obj.getPath()));
}
return ret;
}
@ -842,11 +842,11 @@ public class Compiler implements MessageConsumer {
if (result > 1) {
// a failure in the tool (e.g. unable to locate a sub-executable)
System.err
.println(I18n.format(_("{0} returned {1}"), command[0], result));
.println(I18n.format(tr("{0} returned {1}"), command[0], result));
}
if (result != 0) {
RunnerException re = new RunnerException(_("Error compiling."));
RunnerException re = new RunnerException(tr("Error compiling."));
re.hideStackTrace();
throw re;
}
@ -885,54 +885,54 @@ public class Compiler implements MessageConsumer {
String error = pieces[pieces.length - 1], msg = "";
if (error.trim().equals("SPI.h: No such file or directory")) {
error = _("Please import the SPI library from the Sketch > Import Library menu.");
msg = _("\nAs of Arduino 0019, the Ethernet library depends on the SPI library." +
error = tr("Please import the SPI library from the Sketch > Import Library menu.");
msg = tr("\nAs of Arduino 0019, the Ethernet library depends on the SPI library." +
"\nYou appear to be using it or another library that depends on the SPI library.\n\n");
}
if (error.trim().equals("'BYTE' was not declared in this scope")) {
error = _("The 'BYTE' keyword is no longer supported.");
msg = _("\nAs of Arduino 1.0, the 'BYTE' keyword is no longer supported." +
error = tr("The 'BYTE' keyword is no longer supported.");
msg = tr("\nAs of Arduino 1.0, the 'BYTE' keyword is no longer supported." +
"\nPlease use Serial.write() instead.\n\n");
}
if (error.trim().equals("no matching function for call to 'Server::Server(int)'")) {
error = _("The Server class has been renamed EthernetServer.");
msg = _("\nAs of Arduino 1.0, the Server class in the Ethernet library " +
error = tr("The Server class has been renamed EthernetServer.");
msg = tr("\nAs of Arduino 1.0, the Server class in the Ethernet library " +
"has been renamed to EthernetServer.\n\n");
}
if (error.trim().equals("no matching function for call to 'Client::Client(byte [4], int)'")) {
error = _("The Client class has been renamed EthernetClient.");
msg = _("\nAs of Arduino 1.0, the Client class in the Ethernet library " +
error = tr("The Client class has been renamed EthernetClient.");
msg = tr("\nAs of Arduino 1.0, the Client class in the Ethernet library " +
"has been renamed to EthernetClient.\n\n");
}
if (error.trim().equals("'Udp' was not declared in this scope")) {
error = _("The Udp class has been renamed EthernetUdp.");
msg = _("\nAs of Arduino 1.0, the Udp class in the Ethernet library " +
error = tr("The Udp class has been renamed EthernetUdp.");
msg = tr("\nAs of Arduino 1.0, the Udp class in the Ethernet library " +
"has been renamed to EthernetUdp.\n\n");
}
if (error.trim().equals("'class TwoWire' has no member named 'send'")) {
error = _("Wire.send() has been renamed Wire.write().");
msg = _("\nAs of Arduino 1.0, the Wire.send() function was renamed " +
error = tr("Wire.send() has been renamed Wire.write().");
msg = tr("\nAs of Arduino 1.0, the Wire.send() function was renamed " +
"to Wire.write() for consistency with other libraries.\n\n");
}
if (error.trim().equals("'class TwoWire' has no member named 'receive'")) {
error = _("Wire.receive() has been renamed Wire.read().");
msg = _("\nAs of Arduino 1.0, the Wire.receive() function was renamed " +
error = tr("Wire.receive() has been renamed Wire.read().");
msg = tr("\nAs of Arduino 1.0, the Wire.receive() function was renamed " +
"to Wire.read() for consistency with other libraries.\n\n");
}
if (error.trim().equals("'Mouse' was not declared in this scope")) {
error = _("'Mouse' only supported on the Arduino Leonardo");
error = tr("'Mouse' only supported on the Arduino Leonardo");
//msg = _("\nThe 'Mouse' class is only supported on the Arduino Leonardo.\n\n");
}
if (error.trim().equals("'Keyboard' was not declared in this scope")) {
error = _("'Keyboard' only supported on the Arduino Leonardo");
error = tr("'Keyboard' only supported on the Arduino Leonardo");
//msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n");
}
@ -962,13 +962,13 @@ public class Compiler implements MessageConsumer {
if (s.contains("undefined reference to `SPIClass::begin()'") &&
s.contains("libraries/Robot_Control")) {
String error = _("Please import the SPI library from the Sketch > Import Library menu.");
String error = tr("Please import the SPI library from the Sketch > Import Library menu.");
exception = new RunnerException(error);
}
if (s.contains("undefined reference to `Wire'") &&
s.contains("libraries/Robot_Control")) {
String error = _("Please import the Wire library from the Sketch > Import Library menu.");
String error = tr("Please import the Wire library from the Sketch > Import Library menu.");
exception = new RunnerException(error);
}
@ -1150,7 +1150,7 @@ public class Compiler implements MessageConsumer {
// shouldn't be a problem.
if (!changed) {
if (verbose)
System.out.println(I18n.format(_("Using previously compiled file: {0}"), afile.getPath()));
System.out.println(I18n.format(tr("Using previously compiled file: {0}"), afile.getPath()));
return;
}
}
@ -1270,7 +1270,7 @@ public class Compiler implements MessageConsumer {
Path bootloader = Paths.get(prefs.get("runtime.platform.path"), "bootloaders", bootloaderNoBlink);
if (!Files.exists(bootloader)) {
System.err.println(I18n.format(_("Bootloader file specified but missing: {0}"), bootloader));
System.err.println(I18n.format(tr("Bootloader file specified but missing: {0}"), bootloader));
return;
}
@ -1292,7 +1292,7 @@ public class Compiler implements MessageConsumer {
List<String> copyOfCompiledSketches = new ArrayList<>(prefs.subTree("recipe.output.save_file", 1).values());
if (isExportCompiledSketchSupported(compiledSketches, copyOfCompiledSketches)) {
System.err.println(_("Warning: This core does not support exporting sketches. Please consider upgrading it or contacting its author"));
System.err.println(tr("Warning: This core does not support exporting sketches. Please consider upgrading it or contacting its author"));
return;
}
@ -1396,7 +1396,7 @@ public class Compiler implements MessageConsumer {
headerOffset = preprocessor.writePrefix(bigCode.toString());
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
String msg = _("Build folder disappeared or could not be written");
String msg = tr("Build folder disappeared or could not be written");
throw new RunnerException(msg);
}
@ -1411,7 +1411,7 @@ public class Compiler implements MessageConsumer {
preprocessor.write(outputStream);
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
String msg = _("Build folder disappeared or could not be written");
String msg = tr("Build folder disappeared or could not be written");
throw new RunnerException(msg);
} catch (RunnerException pe) {
// RunnerExceptions are caught here and re-thrown, so that they don't
@ -1420,7 +1420,7 @@ public class Compiler implements MessageConsumer {
} catch (Exception ex) {
// TODO better method for handling this?
System.err.println(I18n.format(_("Uncaught exception type: {0}"), ex.getClass()));
System.err.println(I18n.format(tr("Uncaught exception type: {0}"), ex.getClass()));
ex.printStackTrace();
throw new RunnerException(ex.toString());
} finally {
@ -1458,7 +1458,7 @@ public class Compiler implements MessageConsumer {
BaseNoGui.saveFile(sc.getProgram(), new File(buildPath, filename));
} catch (IOException e) {
e.printStackTrace();
throw new RunnerException(I18n.format(_("Problem moving {0} to the build folder"), filename));
throw new RunnerException(I18n.format(tr("Problem moving {0} to the build folder"), filename));
}
} else if (sc.isExtension("ino") || sc.isExtension("pde")) {
@ -1485,7 +1485,7 @@ public class Compiler implements MessageConsumer {
Files.copy(pair.key, pair.value, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(I18n.format(_("Problem moving {0} to the build folder"), sketchPath.relativize(pair.key).toString()));
throw new RuntimeException(I18n.format(tr("Problem moving {0} to the build folder"), sketchPath.relativize(pair.key).toString()));
}
});
}

View File

@ -20,7 +20,7 @@
*/
package processing.app.debug;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.I18n.format;
import java.util.LinkedHashMap;
@ -59,7 +59,7 @@ public class LegacyTargetBoard implements TargetBoard {
board = board.toUpperCase();
prefs.put("build.board", board);
System.err
.println(format(_("Board {0}:{1}:{2} doesn''t define a ''build.board'' preference. Auto-set to: {3}"),
.println(format(tr("Board {0}:{1}:{2} doesn''t define a ''build.board'' preference. Auto-set to: {3}"),
containerPlatform.getContainerPackage().getId(),
containerPlatform.getId(), id, board));
}

View File

@ -20,7 +20,7 @@
*/
package processing.app.debug;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
import java.io.File;
@ -57,7 +57,7 @@ public class LegacyTargetPackage implements TargetPackage {
if (platforms.size() == 0) {
throw new TargetPlatformException(I18n
.format(_("No valid hardware definitions found in folder {0}."),
.format(tr("No valid hardware definitions found in folder {0}."),
_folder.getName()));
}
}

View File

@ -30,7 +30,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import static processing.app.I18n.format;
public class LegacyTargetPlatform implements TargetPlatform {
@ -65,7 +65,7 @@ public class LegacyTargetPlatform implements TargetPlatform {
File boardsFile = new File(folder, "boards.txt");
if (!boardsFile.exists() || !boardsFile.canRead())
throw new TargetPlatformException(
format(_("Could not find boards.txt in {0}. Is it pre-1.5?"),
format(tr("Could not find boards.txt in {0}. Is it pre-1.5?"),
folder.getAbsolutePath()));
// Load boards
@ -91,7 +91,7 @@ public class LegacyTargetPlatform implements TargetPlatform {
defaultBoard = board;
}
} catch (IOException e) {
throw new TargetPlatformException(format(_("Error loading {0}"),
throw new TargetPlatformException(format(tr("Error loading {0}"),
boardsFile.getAbsolutePath()), e);
}
@ -102,7 +102,7 @@ public class LegacyTargetPlatform implements TargetPlatform {
}
} catch (IOException e) {
throw new TargetPlatformException(
format(_("Error loading {0}"), platformsFile.getAbsolutePath()), e);
format(tr("Error loading {0}"), platformsFile.getAbsolutePath()), e);
}
// Allow overriding values in platform.txt. This allows changing
@ -116,7 +116,7 @@ public class LegacyTargetPlatform implements TargetPlatform {
}
} catch (IOException e) {
throw new TargetPlatformException(
format(_("Error loading {0}"), localPlatformsFile.getAbsolutePath()), e);
format(tr("Error loading {0}"), localPlatformsFile.getAbsolutePath()), e);
}
if (!preferences.containsKey("rewriting") || !"disabled".equals(preferences.get("rewriting"))) {
@ -135,7 +135,7 @@ public class LegacyTargetPlatform implements TargetPlatform {
programmers = prefs.firstLevelMap();
}
} catch (IOException e) {
throw new TargetPlatformException(format(_("Error loading {0}"),
throw new TargetPlatformException(format(tr("Error loading {0}"),
progFile.getAbsolutePath()), e);
}
}
@ -155,7 +155,7 @@ public class LegacyTargetPlatform implements TargetPlatform {
for (Map.Entry<String, String> entry : oldProps.entrySet()) {
String preferencesKey = entry.getKey().substring(entry.getKey().indexOf(".") + 1);
if (preferences.containsKey(preferencesKey) && entry.getValue().equals(preferences.get(preferencesKey))) {
System.err.println(I18n.format(_("Warning: platform.txt from core '{0}' contains deprecated {1}, automatically converted to {2}. Consider upgrading this core."), platformName, preferencesKey + "=" + entry.getValue(), preferencesKey + "=" + newProps.get(entry.getKey())));
System.err.println(I18n.format(tr("Warning: platform.txt from core '{0}' contains deprecated {1}, automatically converted to {2}. Consider upgrading this core."), platformName, preferencesKey + "=" + entry.getValue(), preferencesKey + "=" + newProps.get(entry.getKey())));
preferences.put(preferencesKey, newProps.get(entry.getKey()));
}
}
@ -167,7 +167,7 @@ public class LegacyTargetPlatform implements TargetPlatform {
String keyToAddFirstLevel = keyToAddParts[0];
String keyToAddSecondLevel = keyToAddParts[0] + "." + keyToAddParts[1];
if (!preferences.subTree(keyToAddFirstLevel).isEmpty() && !preferences.subTree(keyToAddSecondLevel).isEmpty() && !preferences.containsKey(keyToAdd)) {
System.err.println(I18n.format(_("Warning: platform.txt from core '{0}' misses property {1}, automatically set to {2}. Consider upgrading this core."), platformName, keyToAdd, entry.getValue()));
System.err.println(I18n.format(tr("Warning: platform.txt from core '{0}' misses property {1}, automatically set to {2}. Consider upgrading this core."), platformName, keyToAdd, entry.getValue()));
preferences.put(keyToAdd, entry.getValue());
}
}

View File

@ -1,6 +1,6 @@
package processing.app.helpers;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class BasicUserNotifier extends UserNotifier {
@ -10,7 +10,7 @@ public class BasicUserNotifier extends UserNotifier {
* for errors that allow P5 to continue running.
*/
public void showError(String title, String message, Throwable e, int exit_code) {
if (title == null) title = _("Error");
if (title == null) title = tr("Error");
System.err.println(title + ": " + message);
@ -19,7 +19,7 @@ public class BasicUserNotifier extends UserNotifier {
}
public void showMessage(String title, String message) {
if (title == null) title = _("Message");
if (title == null) title = tr("Message");
System.out.println(title + ": " + message);
}
@ -28,7 +28,7 @@ public class BasicUserNotifier extends UserNotifier {
* Non-fatal error message with optional stack trace side dish.
*/
public void showWarning(String title, String message, Exception e) {
if (title == null) title = _("Warning");
if (title == null) title = tr("Warning");
System.out.println(title + ": " + message);

View File

@ -11,7 +11,7 @@ import processing.app.legacy.PApplet;
import java.io.File;
import java.util.*;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
public class CommandlineParser {
@ -61,7 +61,7 @@ public class CommandlineParser {
if (action != ACTION.GUI && action != ACTION.NOOP) {
Set<String> strings = actions.keySet();
String[] valid = strings.toArray(new String[strings.size()]);
String mess = I18n.format(_("Can only pass one of: {0}"), PApplet.join(valid, ", "));
String mess = I18n.format(tr("Can only pass one of: {0}"), PApplet.join(valid, ", "));
BaseNoGui.showError(null, mess, 3);
}
if (a == ACTION.GET_PREF) {
@ -73,14 +73,14 @@ public class CommandlineParser {
if (a == ACTION.INSTALL_BOARD) {
i++;
if (i >= args.length) {
BaseNoGui.showError(null, I18n.format(_("Argument required for {0}"), a.value), 3);
BaseNoGui.showError(null, I18n.format(tr("Argument required for {0}"), a.value), 3);
}
boardToInstall = args[i];
}
if (a == ACTION.INSTALL_LIBRARY) {
i++;
if (i >= args.length) {
BaseNoGui.showError(null, I18n.format(_("Argument required for {0}"), a.value), 3);
BaseNoGui.showError(null, I18n.format(tr("Argument required for {0}"), a.value), 3);
}
libraryToInstall = args[i];
}
@ -131,7 +131,7 @@ public class CommandlineParser {
if (args[i].equals("--board")) {
i++;
if (i >= args.length)
BaseNoGui.showError(null, _("Argument required for --board"), 3);
BaseNoGui.showError(null, tr("Argument required for --board"), 3);
if (action == ACTION.GUI)
action = ACTION.NOOP;
continue;
@ -139,14 +139,14 @@ public class CommandlineParser {
if (args[i].equals("--port")) {
i++;
if (i >= args.length)
BaseNoGui.showError(null, _("Argument required for --port"), 3);
BaseNoGui.showError(null, tr("Argument required for --port"), 3);
BaseNoGui.selectSerialPort(args[i]);
if (action == ACTION.GUI)
action = ACTION.NOOP;
continue;
}
if (args[i].equals("--curdir")) {
BaseNoGui.showError(null, _("--curdir no longer supported"), 3);
BaseNoGui.showError(null, tr("--curdir no longer supported"), 3);
return;
}
if (args[i].equals("--buildpath")) {
@ -167,7 +167,7 @@ public class CommandlineParser {
if (args[i].equals("--pref")) {
i++;
if (i >= args.length)
BaseNoGui.showError(null, _("Argument required for --pref"), 3);
BaseNoGui.showError(null, tr("Argument required for --pref"), 3);
processPrefArgument(args[i]);
if (action == ACTION.GUI)
action = ACTION.NOOP;
@ -180,12 +180,12 @@ public class CommandlineParser {
if (args[i].equals("--preferences-file")) {
i++;
if (i >= args.length)
BaseNoGui.showError(null, _("Argument required for --preferences-file"), 3);
BaseNoGui.showError(null, tr("Argument required for --preferences-file"), 3);
// Argument should be already processed by Base.main(...)
continue;
}
if (args[i].startsWith("--"))
BaseNoGui.showError(null, I18n.format(_("unknown option: {0}"), args[i]), 3);
BaseNoGui.showError(null, I18n.format(tr("unknown option: {0}"), args[i]), 3);
filenames.add(args[i]);
}
@ -198,7 +198,7 @@ public class CommandlineParser {
if (args[i].equals("--board")) {
i++;
if (i >= args.length) {
BaseNoGui.showError(null, _("Argument required for --board"), 3);
BaseNoGui.showError(null, tr("Argument required for --board"), 3);
}
processBoardArgument(args[i]);
if (action == ACTION.GUI) {
@ -210,13 +210,13 @@ public class CommandlineParser {
private void checkAction() {
if ((action == ACTION.UPLOAD || action == ACTION.VERIFY) && filenames.size() != 1)
BaseNoGui.showError(null, _("Must specify exactly one sketch file"), 3);
BaseNoGui.showError(null, tr("Must specify exactly one sketch file"), 3);
if ((action == ACTION.NOOP || action == ACTION.GET_PREF) && filenames.size() != 0)
BaseNoGui.showError(null, _("Cannot specify any sketch files"), 3);
BaseNoGui.showError(null, tr("Cannot specify any sketch files"), 3);
if ((action != ACTION.UPLOAD && action != ACTION.VERIFY) && (doVerboseBuild || doVerboseUpload))
BaseNoGui.showError(null, _("--verbose, --verbose-upload and --verbose-build can only be used together with --verify or --upload"), 3);
BaseNoGui.showError(null, tr("--verbose, --verbose-upload and --verbose-build can only be used together with --verify or --upload"), 3);
}
private void processBoardArgument(String selectBoard) {
@ -227,24 +227,24 @@ public class CommandlineParser {
String[] split = selectBoard.split(":", 4);
if (split.length < 3) {
BaseNoGui.showError(null, I18n.format(_("{0}: Invalid board name, it should be of the form \"package:arch:board\" or \"package:arch:board:options\""), selectBoard), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Invalid board name, it should be of the form \"package:arch:board\" or \"package:arch:board:options\""), selectBoard), 3);
}
TargetPackage targetPackage = BaseNoGui.getTargetPackage(split[0]);
if (targetPackage == null) {
BaseNoGui.showError(null, I18n.format(_("{0}: Unknown package"), split[0]), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Unknown package"), split[0]), 3);
return;
}
TargetPlatform targetPlatform = targetPackage.get(split[1]);
if (targetPlatform == null) {
BaseNoGui.showError(null, I18n.format(_("{0}: Unknown architecture"), split[1]), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Unknown architecture"), split[1]), 3);
return;
}
TargetBoard targetBoard = targetPlatform.getBoard(split[2]);
if (targetBoard == null || !targetBoard.getId().equals(split[2])) {
BaseNoGui.showError(null, I18n.format(_("{0}: Unknown board"), split[2]), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Unknown board"), split[2]), 3);
return;
}
@ -256,14 +256,14 @@ public class CommandlineParser {
String[] keyValue = option.split("=", 2);
if (keyValue.length != 2)
BaseNoGui.showError(null, I18n.format(_("{0}: Invalid option, should be of the form \"name=value\""), option, targetBoard.getId()), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Invalid option, should be of the form \"name=value\""), option, targetBoard.getId()), 3);
String key = keyValue[0].trim();
String value = keyValue[1].trim();
if (!targetBoard.hasMenu(key))
BaseNoGui.showError(null, I18n.format(_("{0}: Invalid option for board \"{1}\""), key, targetBoard.getId()), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Invalid option for board \"{1}\""), key, targetBoard.getId()), 3);
if (targetBoard.getMenuLabel(key, value) == null)
BaseNoGui.showError(null, I18n.format(_("{0}: Invalid option for \"{1}\" option for board \"{2}\""), value, key, targetBoard.getId()), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Invalid option for \"{1}\" option for board \"{2}\""), value, key, targetBoard.getId()), 3);
PreferencesData.set("custom_" + key, targetBoard.getId() + "_" + value);
}
@ -273,7 +273,7 @@ public class CommandlineParser {
private void processPrefArgument(String arg) {
String[] split = arg.split("=", 2);
if (split.length != 2 || split[0].isEmpty())
BaseNoGui.showError(null, I18n.format(_("{0}: Invalid argument to --pref, should be of the form \"pref=value\""), arg), 3);
BaseNoGui.showError(null, I18n.format(tr("{0}: Invalid argument to --pref, should be of the form \"pref=value\""), arg), 3);
PreferencesData.set(split[0], split[1]);
}

View File

@ -22,7 +22,7 @@ catalog()
# The 'merge existing' option for xgetext does not work propery for our purpose.
find ../../../ -name '*.java' -print > "$files"
find ../../../../../app/src -name '*.java' -print >> "$files"
xgettext -s -L Java --from-code=utf-8 -k_ --output="$catalog" --files-from="$files"
xgettext -s -L Java --from-code=utf-8 --keyword=tr --output="$catalog" --files-from="$files"
}
update()

View File

@ -29,7 +29,7 @@
package processing.app.preproc;
import static processing.app.I18n._;
import static processing.app.I18n.tr;
import processing.app.*;
import processing.app.legacy.PApplet;
@ -423,7 +423,7 @@ public class PdePreprocessor {
}
}
if (!endOfRainbow) {
throw new RuntimeException(_("Missing the */ from the end of a " +
throw new RuntimeException(tr("Missing the */ from the end of a " +
"/* comment */"));
}
} else { // any old character, move along