diff --git a/data/resources/StringResources.de.resources b/data/resources/StringResources.de.resources
index 2bee253689..f8651387b3 100644
Binary files a/data/resources/StringResources.de.resources and b/data/resources/StringResources.de.resources differ
diff --git a/data/resources/StringResources.es-mx.resources b/data/resources/StringResources.es-mx.resources
index 83086ee74f..272a0ba4a0 100644
Binary files a/data/resources/StringResources.es-mx.resources and b/data/resources/StringResources.es-mx.resources differ
diff --git a/data/resources/StringResources.es.resources b/data/resources/StringResources.es.resources
index f94aa19191..d325f9a12a 100644
Binary files a/data/resources/StringResources.es.resources and b/data/resources/StringResources.es.resources differ
diff --git a/data/resources/StringResources.nl.resources b/data/resources/StringResources.nl.resources
index 9048aaeabd..96c40d9af2 100644
Binary files a/data/resources/StringResources.nl.resources and b/data/resources/StringResources.nl.resources differ
diff --git a/data/resources/StringResources.no.resources b/data/resources/StringResources.no.resources
index f145fb216c..28aa9626c4 100644
Binary files a/data/resources/StringResources.no.resources and b/data/resources/StringResources.no.resources differ
diff --git a/data/resources/StringResources.pt.resources b/data/resources/StringResources.pt.resources
index 0d86527c5d..e0f106b8fe 100644
Binary files a/data/resources/StringResources.pt.resources and b/data/resources/StringResources.pt.resources differ
diff --git a/data/resources/StringResources.se.resources b/data/resources/StringResources.se.resources
index 5c545c6def..b40577a0b4 100644
Binary files a/data/resources/StringResources.se.resources and b/data/resources/StringResources.se.resources differ
diff --git a/src/AddIns/Misc/ResourceToolkit/Project/Src/Gui/UnusedResourceKeysViewContent.cs b/src/AddIns/Misc/ResourceToolkit/Project/Src/Gui/UnusedResourceKeysViewContent.cs
index 0205473941..63e8bfbb00 100644
--- a/src/AddIns/Misc/ResourceToolkit/Project/Src/Gui/UnusedResourceKeysViewContent.cs
+++ b/src/AddIns/Misc/ResourceToolkit/Project/Src/Gui/UnusedResourceKeysViewContent.cs
@@ -389,23 +389,32 @@ namespace Hornung.ResourceToolkit.Gui
/// The key to be deleted.
protected static void DeleteResourceKey(string fileName, string key)
{
- IResourceFileContent content = ResourceFileContentRegistry.GetResourceFileContent(fileName);
- if (content != null) {
- if (content.ContainsKey(key)) {
- LoggingService.Debug("ResourceToolkit: Remove key '"+key+"' from resource file '"+fileName+"'");
- content.RemoveKey(key);
+ try {
+ IResourceFileContent content = ResourceFileContentRegistry.GetResourceFileContent(fileName);
+ if (content != null) {
+ if (content.ContainsKey(key)) {
+ LoggingService.Debug("ResourceToolkit: Remove key '"+key+"' from resource file '"+fileName+"'");
+ content.RemoveKey(key);
+ } else {
+ MessageService.ShowWarningFormatted("${res:Hornung.ResourceToolkit.KeyNotFoundWarning}", key, fileName);
+ }
} else {
- MessageService.ShowWarningFormatted("${res:Hornung.ResourceToolkit.KeyNotFoundWarning}", key, fileName);
+ MessageService.ShowWarning("ResoureToolkit: Could not get ResourceFileContent for '"+fileName+"' key +'"+key+"'.");
}
- } else {
- MessageService.ShowWarning("ResoureToolkit: Could not get ResourceFileContent for '"+fileName+"' key +'"+key+"'.");
+ } catch (Exception ex) {
+ MessageService.ShowWarningFormatted("${res:Hornung.ResourceToolkit.ErrorProcessingResourceFile}" + Environment.NewLine + ex.Message, fileName);
+ return;
}
foreach (KeyValuePair entry in ResourceFileContentRegistry.GetLocalizedContents(fileName)) {
LoggingService.Debug("ResourceToolkit: Looking in localized resource file: '"+entry.Value.FileName+"'");
- if (entry.Value.ContainsKey(key)) {
- LoggingService.Debug("ResourceToolkit: -> Key found, removing.");
- entry.Value.RemoveKey(key);
+ try {
+ if (entry.Value.ContainsKey(key)) {
+ LoggingService.Debug("ResourceToolkit: -> Key found, removing.");
+ entry.Value.RemoveKey(key);
+ }
+ } catch (Exception ex) {
+ MessageService.ShowWarningFormatted("${res:Hornung.ResourceToolkit.ErrorProcessingResourceFile}" + Environment.NewLine + ex.Message, entry.Value.FileName);
}
}
}
diff --git a/src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/ResourceRefactoringService.cs b/src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/ResourceRefactoringService.cs
index 477823ce28..03f67198f1 100644
--- a/src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/ResourceRefactoringService.cs
+++ b/src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/ResourceRefactoringService.cs
@@ -308,23 +308,38 @@ namespace Hornung.ResourceToolkit.Refactoring
monitor.BeginTask(null, 0, false);
}
- // rename references
- // FIXME: RenameReferences does not enforce escaping rules. May be a problem if someone uses double-quotes in the new resource key name.
- FindReferencesAndRenameHelper.RenameReferences(references, newKey);
-
- // rename definition (if present)
- if (rrr.ResourceFileContent.ContainsKey(rrr.Key)) {
- rrr.ResourceFileContent.RenameKey(rrr.Key, newKey);
- } else {
+ try {
+ // rename definition (if present)
+ if (rrr.ResourceFileContent.ContainsKey(rrr.Key)) {
+ rrr.ResourceFileContent.RenameKey(rrr.Key, newKey);
+ } else {
+ if (monitor != null) monitor.ShowingDialog = true;
+ MessageService.ShowWarning("${res:Hornung.ResourceToolkit.RenameKeyDefinitionNotFoundWarning}");
+ if (monitor != null) monitor.ShowingDialog = false;
+ }
+ } catch (Exception ex) {
if (monitor != null) monitor.ShowingDialog = true;
- MessageService.ShowWarning("${res:Hornung.ResourceToolkit.RenameKeyDefinitionNotFoundWarning}");
+ MessageService.ShowWarningFormatted("${res:Hornung.ResourceToolkit.ErrorProcessingResourceFile}" + Environment.NewLine + ex.Message, rrr.ResourceFileContent.FileName);
if (monitor != null) monitor.ShowingDialog = false;
+ if (monitor != null) monitor.Done();
+ // Do not rename the references when renaming the definition failed.
+ return;
}
+ // rename references
+ // FIXME: RenameReferences does not enforce escaping rules. May be a problem if someone uses double-quotes in the new resource key name.
+ FindReferencesAndRenameHelper.RenameReferences(references, newKey);
+
// rename definitions in localized resource files
foreach (KeyValuePair entry in ResourceFileContentRegistry.GetLocalizedContents(rrr.FileName)) {
- if (entry.Value.ContainsKey(rrr.Key)) {
- entry.Value.RenameKey(rrr.Key, newKey);
+ try {
+ if (entry.Value.ContainsKey(rrr.Key)) {
+ entry.Value.RenameKey(rrr.Key, newKey);
+ }
+ } catch (Exception ex) {
+ if (monitor != null) monitor.ShowingDialog = true;
+ MessageService.ShowWarningFormatted("${res:Hornung.ResourceToolkit.ErrorProcessingResourceFile}" + Environment.NewLine + ex.Message, entry.Value.FileName);
+ if (monitor != null) monitor.ShowingDialog = false;
}
}
diff --git a/src/Main/StartUp/Project/Resources/StringResources.resources b/src/Main/StartUp/Project/Resources/StringResources.resources
index 63d5f37ac7..c563d65d53 100644
Binary files a/src/Main/StartUp/Project/Resources/StringResources.resources and b/src/Main/StartUp/Project/Resources/StringResources.resources differ