mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Fix bug#52494: Loading translations should now handle exceptions.
This commit is contained in:
parent
26f5f4b820
commit
8cdfc782d8
1 changed files with 21 additions and 3 deletions
|
@ -3091,11 +3091,24 @@ static void _real_close(GormDocument *self,
|
|||
{
|
||||
NSMutableArray *allObjects = [self _collectAllObjects];
|
||||
NSString *filename = [oPanel filename];
|
||||
NSDictionary *dictionary = [[NSString stringWithContentsOfFile: filename] propertyListFromStringsFileFormat];
|
||||
NSEnumerator *en = [allObjects objectEnumerator];
|
||||
NSDictionary *dictionary = nil;
|
||||
NSEnumerator *en = nil;
|
||||
id obj = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
dictionary = [[NSString stringWithContentsOfFile: filename] propertyListFromStringsFileFormat];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSString *message = [localException reason];
|
||||
NSRunAlertPanel(_(@"Problem loading strings"),
|
||||
message, nil, nil, nil);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
// change to translated values.
|
||||
en = [allObjects objectEnumerator];
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
NSString *translation = nil;
|
||||
|
@ -3206,7 +3219,12 @@ static void _real_close(GormDocument *self,
|
|||
|
||||
if(touched)
|
||||
{
|
||||
NSString *stringToWrite = [dictionary descriptionInStringsFileFormat];
|
||||
NSString *stringToWrite =
|
||||
@"/* TRANSLATORS: Make sure to quote all translated strings if\n"
|
||||
@" they contain spaces or non-ASCII characters. */\n\n";
|
||||
|
||||
stringToWrite = [stringToWrite stringByAppendingString:
|
||||
[dictionary descriptionInStringsFileFormat]];
|
||||
[stringToWrite writeToFile: filename atomically: YES];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue