int stringId, String originalString,
AWSingleLocaleResourceManager resourceManager)
{
String localizedString = null;
if (LocalizedStrings == null) {
LocalizedStrings = new MultiKeyHashtable(3);
}
int resourceManagerIndex = resourceManager.index();
localizedString = (String)LocalizedStrings.get(resourceManagerIndex, componentName, stringId);
if (localizedString == null) {
synchronized (LocalizedStrings) {
localizedString = (String)LocalizedStrings.get(resourceManagerIndex, componentName, stringId);
if (localizedString == null) {
AWStringLocalizer localizer = AWConcreteApplication.SharedInstance.getStringLocalizer();
Map localizedStringsHashtable =
localizer.getLocalizedStrings(StringTableName,
componentName,
resourceManager);
if (localizedStringsHashtable != null) {
MultiKeyHashtable localizedStringsCopy = (MultiKeyHashtable)LocalizedStrings.clone();
Iterator keyEnumerator = localizedStringsHashtable.keySet().iterator();
while (keyEnumerator.hasNext()) {
String currentStringId = (String)keyEnumerator.next();
// XXX aliu: 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.put(resourceManagerIndex, componentName,
Integer.parseInt(currentStringId), currentLocalizedString);
}
}
localizedString = (String)localizedStringsCopy.get(resourceManagerIndex, componentName, stringId);
if (localizedString == null) {
localizedString = originalString;
localizedStringsCopy.put(resourceManagerIndex, componentName, stringId, localizedString);
}
LocalizedStrings = localizedStringsCopy;
}
else {
localizedString = originalString;