Updated to work with the revamped resource handling of flex 3.

We're supposed to use ResourceManager.getString(bundleName, rsrcName)
and that will do cool locale chaining, but then we're looking up
the bundle every time. We may want to revisit this in the future.
(Cool chaining: we can compile the app with the local order as
[ "jp_JP", "en_US" ], and then if we request the "b.buy" key
from the "game" bundle, it will look in japanese for b.buy, but
fall back to english if not found.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4945 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2008-02-24 02:48:37 +00:00
parent 32354987f2
commit da02f02777
2 changed files with 25 additions and 38 deletions
+7 -8
View File
@@ -21,7 +21,7 @@
package com.threerings.util {
import mx.resources.ResourceBundle;
import mx.resources.IResourceBundle;
/**
* A message bundle provides an easy mechanism by which to obtain
@@ -38,7 +38,7 @@ public class MessageBundle
* reporting purposes.
*/
public function init (
msgmgr :MessageManager, path :String, bundle :ResourceBundle,
msgmgr :MessageManager, path :String, bundle :IResourceBundle,
parent :MessageBundle) :void
{
_msgmgr = msgmgr;
@@ -100,12 +100,11 @@ public class MessageBundle
protected function getResourceString (
key :String, reportMissing :Boolean = true) :String
{
try {
if (_bundle != null) {
return _bundle.getString(key);
if (_bundle != null) {
var val :Object = _bundle.content[key];
if (val != null) {
return String(val);
}
} catch (missingResource :Error) {
// fall through and try the parent
}
// if we have a parent, try getting the string from them
@@ -413,7 +412,7 @@ public class MessageBundle
protected var _path :String;
/** The resource bundle from which we obtain our messages. */
protected var _bundle :ResourceBundle;
protected var _bundle :IResourceBundle;
/** Our parent bundle if we're not the global bundle. */
protected var _parent :MessageBundle;