diff --git a/src/java/com/threerings/micasa/client/ChatPanel.java b/src/java/com/threerings/micasa/client/ChatPanel.java index 41f44e9f4..bca40304d 100644 --- a/src/java/com/threerings/micasa/client/ChatPanel.java +++ b/src/java/com/threerings/micasa/client/ChatPanel.java @@ -1,5 +1,5 @@ // -// $Id: ChatPanel.java,v 1.11 2001/12/17 01:06:35 mdb Exp $ +// $Id: ChatPanel.java,v 1.12 2002/02/26 05:48:11 mdb Exp $ package com.threerings.micasa.client; @@ -32,6 +32,8 @@ import com.samskivert.swing.HGroupLayout; import com.samskivert.swing.VGroupLayout; import com.samskivert.swing.event.AncestorAdapter; +import com.threerings.util.MessageBundle; + import com.threerings.crowd.chat.ChatCodes; import com.threerings.crowd.chat.ChatDirector; import com.threerings.crowd.chat.ChatDisplay; @@ -39,15 +41,15 @@ import com.threerings.crowd.client.OccupantObserver; import com.threerings.crowd.client.PlaceView; import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.data.PlaceObject; -import com.threerings.crowd.util.CrowdContext; import com.threerings.micasa.Log; +import com.threerings.micasa.util.MiCasaContext; public class ChatPanel extends JPanel implements ActionListener, ChatDisplay, OccupantObserver, PlaceView { - public ChatPanel (CrowdContext ctx) + public ChatPanel (MiCasaContext ctx) { // keep this around for later _ctx = ctx; @@ -241,8 +243,19 @@ public class ChatPanel } // documentation inherited - public void displaySystemMessage (String type, String message) + public void displaySystemMessage ( + String type, String bundle, String message) { + // translate the message + MessageBundle msgb = _ctx.getMessageManager().getBundle(bundle); + if (msgb == null) { + Log.warning("No message bundle available to translate message " + + "[type=" + type + ", bundle=" + bundle + + ", message=" + message + "]."); + } else { + message = msgb.xlate(message); + } + // stick a newline on the message message = message + "\n"; @@ -324,7 +337,7 @@ public class ChatPanel return size; } - protected CrowdContext _ctx; + protected MiCasaContext _ctx; protected ChatDirector _chatdtr; protected boolean _focus = true; diff --git a/src/java/com/threerings/micasa/client/MiCasaClient.java b/src/java/com/threerings/micasa/client/MiCasaClient.java index 9606f21d0..4b916bc7e 100644 --- a/src/java/com/threerings/micasa/client/MiCasaClient.java +++ b/src/java/com/threerings/micasa/client/MiCasaClient.java @@ -1,5 +1,5 @@ // -// $Id: MiCasaClient.java,v 1.9 2002/01/19 04:15:25 mdb Exp $ +// $Id: MiCasaClient.java,v 1.10 2002/02/26 05:48:11 mdb Exp $ package com.threerings.micasa.client; @@ -11,6 +11,8 @@ import javax.swing.SwingUtilities; import com.samskivert.util.Config; +import com.threerings.util.MessageManager; + import com.threerings.presents.client.Client; import com.threerings.presents.dobj.DObjectManager; @@ -102,6 +104,7 @@ public class MiCasaClient _locdir = new LocationDirector(_ctx); _occmgr = new OccupantManager(_ctx); _pardtr = new ParlorDirector(_ctx); + _msgmgr = new MessageManager(MESSAGE_MANAGER_PREFIX); } // documentation inherited @@ -167,6 +170,11 @@ public class MiCasaClient { return _frame; } + + public MessageManager getMessageManager () + { + return _msgmgr; + } } protected MiCasaContext _ctx; @@ -177,4 +185,9 @@ public class MiCasaClient protected LocationDirector _locdir; protected OccupantManager _occmgr; protected ParlorDirector _pardtr; + protected MessageManager _msgmgr; + + /** The prefix prepended to localization bundle names before looking + * them up in the classpath. */ + protected static final String MESSAGE_MANAGER_PREFIX = "rsrc.messages"; } diff --git a/src/java/com/threerings/micasa/util/MiCasaContext.java b/src/java/com/threerings/micasa/util/MiCasaContext.java index 61d3e6557..77120a40b 100644 --- a/src/java/com/threerings/micasa/util/MiCasaContext.java +++ b/src/java/com/threerings/micasa/util/MiCasaContext.java @@ -1,10 +1,10 @@ // -// $Id: MiCasaContext.java,v 1.2 2001/10/09 17:47:33 mdb Exp $ +// $Id: MiCasaContext.java,v 1.3 2002/02/26 05:48:11 mdb Exp $ package com.threerings.micasa.util; +import com.threerings.util.MessageManager; import com.threerings.parlor.util.ParlorContext; - import com.threerings.micasa.client.MiCasaFrame; /** @@ -19,4 +19,10 @@ public interface MiCasaContext /** Returns a reference to the primary user interface frame. This can * be used to set the top-level panel when we enter a game, etc. */ public MiCasaFrame getFrame (); + + /** + * Returns a reference to the message manager used by the client to + * generate localized messages. + */ + public MessageManager getMessageManager (); }