@@ -132,11 +132,9 @@ - (IBAction)onExportClick:(id)sender
132132 {
133133 case SCFileTypeXcodeProject:
134134 {
135- [self .stringsController generateStringFilesAtPath: [[self .exportPanel URL ] path ] success: ^{
136-
137- } failure: ^(NSError *error) {
138- NSLog (@" Could not generate string files %@ " , error);
139- }];
135+ [self .stringsController generateStringFilesAtPath: [[self .exportPanel URL ] path ]
136+ success: nil
137+ failure: nil ];
140138
141139 break ;
142140 }
@@ -145,16 +143,24 @@ - (IBAction)onExportClick:(id)sender
145143 BOOL includeComments = [self .exportPanelAccessoryView shouldIncludeComments ];
146144 BOOL useKeyForMissingTranslations = [self .exportPanelAccessoryView shouldUseKeyForMissingTranslations ];
147145
148- [self .stringsController generateCSVAtPath: [[self .exportPanel URL ] path ] includeComments: includeComments useKeyForEmptyTranslations: useKeyForMissingTranslations success: ^{
149-
150- } failure: ^( NSError *error) {
151- NSLog ( @" Could not generate CSV file %@ " , error);
152- } ];
146+ [self .stringsController generateCSVAtPath: [[self .exportPanel URL ] path ]
147+ includeComments: includeComments
148+ useKeyForEmptyTranslations: useKeyForMissingTranslations
149+ success: nil
150+ failure: nil ];
153151
154152 break ;
155153 }
156154 case SCFileTypeXML:
157155 {
156+ BOOL includeComments = [self .exportPanelAccessoryView shouldIncludeComments ];
157+ BOOL useKeyForMissingTranslations = [self .exportPanelAccessoryView shouldUseKeyForMissingTranslations ];
158+
159+ [self .stringsController generateXMLFileAtPath: [[self .exportPanel URL ] path ]
160+ includeComments: includeComments
161+ useKeyForEmptyTranslations: useKeyForMissingTranslations
162+ success: nil
163+ failure: nil ];
158164 break ;
159165 }
160166 default :
@@ -203,22 +209,9 @@ - (void)exportAccessoryView:(SCExportAccessoryView*)view didSelectFormatType:(SC
203209
204210- (IBAction )onSaveClick : (id )sender
205211{
206- if (self.stringsController .sourceType == SCFileTypeInvalid) return ;
207-
208- if (self.stringsController .sourceType == SCFileTypeXcodeProject) {
209- [self .stringsController generateStringFilesAtPath: nil success: ^{
210-
211- } failure: ^(NSError *error) {
212- NSLog (@" Could not generate string files %@ " , error);
213- }];
214- }
215- else {
216- [self .stringsController generateCSVAtPath: nil includeComments: YES useKeyForEmptyTranslations: NO success: ^{
217-
218- } failure: ^(NSError *error) {
219- NSLog (@" Could not generate CSV file %@ " , error);
220- }];
221- }
212+ [self .stringsController save: nil failure: ^(NSError *error) {
213+ SCLog (@" Could not save data %@ " , error);
214+ }];
222215}
223216
224217- (IBAction )onOpenClick : (id )sender
@@ -230,7 +223,7 @@ - (IBAction)onOpenClick:(id)sender
230223 [openPanel setCanCreateDirectories: NO ];
231224 [openPanel setAllowsMultipleSelection: NO ];
232225
233- [openPanel setAllowedFileTypes: @[@" xcodeproj" , @" csv" ]];
226+ [openPanel setAllowedFileTypes: @[@" xcodeproj" , @" csv" , @" xml " ]];
234227
235228 NSInteger result = [openPanel runModal ];
236229 if (result != NSOKButton ) return ;
@@ -254,19 +247,21 @@ - (IBAction)onOpenClick:(id)sender
254247 [self .stringsController importProjectAtPath: [[openPanel URL ] path ]
255248 positionalParameters: includePositionalParameters
256249 genstringsRoutine: routine success: ^{ [self reloadData ];}
257- failure: ^(NSError *error) { NSLog (@" Could not import Xcode project %@ " , error);}];
250+ failure: ^(NSError *error) { SCLog (@" Could not import Xcode project %@ " , error);}];
258251 break ;
259252 }
260253 case SCFileTypeCSV:
261254 {
262255 [self .stringsController importCSVFileAtPath: [[openPanel URL ] path ]
263256 success: ^{ [self reloadData ];}
264- failure: ^(NSError *error) { NSLog (@" Could not import CSV file %@ " ,error);}];
257+ failure: ^(NSError *error) { SCLog (@" Could not import CSV file %@ " ,error);}];
265258 break ;
266259 }
267260 case SCFileTypeXML:
268261 {
269-
262+ [self .stringsController importXMLFileAtPath: [[openPanel URL ] path ]
263+ success: ^{ [self reloadData ]; }
264+ failure: ^(NSError *error) { SCLog (@" Could not import XML file %@ " ,error);}];
270265 }
271266 default :
272267 {
0 commit comments