Skip to content

Commit edb7073

Browse files
committed
makeup: call I18n.format using static imports in Base class
1 parent 6a1c1f4 commit edb7073

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

app/src/processing/app/Base.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public Base(String[] args) throws Exception {
464464
if (!parser.isForceSavePrefs())
465465
PreferencesData.setDoSave(true);
466466
if (handleOpen(file, retrieveSketchLocation(".default"), false) == null) {
467-
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
467+
String mess = format(tr("Failed to open sketch: \"{0}\""), path);
468468
// Open failure is fatal in upload/verify mode
469469
if (parser.isVerifyOrUploadMode())
470470
showError(null, mess, 2);
@@ -1126,7 +1126,7 @@ public void actionPerformed(ActionEvent e) {
11261126
importMenu.addSeparator();
11271127
}
11281128
lastLibType = libType;
1129-
JMenuItem platformItem = new JMenuItem(I18n.format(tr("{0} libraries"), tr(lastLibType)));
1129+
JMenuItem platformItem = new JMenuItem(format(tr("{0} libraries"), tr(lastLibType)));
11301130
platformItem.setEnabled(false);
11311131
importMenu.add(platformItem);
11321132
}
@@ -1137,7 +1137,7 @@ public void actionPerformed(ActionEvent event) {
11371137
try {
11381138
activeEditor.getSketchController().importLibrary(l);
11391139
} catch (IOException e) {
1140-
showWarning(tr("Error"), I18n.format("Unable to list header files in {0}", l.getSrcFolder()), e);
1140+
showWarning(tr("Error"), format("Unable to list header files in {0}", l.getSrcFolder()), e);
11411141
}
11421142
}
11431143
};
@@ -1269,7 +1269,7 @@ public void rebuildExamplesMenu(JMenu menu) {
12691269
if (!platformLibs.isEmpty()) {
12701270
menu.addSeparator();
12711271
platformLibs.sort();
1272-
label = new JMenuItem(I18n.format(tr("Examples for {0}"), boardId));
1272+
label = new JMenuItem(format(tr("Examples for {0}"), boardId));
12731273
label.setEnabled(false);
12741274
menu.add(label);
12751275
for (UserLibrary lib : platformLibs) {
@@ -1280,7 +1280,7 @@ public void rebuildExamplesMenu(JMenu menu) {
12801280
if (!referencedPlatformLibs.isEmpty()) {
12811281
menu.addSeparator();
12821282
referencedPlatformLibs.sort();
1283-
label = new JMenuItem(I18n.format(tr("Examples for {0}"), referencedPlatformName));
1283+
label = new JMenuItem(format(tr("Examples for {0}"), referencedPlatformName));
12841284
label.setEnabled(false);
12851285
menu.add(label);
12861286
for (UserLibrary lib : referencedPlatformLibs) {
@@ -1798,7 +1798,7 @@ public void actionPerformed(ActionEvent event) {
17981798
try {
17991799
activeEditor.getSketchController().importLibrary(l);
18001800
} catch (IOException e) {
1801-
showWarning(tr("Error"), I18n.format("Unable to list header files in {0}", l.getSrcFolder()), e);
1801+
showWarning(tr("Error"), format("Unable to list header files in {0}", l.getSrcFolder()), e);
18021802
}
18031803
}
18041804
};
@@ -1948,10 +1948,9 @@ static protected File promptSketchbookLocation() {
19481948
static public void openURL(String url) {
19491949
try {
19501950
BaseNoGui.getPlatform().openURL(url);
1951-
19521951
} catch (Exception e) {
19531952
showWarning(tr("Problem Opening URL"),
1954-
I18n.format(tr("Could not open the URL\n{0}"), url), e);
1953+
format(tr("Could not open the URL\n{0}"), url), e);
19551954
}
19561955
}
19571956

@@ -1973,10 +1972,9 @@ static protected boolean openFolderAvailable() {
19731972
static public void openFolder(File file) {
19741973
try {
19751974
BaseNoGui.getPlatform().openFolder(file);
1976-
19771975
} catch (Exception e) {
19781976
showWarning(tr("Problem Opening Folder"),
1979-
I18n.format(tr("Could not open the folder\n{0}"), file.getAbsolutePath()), e);
1977+
format(tr("Could not open the folder\n{0}"), file.getAbsolutePath()), e);
19801978
}
19811979
}
19821980

@@ -2054,7 +2052,7 @@ static public void showReference(String prefix, String filename) {
20542052
if(referenceFile.exists()){
20552053
openURL(referenceFile.getAbsolutePath());
20562054
}else{
2057-
showWarning(tr("Problem Opening URL"), I18n.format(tr("Could not open the URL\n{0}"), referenceFile), null);
2055+
showWarning(tr("Problem Opening URL"), format(tr("Could not open the URL\n{0}"), referenceFile), null);
20582056
}
20592057
}
20602058

@@ -2310,7 +2308,7 @@ public void handleAddLibrary() {
23102308

23112309
String libName = libFolder.getName();
23122310
if (!BaseNoGui.isSanitaryName(libName)) {
2313-
String mess = I18n.format(tr("The library \"{0}\" cannot be used.\n"
2311+
String mess = format(tr("The library \"{0}\" cannot be used.\n"
23142312
+ "Library names must contain only basic letters and numbers.\n"
23152313
+ "(ASCII only and no spaces, and it cannot start with a number)"),
23162314
libName);
@@ -2334,7 +2332,7 @@ public void handleAddLibrary() {
23342332
// copy folder
23352333
File destinationFolder = new File(BaseNoGui.getSketchbookLibrariesFolder().folder, sourceFile.getName());
23362334
if (!destinationFolder.mkdir()) {
2337-
activeEditor.statusError(I18n.format(tr("A library named {0} already exists"), sourceFile.getName()));
2335+
activeEditor.statusError(format(tr("A library named {0} already exists"), sourceFile.getName()));
23382336
return;
23392337
}
23402338
try {

0 commit comments

Comments
 (0)