Allow those using message bundles to get all the keys that start with a particular prefix, just like they can get all the translations that match a prefix.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5555 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Mike Thomas
2008-11-18 19:25:19 +00:00
parent 201ab6adc7
commit d14937991a
@@ -202,6 +202,28 @@ public class MessageBundle
}
}
/**
* Adds all keys for messages whose key starts with the specified prefix to the
* supplied collection.
*
* @param includeParent if true, messages from our parent bundle (and its
* parent bundle, all the way up the chain will be included).
*/
public void getAllKeys (String prefix, Collection<String> keys,
boolean includeParent)
{
Enumeration<String> iter = _bundle.getKeys();
while (iter.hasMoreElements()) {
String key = iter.nextElement();
if (key.startsWith(prefix)) {
keys.add(key);
}
}
if (includeParent && _parent != null) {
_parent.getAllKeys(prefix, keys, includeParent);
}
}
/**
* Returns true if we have a translation mapping for the supplied key,
* false if not.