FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

looking into possibility of i18n/l10n of the PDE · GoToLoop/processing@42d9e66 · GitHub

Repository navigation

Commit 42d9e66

Browse files
committed
looking into possibility of i18n/l10n of the PDE
1 parent d112922 commit 42d9e66

6 files changed

Lines changed: 122 additions & 113 deletions

File tree

‎app/src/processing/app/About.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public About(Frame frame) {
2222
super(frame);
2323

2424
if (Toolkit.highResDisplay()) {
25-
image = Toolkit.getLibImage("about-2x.jpg");
25+
image = Toolkit.getLibImage("about-2x.jpg"); //$NON-NLS-1$
2626
width = image.getWidth(null) / 2;
2727
height = image.getHeight(null) / 2;
2828
} else {
29-
image = Toolkit.getLibImage("about.jpg");
29+
image = Toolkit.getLibImage("about.jpg"); //$NON-NLS-1$
3030
width = image.getWidth(null);
3131
height = image.getHeight(null);
3232
}
@@ -50,7 +50,7 @@ public void paint(Graphics g) {
5050
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
5151
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
5252

53-
g.setFont(new Font("SansSerif", Font.PLAIN, 11));
53+
g.setFont(new Font("SansSerif", Font.PLAIN, 11)); //$NON-NLS-1$
5454
g.setColor(Color.white);
5555
g.drawString(Base.VERSION_NAME, 50, 30);
5656
}

‎app/src/processing/app/Base.java‎

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
public class Base {
4747
static public final int REVISION = 217;
4848
/** This might be replaced by main() if there's a lib/version.txt file. */
49-
static public String VERSION_NAME = "0217";
49+
static public String VERSION_NAME = "0217"; //$NON-NLS-1$
5050
/** Set true if this a proper release rather than a numbered revision. */
5151
static public boolean RELEASE = false;
5252

@@ -57,31 +57,31 @@ public class Base {
5757
static HashMap<Integer, String> platformNames =
5858
new HashMap<Integer, String>();
5959
static {
60-
platformNames.put(PConstants.WINDOWS, "windows");
61-
platformNames.put(PConstants.MACOSX, "macosx");
62-
platformNames.put(PConstants.LINUX, "linux");
60+
platformNames.put(PConstants.WINDOWS, "windows"); //$NON-NLS-1$
61+
platformNames.put(PConstants.MACOSX, "macosx"); //$NON-NLS-1$
62+
platformNames.put(PConstants.LINUX, "linux"); //$NON-NLS-1$
6363
}
6464

6565
static HashMap<String, Integer> platformIndices = new HashMap<String, Integer>();
6666
static {
67-
platformIndices.put("windows", PConstants.WINDOWS);
68-
platformIndices.put("macosx", PConstants.MACOSX);
69-
platformIndices.put("linux", PConstants.LINUX);
67+
platformIndices.put("windows", PConstants.WINDOWS); //$NON-NLS-1$
68+
platformIndices.put("macosx", PConstants.MACOSX); //$NON-NLS-1$
69+
platformIndices.put("linux", PConstants.LINUX); //$NON-NLS-1$
7070
}
7171
static Platform platform;
7272

7373
/** How many bits this machine is */
7474
static int nativeBits;
7575
static {
7676
nativeBits = 32; // perhaps start with 32
77-
String bits = System.getProperty("sun.arch.data.model");
77+
String bits = System.getProperty("sun.arch.data.model"); //$NON-NLS-1$
7878
if (bits != null) {
79-
if (bits.equals("64")) {
79+
if (bits.equals("64")) { //$NON-NLS-1$
8080
nativeBits = 64;
8181
}
8282
} else {
8383
// if some other strange vm, maybe try this instead
84-
if (System.getProperty("java.vm.name").contains("64")) {
84+
if (System.getProperty("java.vm.name").contains("64")) { //$NON-NLS-1$ //$NON-NLS-2$
8585
nativeBits = 64;
8686
}
8787
}
@@ -142,7 +142,7 @@ public void run() {
142142

143143
static private void createAndShowGUI(String[] args) {
144144
try {
145-
File versionFile = getContentFile("lib/version.txt");
145+
File versionFile = getContentFile("lib/version.txt"); //$NON-NLS-1$
146146
if (versionFile.exists()) {
147147
String version = PApplet.loadStrings(versionFile)[0];
148148
if (!version.equals(VERSION_NAME)) {
@@ -179,10 +179,10 @@ static private void createAndShowGUI(String[] args) {
179179
try {
180180
platform.setLookAndFeel();
181181
} catch (Exception e) {
182-
String mess = e.getMessage();
183-
if (!mess.contains("ch.randelshofer.quaqua.QuaquaLookAndFeel")) {
184-
log("Could not set the Look & Feel", e);
185-
}
182+
// String mess = e.getMessage();
183+
// if (!mess.contains("ch.randelshofer.quaqua.QuaquaLookAndFeel")) {
184+
log("Could not set the Look & Feel", e); //$NON-NLS-1$
185+
// }
186186
}
187187

188188
// Create a location for untitled sketches
@@ -195,11 +195,11 @@ static private void createAndShowGUI(String[] args) {
195195
"That's gonna prevent us from continuing.", e);
196196
}
197197

198-
log("about to create base...");
198+
log("about to create base..."); //$NON-NLS-1$
199199
Base base = new Base(args);
200200
// Prevent more than one copy of the PDE from running.
201201
SingleInstance.startServer(base);
202-
log("done creating base...");
202+
log("done creating base..."); //$NON-NLS-1$
203203
}
204204
}
205205

@@ -216,13 +216,13 @@ static protected boolean isCommandLine() {
216216

217217
static public void initPlatform() {
218218
try {
219-
Class<?> platformClass = Class.forName("processing.app.Platform");
219+
Class<?> platformClass = Class.forName("processing.app.Platform"); //$NON-NLS-1$
220220
if (Base.isMacOS()) {
221-
platformClass = Class.forName("processing.app.macosx.Platform");
221+
platformClass = Class.forName("processing.app.macosx.Platform"); //$NON-NLS-1$
222222
} else if (Base.isWindows()) {
223-
platformClass = Class.forName("processing.app.windows.Platform");
223+
platformClass = Class.forName("processing.app.windows.Platform"); //$NON-NLS-1$
224224
} else if (Base.isLinux()) {
225-
platformClass = Class.forName("processing.app.linux.Platform");
225+
platformClass = Class.forName("processing.app.linux.Platform"); //$NON-NLS-1$
226226
}
227227
platform = (Platform) platformClass.newInstance();
228228
} catch (Exception e) {
@@ -235,7 +235,7 @@ static public void initPlatform() {
235235

236236
public static void initRequirements() {
237237
try {
238-
Class.forName("com.sun.jdi.VirtualMachine");
238+
Class.forName("com.sun.jdi.VirtualMachine"); //$NON-NLS-1$
239239
} catch (ClassNotFoundException cnfe) {
240240
//String cp = System.getProperty("java.class.path").replace(File.pathSeparatorChar, '\n');
241241
// String cp = System.getProperty("sun.boot.class.path").replace(File.pathSeparatorChar, '\n');
@@ -268,8 +268,8 @@ private void buildCoreModes() {
268268
// ModeContribution.getCoreMode(this, "processing.mode.javascript.JavaScriptMode",
269269
// getContentFile("modes/javascript"));
270270
Mode javaMode =
271-
ModeContribution.load(this, getContentFile("modes/java"),
272-
"processing.mode.java.JavaMode").getMode();
271+
ModeContribution.load(this, getContentFile("modes/java"), //$NON-NLS-1$
272+
"processing.mode.java.JavaMode").getMode(); //$NON-NLS-1$
273273
// Mode androidMode =
274274
// ModeContribution.load(this, getContentFile("modes/android"),
275275
// "processing.mode.android.AndroidMode").getMode();
@@ -284,8 +284,8 @@ private void buildCoreModes() {
284284
// try {
285285
// Class.forName("processing.mode.java2.DebugMode");
286286
ModeContribution experimentalContrib =
287-
ModeContribution.load(this, getContentFile("modes/experimental"),
288-
"processing.mode.experimental.ExperimentalMode");
287+
ModeContribution.load(this, getContentFile("modes/experimental"), //$NON-NLS-1$
288+
"processing.mode.experimental.ExperimentalMode"); //$NON-NLS-1$
289289
if (experimentalContrib != null) {
290290
Mode experimentalMode = experimentalContrib.getMode();
291291
//coreModes = new Mode[] { javaMode, androidMode, experimentalMode };
@@ -345,20 +345,20 @@ public Base(String[] args) {
345345
// marked as an example.
346346
recent = new Recent(this);
347347

348-
String lastModeIdentifier = Preferences.get("last.sketch.mode");
348+
String lastModeIdentifier = Preferences.get("last.sketch.mode"); //$NON-NLS-1$
349349
if (lastModeIdentifier == null) {
350350
nextMode = coreModes[0];
351-
log("Nothing set for last.sketch.mode, using coreMode[0].");
351+
log("Nothing set for last.sketch.mode, using coreMode[0]."); //$NON-NLS-1$
352352
} else {
353353
for (Mode m : getModeList()) {
354354
if (m.getIdentifier().equals(lastModeIdentifier)) {
355-
log("Setting next mode to " + lastModeIdentifier);
355+
log("Setting next mode to " + lastModeIdentifier); //$NON-NLS-1$
356356
nextMode = m;
357357
}
358358
}
359359
if (nextMode == null) {
360360
nextMode = coreModes[0];
361-
log("Could not find mode " + lastModeIdentifier + ", using default.");
361+
logf("Could not find mode {0}, using default.", lastModeIdentifier); //$NON-NLS-1$
362362
}
363363
}
364364

@@ -413,7 +413,7 @@ public Base(String[] args) {
413413
}
414414

415415
// check for updates
416-
if (Preferences.getBoolean("update.check")) {
416+
if (Preferences.getBoolean("update.check")) { //$NON-NLS-1$
417417
new UpdateCheck(this);
418418
}
419419
}
@@ -601,13 +601,13 @@ protected void changeMode(Mode mode) {
601601
boolean wasUntitled = sketch.isUntitled();
602602

603603
// save a mode file into this sketch folder
604-
File sketchProps = new File(sketch.getFolder(), "sketch.properties");
604+
File sketchProps = new File(sketch.getFolder(), "sketch.properties"); //$NON-NLS-1$
605605
try {
606606
Settings props = new Settings(sketchProps);
607607
// Include the pretty name for error messages to show the user
608-
props.set("mode", mode.getTitle());
608+
props.set("mode", mode.getTitle()); //$NON-NLS-1$
609609
// Actual identifier to be used to resurrect the mode
610-
props.set("mode.id", mode.getIdentifier());
610+
props.set("mode.id", mode.getIdentifier()); //$NON-NLS-1$
611611
props.save();
612612
} catch (IOException e) {
613613
e.printStackTrace();
@@ -661,7 +661,7 @@ protected void handleActivated(Editor whichEditor) {
661661

662662
// make this the next mode to be loaded
663663
nextMode = whichEditor.getMode();
664-
Preferences.set("last.sketch.mode", nextMode.getIdentifier());
664+
Preferences.set("last.sketch.mode", nextMode.getIdentifier()); //$NON-NLS-1$
665665
}
666666

667667

@@ -735,7 +735,7 @@ public void handleNew() {
735735

736736
// Make an empty pde file
737737
File newbieFile =
738-
new File(newbieDir, newbieName + "." + nextMode.getDefaultExtension());
738+
new File(newbieDir, newbieName + "." + nextMode.getDefaultExtension()); //$NON-NLS-1$
739739
if (!newbieFile.createNewFile()) {
740740
throw new IOException(newbieFile + " already exists.");
741741
}
@@ -812,7 +812,7 @@ public void handleOpenPrompt() {
812812
}
813813

814814
final String prompt = "Open a Processing sketch...";
815-
if (Preferences.getBoolean("chooser.files.native")) { // don't use native dialogs on Linux
815+
if (Preferences.getBoolean("chooser.files.native")) { // don't use native dialogs on Linux //$NON-NLS-1$
816816
// get the front-most window frame for placing file dialog
817817
FileDialog fd = new FileDialog(activeEditor, prompt, FileDialog.LOAD);
818818

@@ -821,7 +821,7 @@ public void handleOpenPrompt() {
821821
public boolean accept(File dir, String name) {
822822
// confirmed to be working properly [fry 110128]
823823
for (String ext : extensions) {
824-
if (name.toLowerCase().endsWith("." + ext)) {
824+
if (name.toLowerCase().endsWith("." + ext)) { //$NON-NLS-1$
825825
return true;
826826
}
827827
}
@@ -851,7 +851,7 @@ public boolean accept(File file) {
851851
return true;
852852
}
853853
for (String ext : extensions) {
854-
if (file.getName().toLowerCase().endsWith("." + ext)) {
854+
if (file.getName().toLowerCase().endsWith("." + ext)) { //$NON-NLS-1$
855855
return true;
856856
}
857857
}
@@ -932,11 +932,11 @@ protected Editor handleOpen(String path, boolean untitled, EditorState state) {
932932
// Mode nextMode = nextEditorMode();
933933
try {
934934
File sketchFolder = new File(path).getParentFile();
935-
File sketchProps = new File(sketchFolder, "sketch.properties");
935+
File sketchProps = new File(sketchFolder, "sketch.properties"); //$NON-NLS-1$
936936
if (sketchProps.exists()) {
937937
Settings props = new Settings(sketchProps);
938-
String modeTitle = props.get("mode");
939-
String modeIdentifier = props.get("mode.id");
938+
String modeTitle = props.get("mode"); //$NON-NLS-1$
939+
String modeIdentifier = props.get("mode.id"); //$NON-NLS-1$
940940
if (modeTitle != null && modeIdentifier != null) {
941941
// nextMode = findMode(modeTitle);
942942
Mode mode = findMode(modeIdentifier);
@@ -1060,8 +1060,8 @@ public boolean handleClose(Editor editor, boolean modeSwitch) {
10601060
}
10611061
}
10621062

1063-
Preferences.unset("server.port");
1064-
Preferences.unset("server.key");
1063+
Preferences.unset("server.port"); //$NON-NLS-1$
1064+
Preferences.unset("server.key"); //$NON-NLS-1$
10651065

10661066
// This will store the sketch count as zero
10671067
editors.remove(editor);
@@ -1471,7 +1471,7 @@ protected boolean addSketches(DefaultMutableTreeNode node, File folder) throws I
14711471
*/
14721472
File checkSketchFolder(File subfolder, String item) {
14731473
for (Mode mode : getModeList()) {
1474-
File entry = new File(subfolder, item + "." + mode.getDefaultExtension());
1474+
File entry = new File(subfolder, item + "." + mode.getDefaultExtension()); //$NON-NLS-1$
14751475
// if a .pde file of the same prefix as the folder exists..
14761476
if (entry.exists()) {
14771477
return entry;
@@ -1593,7 +1593,7 @@ static public String getPlatformName() {
15931593
*/
15941594
static public int getNativeBits() {
15951595
if (Base.isMacOS()) {
1596-
return Preferences.getInteger("run.options.bits");
1596+
return Preferences.getInteger("run.options.bits"); //$NON-NLS-1$
15971597
}
15981598
return nativeBits;
15991599
}
@@ -1644,7 +1644,7 @@ static public int getPlatformIndex(String what) {
16441644
*/
16451645
static public boolean isMacOS() {
16461646
//return PApplet.platform == PConstants.MACOSX;
1647-
return System.getProperty("os.name").indexOf("Mac") != -1;
1647+
return System.getProperty("os.name").indexOf("Mac") != -1; //$NON-NLS-1$ //$NON-NLS-2$
16481648
}
16491649

16501650

@@ -1653,7 +1653,7 @@ static public boolean isMacOS() {
16531653
*/
16541654
static public boolean isWindows() {
16551655
//return PApplet.platform == PConstants.WINDOWS;
1656-
return System.getProperty("os.name").indexOf("Windows") != -1;
1656+
return System.getProperty("os.name").indexOf("Windows") != -1; //$NON-NLS-1$ //$NON-NLS-2$
16571657
}
16581658

16591659

@@ -1662,7 +1662,7 @@ static public boolean isWindows() {
16621662
*/
16631663
static public boolean isLinux() {
16641664
//return PApplet.platform == PConstants.LINUX;
1665-
return System.getProperty("os.name").indexOf("Linux") != -1;
1665+
return System.getProperty("os.name").indexOf("Linux") != -1; //$NON-NLS-1$ //$NON-NLS-2$
16661666
}
16671667

16681668

@@ -1672,7 +1672,7 @@ static public boolean isLinux() {
16721672
static public File getSettingsFolder() {
16731673
File settingsFolder = null;
16741674

1675-
String preferencesPath = Preferences.get("settings.path");
1675+
String preferencesPath = Preferences.get("settings.path"); //$NON-NLS-1$
16761676
if (preferencesPath != null) {
16771677
settingsFolder = new File(preferencesPath);
16781678

@@ -1784,7 +1784,7 @@ static public File getToolsFolder() {
17841784
static public void locateSketchbookFolder() {
17851785
// If a value is at least set, first check to see if the folder exists.
17861786
// If it doesn't, warn the user that the sketchbook folder is being reset.
1787-
String sketchbookPath = Preferences.get("sketchbook.path");
1787+
String sketchbookPath = Preferences.get("sketchbook.path"); //$NON-NLS-1$
17881788
if (sketchbookPath != null) {
17891789
sketchbookFolder = new File(sketchbookPath);
17901790
if (!sketchbookFolder.exists()) {
@@ -2914,6 +2914,13 @@ static public void log(String message) {
29142914
System.out.println(message);
29152915
}
29162916
}
2917+
2918+
2919+
static public void logf(String message, Object... args) {
2920+
if (DEBUG) {
2921+
System.out.println(String.format(message, args));
2922+
}
2923+
}
29172924

29182925

29192926
static public void log(String message, Exception e) {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL