summaryrefslogtreecommitdiff
path: root/sources/events
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2009-01-17 14:29:28 +0000
committerPaul Buetow <paul@buetow.org>2009-01-17 14:29:28 +0000
commitff0c70b54edbbe3436583d6491d4a56d96302de5 (patch)
tree2b63fc15e30d953e043018fc0c0aa2be54af94f1 /sources/events
parentb5e0d976418e3373b3d518a1ca01fc542a2fe602 (diff)
added initial multiple langua support.
Diffstat (limited to 'sources/events')
-rw-r--r--sources/events/VSRegisteredEvents.java85
-rw-r--r--sources/events/implementations/VSProcessCrashEvent.java2
-rw-r--r--sources/events/implementations/VSProcessRecoverEvent.java2
-rw-r--r--sources/events/internal/VSMessageReceiveEvent.java2
-rw-r--r--sources/events/internal/VSProtocolEvent.java9
5 files changed, 65 insertions, 35 deletions
diff --git a/sources/events/VSRegisteredEvents.java b/sources/events/VSRegisteredEvents.java
index 37f11f4..9d022d9 100644
--- a/sources/events/VSRegisteredEvents.java
+++ b/sources/events/VSRegisteredEvents.java
@@ -71,7 +71,7 @@ public final class VSRegisteredEvents {
new HashMap<String,Boolean>();
/** The prefs. */
- //private static VSPrefs prefs;
+ private static VSPrefs prefs;
/**
* Registers available events.
@@ -79,32 +79,50 @@ public final class VSRegisteredEvents {
* @param prefs_ the prefs_
*/
public static void init(VSPrefs prefs_) {
- //prefs = prefs_;
-
- registerEvent("events.implementations.VSProcessCrashEvent",
- "Prozessabsturz");
- registerEvent("events.implementations.VSProcessRecoverEvent",
- "Prozesswiederbelebung");
- registerEvent("protocols.implementations.VSBasicMulticastProtocol",
- "Basic Multicast", "Basic Multicast");
- registerEvent("protocols.implementations.VSBerkelyTimeProtocol",
- "Berkeley Algorithmus zur internen Sync.", "Berkeley");
- registerEvent("protocols.implementations.VSBroadcastProtocol",
- "Broadcast");
- registerEvent("protocols.implementations.VSDummyProtocol",
- "Beispiel/Dummy");
- registerEvent("protocols.implementations.VSExternalTimeSyncProtocol",
- "Christians Methode zur externen Sync.", "Christians");
- registerEvent("protocols.implementations.VSInternalTimeSyncProtocol",
- "Interne Synchronisation", "Interne Sync.");
- registerEvent("protocols.implementations.VSOnePhaseCommitProtocol",
- "Ein-Phasen Commit", "1-Phasen Commit");
- registerEvent("protocols.implementations.VSPingPongProtocol",
- "Ping Pong");
- registerEvent("protocols.implementations.VSReliableMulticastProtocol",
- "Reliable Multicast", "Reliable Multicast");
- registerEvent("protocols.implementations.VSTwoPhaseCommitProtocol",
- "Zwei-Phasen Commit", "2-Phasen Commit");
+ prefs = prefs_;
+
+ /*
+ registerEvent("events.implementations.VSProcessCrashEvent",
+ "Prozessabsturz");
+ registerEvent("events.implementations.VSProcessRecoverEvent",
+ "Prozesswiederbelebung");
+ registerEvent("protocols.implementations.VSBasicMulticastProtocol",
+ "Basic Multicast", "Basic Multicast");
+ registerEvent("protocols.implementations.VSBerkelyTimeProtocol",
+ "Berkeley Algorithmus zur internen Sync.", "Berkeley");
+ registerEvent("protocols.implementations.VSBroadcastProtocol",
+ "Broadcast");
+ registerEvent("protocols.implementations.VSDummyProtocol",
+ "Beispiel/Dummy");
+ registerEvent("protocols.implementations.VSExternalTimeSyncProtocol",
+ "Christians Methode zur externen Sync.", "Christians");
+ registerEvent("protocols.implementations.VSInternalTimeSyncProtocol",
+ "Interne Synchronisation", "Interne Sync.");
+ registerEvent("protocols.implementations.VSOnePhaseCommitProtocol",
+ "Ein-Phasen Commit", "1-Phasen Commit");
+ registerEvent("protocols.implementations.VSPingPongProtocol",
+ "Ping Pong");
+ registerEvent("protocols.implementations.VSReliableMulticastProtocol",
+ "Reliable Multicast", "Reliable Multicast");
+ registerEvent("protocols.implementations.VSTwoPhaseCommitProtocol",
+ "Zwei-Phasen Commit", "2-Phasen Commit");
+ */
+
+ /* Using the NEW way. The old way above (specifying protocol names
+ in this file still works as well */
+
+ registerEvent("events.implementations.VSProcessCrashEvent");
+ registerEvent("events.implementations.VSProcessRecoverEvent");
+ registerEvent("protocols.implementations.VSBasicMulticastProtocol");
+ registerEvent("protocols.implementations.VSBerkelyTimeProtocol");
+ registerEvent("protocols.implementations.VSBroadcastProtocol");
+ registerEvent("protocols.implementations.VSDummyProtocol");
+ registerEvent("protocols.implementations.VSExternalTimeSyncProtocol");
+ registerEvent("protocols.implementations.VSInternalTimeSyncProtocol");
+ registerEvent("protocols.implementations.VSOnePhaseCommitProtocol");
+ registerEvent("protocols.implementations.VSPingPongProtocol");
+ registerEvent("protocols.implementations.VSReliableMulticastProtocol");
+ registerEvent("protocols.implementations.VSTwoPhaseCommitProtocol");
/* Make dummy objects of each protocol, to see if they contain VSPrefs
values to edit */
@@ -349,6 +367,19 @@ public final class VSRegisteredEvents {
}
/**
+ * Registers an event. Use the language settings of VSPrefs.
+ *
+ * @param eventClassname the event classname
+ */
+ private static void registerEvent(String eventClassname) {
+ String eventName =
+ prefs.getString("lang.en." + eventClassname);
+ String eventShortname =
+ prefs.getString("lang.en." + eventClassname + ".short");
+ registerEvent(eventClassname, eventName, eventShortname);
+ }
+
+ /**
* Registers an event.
*
* @param eventClassname the event classname
diff --git a/sources/events/implementations/VSProcessCrashEvent.java b/sources/events/implementations/VSProcessCrashEvent.java
index ed92827..1493b8c 100644
--- a/sources/events/implementations/VSProcessCrashEvent.java
+++ b/sources/events/implementations/VSProcessCrashEvent.java
@@ -54,7 +54,7 @@ public class VSProcessCrashEvent extends VSAbstractEvent
public void onStart() {
if (!process.isCrashed()) {
process.isCrashed(true);
- log(prefs.getString("lang.crashed"));
+ log(prefs.getString("lang.en.crashed"));
}
}
}
diff --git a/sources/events/implementations/VSProcessRecoverEvent.java b/sources/events/implementations/VSProcessRecoverEvent.java
index d8408af..0143bbb 100644
--- a/sources/events/implementations/VSProcessRecoverEvent.java
+++ b/sources/events/implementations/VSProcessRecoverEvent.java
@@ -55,7 +55,7 @@ public class VSProcessRecoverEvent extends VSAbstractEvent
public void onStart() {
if (process.isCrashed()) {
process.isCrashed(false);
- log(prefs.getString("lang.recovered"));
+ log(prefs.getString("lang.en.recovered"));
}
}
}
diff --git a/sources/events/internal/VSMessageReceiveEvent.java b/sources/events/internal/VSMessageReceiveEvent.java
index 9aed81f..ab8c929 100644
--- a/sources/events/internal/VSMessageReceiveEvent.java
+++ b/sources/events/internal/VSMessageReceiveEvent.java
@@ -81,7 +81,7 @@ public class VSMessageReceiveEvent extends VSAbstractInternalEvent
process.updateVectorTime(message.getVectorTime());
StringBuffer buffer = new StringBuffer();
- buffer.append(prefs.getString("lang.message.recv"));
+ buffer.append(prefs.getString("lang.en.message.recv"));
buffer.append("; ");
buffer.append(message);;
log(buffer.toString());
diff --git a/sources/events/internal/VSProtocolEvent.java b/sources/events/internal/VSProtocolEvent.java
index 39f5fdd..b4a01ce 100644
--- a/sources/events/internal/VSProtocolEvent.java
+++ b/sources/events/internal/VSProtocolEvent.java
@@ -139,13 +139,13 @@ public class VSProtocolEvent extends VSAbstractInternalEvent
buffer.append(" ");
buffer.append(isClientProtocol
- ? prefs.getString("lang.client")
- : prefs.getString("lang.server"));
+ ? prefs.getString("lang.en.client")
+ : prefs.getString("lang.en.server"));
buffer.append(" ");
buffer.append(isProtocolActivation
- ? prefs.getString("lang.activated")
- : prefs.getString("lang.deactivated"));
+ ? prefs.getString("lang.en.activated")
+ : prefs.getString("lang.en.deactivated"));
log(buffer.toString());
}
@@ -195,6 +195,5 @@ public class VSProtocolEvent extends VSAbstractInternalEvent
/** For later backwards compatibility, to add more stuff */
objectInputStream.readObject();
-
}
}