protected String localizedJavaString (int stringId, String originalString, AWComponent component, AWSingleLocaleResourceManager resourceManager)
{
// Todo: consider caching jstrings's csv results on the resource to allow for sharing strings across personalities.
String localizedString = null;
if (_localizedStrings == null) {
_localizedStrings = new AW2DVector();
}
int resourceManagerIndex = resourceManager.index();
localizedString = (String)_localizedStrings.elementAt(resourceManagerIndex, stringId);
if (localizedString == null) {
synchronized (this) {
localizedString = (String)_localizedStrings.elementAt(resourceManagerIndex, stringId);
if (localizedString == null) {
Map localizedStringsHashtable = AWLocal.loadLocalizedJavaStrings(component);
if (localizedStringsHashtable != null) {
AW2DVector localizedStringsCopy = (AW2DVector)_localizedStrings.clone();
Iterator keyEnumerator = localizedStringsHashtable.keySet().iterator();
while (keyEnumerator.hasNext()) {
String currentStringId = (String)keyEnumerator.next();
// Note: an application might choose to merge awl strings and java strings into one single string
// file, so we need to check for the integer key. all the awl strings will start with a letter such as
// "a001".
char firstCharacter = currentStringId.charAt(0);
if (firstCharacter >= '0' && firstCharacter <= '9') {
String currentLocalizedString = (String)localizedStringsHashtable.get(currentStringId);
localizedStringsCopy.setElementAt(currentLocalizedString, resourceManagerIndex, Integer.parseInt(currentStringId));
}
}
localizedString = (String)localizedStringsCopy.elementAt(resourceManagerIndex, stringId);
if (localizedString == null) {
if (AWLocal.IsDebuggingEnabled) {
localizedString =
AWUtil.addEmbeddedContextForDefaultString(stringId, originalString, component.namePath());
}
else {
localizedString = originalString;
}
localizedStringsCopy.setElementAt(localizedString, resourceManagerIndex, stringId);
}
_localizedStrings = localizedStringsCopy;
}
else {
localizedString = originalString;