From 706f841247fe3570b758415e693005cab71efc3d Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Sun, 24 Mar 2013 14:10:36 +0000 Subject: [PATCH] Issue #3 --- SCStringsUtility/Readers&Writers/SCStringsWriter.m | 8 +++----- SCStringsUtility/SCStringsController.m | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/SCStringsUtility/Readers&Writers/SCStringsWriter.m b/SCStringsUtility/Readers&Writers/SCStringsWriter.m index 3203d8e..06fc1ec 100644 --- a/SCStringsUtility/Readers&Writers/SCStringsWriter.m +++ b/SCStringsUtility/Readers&Writers/SCStringsWriter.m @@ -103,10 +103,8 @@ - (void)writeTranslations:(NSDictionary*)translations toPath:(NSString*)path fai self.fileHandlers = [NSMutableDictionary dictionary]; NSError *error; - for(NSString *x in self.headers) - { - NSString *languageIdentifier = [NSLocale canonicalLanguageIdentifierFromString:x]; - + for(NSString *languageIdentifier in self.headers) + { NSString *lprojPath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.lproj", languageIdentifier]]; [[NSFileManager defaultManager] createDirectoryAtPath:lprojPath withIntermediateDirectories:YES attributes:nil error:&error]; if(error) { @@ -120,7 +118,7 @@ - (void)writeTranslations:(NSDictionary*)translations toPath:(NSString*)path fai NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:stringsPath]; if(fileHandle == nil) SCLog(@"Unable to open file for writing at path %@", stringsPath); - [self.fileHandlers setObject:@{kKeyFileHandle : fileHandle, kKeyEncoding : @(NSUTF8StringEncoding)} forKey:x]; + [self.fileHandlers setObject:@{kKeyFileHandle : fileHandle, kKeyEncoding : @(NSUTF8StringEncoding)} forKey:languageIdentifier]; } [self writeTranslations:translations failure:failure]; diff --git a/SCStringsUtility/SCStringsController.m b/SCStringsUtility/SCStringsController.m index 00e8448..c1d203f 100644 --- a/SCStringsUtility/SCStringsController.m +++ b/SCStringsUtility/SCStringsController.m @@ -201,7 +201,7 @@ - (void)importProjectAtPath:(NSString *)path for(XCSourceFile *file in files) { - NSString *language = [[NSLocale currentLocale] displayNameForKey:NSLocaleLanguageCode value:[[[file.name stringByDeletingLastPathComponent] lastPathComponent] stringByDeletingPathExtension]]; + NSString *language = [[[file.name stringByDeletingLastPathComponent] lastPathComponent] stringByDeletingPathExtension]; if(!language) continue; XCGroup *parentGroup = [[self.project groupForGroupMemberWithKey:file.key] parentGroup];