for (String language : availableLanguages()) {
NSArray<String> languageArray = new NSArray<String>(language);
URL url = ERXFileUtilities.pathURLForResourceNamed(selectedFilename, selectedFramework, languageArray);
NSMutableDictionary dict = new NSMutableDictionary();
for (Enumeration entries = data.objectEnumerator(); entries.hasMoreElements();) {
NSDictionary entry = (NSDictionary) entries.nextElement();
String key = (String) entry.objectForKey("key");
Object value = entry.objectForKey(language);
if (value != null && !value.equals(UNSET)) {
dict.setObjectForKey(value, key);
}
}
String result = ERXStringUtilities.stringFromDictionary(dict);
NSDictionary newDict = (NSDictionary) NSPropertyListSerialization.propertyListFromString(result);
if (!newDict.equals(dict)) {
throw new IllegalStateException("Data wasn't equal when comparing before save");
} else if (url != null) {
ERXFileUtilities.stringToFile(result, new File(url.getFile()), ERXProperties.stringForKeyWithDefault("er.extensions.ERXLocalizationEditor.endoding", CharEncoding.UTF_16BE));
}
}