Merge branch 'master' of github.com:processing/processing

This commit is contained in:
Ben Fry
2015-06-18 08:51:17 -04:00
5 changed files with 118 additions and 75 deletions
+62 -65
View File
@@ -450,17 +450,17 @@ public class Sketch {
}
if (newName.startsWith(".")) {
Base.showWarning("Problem with rename",
"The name cannot start with a period.");
Base.showWarning(Language.text("name.messages.problem_renaming"),
Language.text("name.messages.starts_with_dot.description"));
return;
}
int dot = newName.lastIndexOf('.');
String newExtension = newName.substring(dot+1).toLowerCase();
if (!mode.validExtension(newExtension)) {
Base.showWarning("Problem with rename",
"\"." + newExtension + "\"" +
"is not a valid extension.");
Base.showWarning(Language.text("name.messages.problem_renaming"),
Language.interpolate("name.messages.invalid_extension.description",
newExtension));
return;
}
@@ -468,10 +468,9 @@ public class Sketch {
if (!mode.isDefaultExtension(newExtension)) {
if (renamingCode) { // If creating a new tab, don't show this error
if (current == code[0]) { // If this is the main tab, disallow
Base.showWarning("Problem with rename",
"The first tab cannot be a ." + newExtension + " file.\n" +
"(It may be time for you to graduate to a\n" +
"\"real\" programming environment, hotshot.)");
Base.showWarning(Language.text("name.messages.problem_renaming"),
Language.interpolate("name.messages.main_java_extension.description",
newExtension));
return;
}
}
@@ -495,9 +494,9 @@ public class Sketch {
// http://processing.org/bugs/bugzilla/543.html
for (SketchCode c : code) {
if (c != current && sanitaryName.equalsIgnoreCase(c.getPrettyName())) {
Base.showMessage("Nope",
"A file named \"" + c.getFileName() + "\" already exists at\n" +
"\"" + folder.getAbsolutePath() + "\"");
Base.showMessage(Language.text("name.messages.new_sketch_exists"),
Language.interpolate("name.messages.new_sketch_exists.description",
c.getFileName(), folder.getAbsolutePath()));
return;
}
}
@@ -511,16 +510,17 @@ public class Sketch {
String folderName = newName.substring(0, newName.indexOf('.'));
File newFolder = new File(folder.getParentFile(), folderName);
if (newFolder.exists()) {
Base.showWarning("Cannot Rename",
"Sorry, a sketch (or folder) named " +
"\"" + newName + "\" already exists.");
Base.showWarning(Language.text("name.messages.new_folder_exists"),
Language.interpolate("name.messages.new_folder_exists.description",
newName));
return;
}
// renaming the containing sketch folder
boolean success = folder.renameTo(newFolder);
if (!success) {
Base.showWarning("Error", "Could not rename the sketch folder.");
Base.showWarning(Language.text("name.messages.error"),
Language.text("name.messages.no_rename_folder.description"));
return;
}
// let this guy know where he's living (at least for a split second)
@@ -540,9 +540,9 @@ public class Sketch {
// This isn't changing folders, just changes the name
newFile = new File(newFolder, newName);
if (!current.renameTo(newFile, newExtension)) {
Base.showWarning("Error",
"Could not rename \"" + current.getFileName() +
"\" to \"" + newFile.getName() + "\"");
Base.showWarning(Language.text("name.messages.error"),
Language.interpolate("name.messages.no_rename_file.description",
current.getFileName(), newFile.getName()));
return;
}
@@ -572,9 +572,9 @@ public class Sketch {
} else { // else if something besides code[0]
if (!current.renameTo(newFile, newExtension)) {
Base.showWarning("Error",
"Could not rename \"" + current.getFileName() +
"\" to \"" + newFile.getName() + "\"");
Base.showWarning(Language.text("name.messages.error"),
Language.interpolate("name.messages.no_rename_file.description",
current.getFileName(), newFile.getName()));
return;
}
}
@@ -586,9 +586,10 @@ public class Sketch {
throw new IOException("createNewFile() returned false");
}
} catch (IOException e) {
Base.showWarning("Error",
"Could not create the file \"" + newFile + "\"\n" +
"in \"" + folder.getAbsolutePath() + "\"", e);
Base.showWarning(Language.text("name.messages.error"),
Language.interpolate("name.messages.no_create_file.description",
newFile, folder.getAbsolutePath()),
e);
return;
}
SketchCode newCode = new SketchCode(newFile, newExtension);
@@ -771,9 +772,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" +
"need to re-save this sketch to another location.");
Base.showMessage(Language.text("save_file.messages.is_read_only"),
Language.text("save_file.messages.is_read_only.description"));
// if the user cancels, give up on the save()
if (!saveAs()) return false;
}
@@ -846,9 +846,9 @@ public class Sketch {
String sanitaryName = Sketch.checkName(newName);
File newFolder = new File(newParentDir, sanitaryName);
if (!sanitaryName.equals(newName) && newFolder.exists()) {
Base.showMessage("Cannot Save",
"A sketch with the cleaned name\n" +
"" + sanitaryName + "” already exists.");
Base.showMessage(Language.text("save_file.messages.sketch_exists"),
Language.interpolate("save_file.messages.sketch_exists.description",
sanitaryName));
return false;
}
newName = sanitaryName;
@@ -865,9 +865,9 @@ public class Sketch {
// resaved (with the same name) to another location/folder.
for (int i = 1; i < codeCount; i++) {
if (newName.equalsIgnoreCase(code[i].getPrettyName())) {
Base.showMessage("Nope",
"You can't save the sketch as \"" + newName + "\"\n" +
"because the sketch already has a tab with that name.");
Base.showMessage(Language.text("save_file.messages.tab_exists"),
Language.interpolate("save_file.messages.tab_exists.description",
newName));
return false;
}
}
@@ -885,9 +885,9 @@ public class Sketch {
String oldPath = folder.getCanonicalPath() + File.separator;
if (newPath.indexOf(oldPath) == 0) {
Base.showWarning("How very Borges of you",
"You cannot save the sketch into a folder\n" +
"inside itself. This would go on forever.", null);
Base.showWarning(Language.text("save_file.messages.recursive_save"),
Language.text("save_file.messages.recursive_save.description"),
null);
return false;
}
} catch (IOException e) { }
@@ -1022,10 +1022,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" +
"need to re-save the sketch in another location,\n" +
"and try again.");
Base.showMessage(Language.text("add_file.messages.is_read_only"),
Language.text("add_file.messages.is_read_only.description"));
return;
}
@@ -1101,7 +1099,8 @@ public class Sketch {
// check whether this file already exists
if (destFile.exists()) {
Object[] options = { Language.text("prompt.ok"), Language.text("prompt.cancel") };
String prompt = "Replace the existing version of " + filename + "?";
String prompt = Language.interpolate("add_file.messages.confirm_replace",
filename);
int result = JOptionPane.showOptionDialog(editor,
prompt,
"Replace",
@@ -1123,19 +1122,19 @@ public class Sketch {
if (replacement) {
boolean muchSuccess = destFile.delete();
if (!muchSuccess) {
Base.showWarning("Error adding file",
"Could not delete the existing '" +
filename + "' file.", null);
Base.showWarning(Language.text("add_file.messages.error_adding"),
Language.interpolate("add_file.messages.cannot_delete.description",
filename),
null);
return false;
}
}
// 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" +
"location from which where you're trying to add it.\n" +
"I ain't not doin nuthin'.", null);
Base.showWarning(Language.text("add_file.messages.same_file"),
Language.text("add_file.messages.same_file.description"),
null);
return false;
}
@@ -1149,8 +1148,10 @@ public class Sketch {
Base.copyFile(sourceFile, destFile);
} catch (IOException e) {
Base.showWarning("Error adding file",
"Could not add '" + filename + "' to the sketch.", e);
Base.showWarning(Language.text("add_file.messages.error_adding"),
Language.interpolate("add_file.messages.cannot_add.description",
filename),
e);
return false;
}
}
@@ -1250,8 +1251,9 @@ public class Sketch {
// "Could not create a place to build the sketch.", null);
// }
} catch (IOException e) {
Base.showWarning("Build folder bad",
"Could not find a place to build the sketch.", e);
Base.showWarning(Language.text("temp_dir.messages.bad_build_folder"),
Language.text("temp_dir.messages.bad_build_folder.description"),
e);
}
return null;
}
@@ -1307,10 +1309,9 @@ public class Sketch {
public void ensureExistence() {
if (!folder.exists()) {
// Disaster recovery, try to salvage what's there already.
Base.showWarning("Sketch Disappeared",
"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);
Base.showWarning(Language.text("ensure_exist.messages.missing_sketch"),
Language.text("ensure_exist.messages.missing_sketch.description"),
null);
try {
folder.mkdirs();
modified = true;
@@ -1321,11 +1322,9 @@ public class Sketch {
calcModified();
} catch (Exception e) {
Base.showWarning("Could not re-save sketch",
"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);
Base.showWarning(Language.text("ensure_exist.messages.unrecoverable"),
Language.text("ensure_exist.messages.unrecoverable.description"),
e);
}
}
}
@@ -1526,9 +1525,7 @@ public class Sketch {
if (!newName.equals(origName)) {
String msg =
"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.";
Language.text("check_name.messages.is_name_modified");
System.out.println(msg);
}
return newName;
+49 -3
View File
@@ -369,14 +369,28 @@ editor.footer.console = Console
# New handler
new.messages.is_read_only = Sketch is Read-Only
new.messages.is_read_only.description = Some files are marked \"read-only\", so you will\nneed to re-save the sketch in another location,\nand try again.
new.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again.
# Rename handler
rename.messages.is_untitled = Sketch is Untitled
rename.messages.is_untitled.description = How about saving the sketch first\nbefore trying to rename it?
rename.messages.is_modified = Please save the sketch before renaming.
rename.messages.is_read_only = Sketch is Read-Only
rename.messages.is_read_only.description = Some files are marked \"read-only\", so you will\nneed to re-save the sketch in another location,\nand try again.
rename.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again.
# Naming handler
name.messages.problem_renaming = Problem with rename
name.messages.starts_with_dot.description = The name cannot start with a period.
name.messages.invalid_extension.description = ".%s" is not a valid extension.
name.messages.main_java_extension.description = The first tab cannot be a .%s file.\n(It may be time for you to graduate to a\n"real" programming environment, hotshot.)
name.messages.new_sketch_exists = Nope
name.messages.new_sketch_exists.description = A file named "%s" already exists at\n"%s"
name.messages.new_folder_exists = Cannot Rename
name.messages.new_folder_exists.description = Sorry, a sketch (or folder) named "%s" already exists.
name.messages.error = Error
name.messages.no_rename_folder.description = Could not rename the sketch folder.
name.messages.no_rename_file.description = Could not rename "%s" to "%s"
name.messages.no_create_file.description = Could not create the file "%s"\nin "%s"
# Delete handler
delete.messages.cannot_delete = Cannot Delete
@@ -384,8 +398,40 @@ delete.messages.cannot_delete.description = You cannot delete a sketch that has
delete.messages.cannot_delete.file = Could not do it
delete.messages.cannot_delete.file.description = Could not delete
delete.messages.is_read_only = Sketch is Read-Only
delete.messages.is_read_only.description = Some files are marked \"read-only\", so you will\nneed to re-save the sketch in another location,\nand try again.
delete.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again.
# Save handler
save_file.messages.is_read_only = Sketch is read-only
save_file.messages.is_read_only.description = Some files are marked "read-only", so you'll\n need to re-save this sketch to another location.
save_file.messages.sketch_exists = Cannot Save
save_file.messages.sketch_exists.description = A sketch with the cleaned name\n“%s” already exists.
save_file.messages.tab_exists = Nope
save_file.messages.tab_exists.description = You can't save the sketch as "%s"\nbecause the sketch already has a tab with that name.
save_file.messages.recursive_save = How very Borges of you
save_file.messages.recursive_save.description = You cannot save the sketch into a folder\ninside itself. This would go on forever.
# Add handler
add_file.messages.is_read_only = Sketch is Read-Only
add_file.messages.is_read_only.description = Some files are marked "read-only", so you'll\nneed to re-save the sketch in another location,\nand try again.
add_file.messages.confirm_replace = Replace the existing version of %s?
add_file.messages.error_adding = Error adding file
add_file.messages.cannot_delete.description = Could not delete the existing '%s' file.
add_file.messages.cannot_add.description = Could not add '%s' to the sketch.
add_file.messages.same_file = You can't fool me
add_file.messages.same_file.description = This file has already been copied to the\nlocation from which where you're trying to add it.\nI ain't not doin nuthin'.
# Temp folder creator
temp_dir.messages.bad_build_folder = Build folder bad
temp_dir.messages.bad_build_folder.description = Could not find a place to build the sketch.
# Ensure Existance
ensure_exist.messages.missing_sketch = Sketch Disappeared
ensure_exist.messages.missing_sketch.description = The sketch folder has disappeared.\nWill attempt to re-save in the same location,\nbut anything besides the code will be lost.
ensure_exist.messages.unrecoverable = Could not re-save sketch
ensure_exist.messages.unrecoverable.description = Could not properly re-save the sketch. You may be in trouble at this point,\nand it might be time to copy and paste your code to another text editor.
# Check name
check_name.messages.is_name_modified = The sketch name had to be modified. Sketch names can only consist\nof ASCII characters and numbers (but cannot start with a number).\nThey should also be less than 64 characters long.
# ---------------------------------------
# Contributions
+3 -3
View File
@@ -307,14 +307,14 @@ editor.footer.console = Konsole
# New handler
new.messages.is_read_only = Sketch ist Read-Only
new.messages.is_read_only.description = Einige Dateien sind als \"read-only\" markiert,\naus dem Grund musst du das Sketch an einer neuer\nStelle abspeichern, und es noch mal ausprobieren.
new.messages.is_read_only.description = Einige Dateien sind als "read-only" markiert,\naus dem Grund musst du das Sketch an einer neuer\nStelle abspeichern, und es noch mal ausprobieren.
# Rename handler
rename.messages.is_untitled = Unbenennen abgebrochen
rename.messages.is_untitled.description = Sketch muss zuvor abgespeichert werden\nbevor es unbenannt werden kann.
rename.messages.is_modified = Speichere Sketch vor dem Umbenennen.
rename.messages.is_read_only = Sketch ist Read-Only
rename.messages.is_read_only.description = Einige Dateien sind als \"read-only\" markiert,\naus dem Grund musst du das Sketch an einer neuer\nStelle abspeichern, und es noch mal ausprobieren.
rename.messages.is_read_only.description = Einige Dateien sind als "read-only" markiert,\naus dem Grund musst du das Sketch an einer neuer\nStelle abspeichern, und es noch mal ausprobieren.
# Delete handler
delete.messages.cannot_delete = Löschen abgebrochen
@@ -322,7 +322,7 @@ delete.messages.cannot_delete.description = Ein Sketch muss zuvor abgespeichert
delete.messages.cannot_delete.file = Löschen nicht möglich
delete.messages.cannot_delete.file.description = Konnte nicht gelöscht werden.
delete.messages.is_read_only = Sketch ist Read-Only
delete.messages.is_read_only.description = Einige Dateien sind als \"read-only\" markiert,\naus dem Grund musst du das Sketch an einer neuer\nStelle abspeichern, und es noch mal ausprobieren.
delete.messages.is_read_only.description = Einige Dateien sind als "read-only" markiert,\naus dem Grund musst du das Sketch an einer neuer\nStelle abspeichern, und es noch mal ausprobieren.
# ---------------------------------------
+3 -3
View File
@@ -373,14 +373,14 @@ editor.footer.console = Κονσόλα
# New handler
new.messages.is_read_only = Το Σχέδιο είναι Μόνο για Ανάγνωση
new.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα \"Μόνο για Ανάγνωση\", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά.
new.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα "Μόνο για Ανάγνωση", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά.
# Rename handler
rename.messages.is_untitled = Το Σχέδιο Δεν έχει Τίτλο
rename.messages.is_untitled.description = Τι θα έλεγες να αποθηκεύσεις το Σχέδιο\nπριν προσπαθήσεις να το μετονομάσεις;
rename.messages.is_modified = Παρακαλώ αποθήκευσε το Σχέδιο πριν το μετονομάσεις.
rename.messages.is_read_only = Το Σχέδιο είναι Μόνο για Ανάγνωση
rename.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα \"Μόνο για Ανάγνωση\", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά.
rename.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα "Μόνο για Ανάγνωση", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά.
# Delete handler
delete.messages.cannot_delete = Αποτυχία Διαγραφής
@@ -388,7 +388,7 @@ delete.messages.cannot_delete.description = Δε μπορείς να διαγρ
delete.messages.cannot_delete.file = Δεν τα κατάφερα
delete.messages.cannot_delete.file.description = Η διαγραφή δεν έγινε
delete.messages.is_read_only = Το Σχέδιο είναι Μόνο για Ανάγνωση
delete.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα \"Μόνο για Ανάγνωση\", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά.
delete.messages.is_read_only.description = Μερικά αρχεία είναι σημειωμένα "Μόνο για Ανάγνωση", οπότε θα χρειαστεί να ξανα-αποθηκεύσεις το Σχέδιο σε διαφορετική θέση,\nκαι να προσπαθήσεις ξανά.
# ---------------------------------------
+1 -1
View File
@@ -339,7 +339,7 @@ delete.messages.cannot_delete.description = No puede eliminar un sketch que no h
delete.messages.cannot_delete.file = No se puede eliminar
delete.messages.cannot_delete.file.description = No se puede eliminar el archivo.
delete.messages.is_read_only = El sketch es de sólo lectura
delete.messages.is_read_only.description = Some files are marked \"read-only\", so you will\nneed to re-save the sketch in another location,\nand try again.
delete.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again.
# ---------------------------------------