Modified system message delivery to include a localization bundle

identifier which indicates which bundle to use when translating the
message for display to the client.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1074 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-26 05:47:40 +00:00
parent 2dc3c95b8b
commit e782bacb35
3 changed files with 16 additions and 8 deletions
@@ -1,5 +1,5 @@
// //
// $Id: ChatDirector.java,v 1.16 2002/02/09 20:47:11 mdb Exp $ // $Id: ChatDirector.java,v 1.17 2002/02/26 05:47:40 mdb Exp $
package com.threerings.crowd.chat; package com.threerings.crowd.chat;
@@ -245,12 +245,13 @@ public class ChatDirector
*/ */
protected void handleSystemMessage (String type, Object[] args) protected void handleSystemMessage (String type, Object[] args)
{ {
String message = (String)args[0]; String bundle = (String)args[0];
String message = (String)args[1];
// pass this on to our chat displays // pass this on to our chat displays
for (int i = 0; i < _displays.size(); i++) { for (int i = 0; i < _displays.size(); i++) {
ChatDisplay display = (ChatDisplay)_displays.get(i); ChatDisplay display = (ChatDisplay)_displays.get(i);
display.displaySystemMessage(type, message); display.displaySystemMessage(type, bundle, message);
} }
} }
@@ -1,5 +1,5 @@
// //
// $Id: ChatDisplay.java,v 1.7 2002/02/03 08:22:38 shaper Exp $ // $Id: ChatDisplay.java,v 1.8 2002/02/26 05:47:40 mdb Exp $
package com.threerings.crowd.chat; package com.threerings.crowd.chat;
@@ -48,9 +48,12 @@ public interface ChatDisplay
* delivered via the place object, or for messages delivered via an * delivered via the place object, or for messages delivered via an
* auxiliary chat object, the type code provided when that auxiliary * auxiliary chat object, the type code provided when that auxiliary
* object was registered. * object was registered.
* @param bundle the bundle identifier to be used when localizing this
* message for display to the client.
* @param message the text of the message. * @param message the text of the message.
*/ */
public void displaySystemMessage (String type, String message); public void displaySystemMessage (
String type, String bundle, String message);
/** /**
* Called in response to a chat request (either speak or tell) that * Called in response to a chat request (either speak or tell) that
@@ -1,5 +1,5 @@
// //
// $Id: ChatProvider.java,v 1.8 2001/12/17 00:52:43 mdb Exp $ // $Id: ChatProvider.java,v 1.9 2002/02/26 05:47:40 mdb Exp $
package com.threerings.crowd.chat; package com.threerings.crowd.chat;
@@ -66,11 +66,15 @@ public class ChatProvider
* that makes it clear that it is a message from the server. * that makes it clear that it is a message from the server.
* *
* @param placeOid the place to which to deliver the message. * @param placeOid the place to which to deliver the message.
* @param bundle the name of the localization bundle that should be
* used to translate this system message prior to displaying it to the
* client.
* @param message the text of the message. * @param message the text of the message.
*/ */
public static void sendSystemMessage (int placeOid, String message) public static void sendSystemMessage (
int placeOid, String bundle, String message)
{ {
Object[] outargs = new Object[] { message }; Object[] outargs = new Object[] { bundle, message };
MessageEvent nevt = new MessageEvent( MessageEvent nevt = new MessageEvent(
placeOid, ChatService.SYSTEM_NOTIFICATION, outargs); placeOid, ChatService.SYSTEM_NOTIFICATION, outargs);
CrowdServer.omgr.postEvent(nevt); CrowdServer.omgr.postEvent(nevt);