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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user