aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-03-09 21:28:28 +0100
committerMax <post@wickenrode.com>2015-03-09 21:28:28 +0100
commit8b1ff9c9b8a996ff0c6321e58709c25f0c5763c1 (patch)
tree23d045d4dd5f732d47c8ae640c939b10015e00fd /Source
parent784876380b871b6d85978a705e2477e7b7d2d984 (diff)
downloadsequelpro-8b1ff9c9b8a996ff0c6321e58709c25f0c5763c1.tar.gz
sequelpro-8b1ff9c9b8a996ff0c6321e58709c25f0c5763c1.tar.bz2
sequelpro-8b1ff9c9b8a996ff0c6321e58709c25f0c5763c1.zip
Update nightly build script for temporary translation workaround, improve xibLocalizationPostprocessor robustness
Diffstat (limited to 'Source')
-rw-r--r--Source/xibLocalizationPostprocessor.m16
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/xibLocalizationPostprocessor.m b/Source/xibLocalizationPostprocessor.m
index 8efa545a..1806d6b2 100644
--- a/Source/xibLocalizationPostprocessor.m
+++ b/Source/xibLocalizationPostprocessor.m
@@ -92,29 +92,31 @@ int main(int argc, const char *argv[])
NSDictionary *load_kv_pairs(NSString *input)
{
NSDictionary *result = [NSMutableDictionary dictionary];
- __block NSUInteger lineCount = 0;
- [input enumerateLinesUsingBlock:^(NSString *line, BOOL *stop) {
+
+ NSUInteger lineCount = 0;
+ //don't try [NSString enumerateLines...] here. It supports some obscure Unicode line breaks!
+ for (NSString *line in [input componentsSeparatedByString:@"\n"]) {
lineCount++;
if (line.length == 0 || [line hasPrefix:@"/*"]) {
- return;
+ continue;
}
if ([line hasPrefix:@"\""] && [line hasSuffix:@"\";"]) { // eg: "136.title" = "Quit Library";
NSRange quoteEqualsQuoteRange = [line rangeOfString:@"\" = \""];
- if (quoteEqualsQuoteRange.length && NSMaxRange(quoteEqualsQuoteRange) < line.length - 1) {
+ if (quoteEqualsQuoteRange.location != NSNotFound && quoteEqualsQuoteRange.length && NSMaxRange(quoteEqualsQuoteRange) < line.length - 1) {
NSRange keyRange = NSMakeRange(1,quoteEqualsQuoteRange.location - 1); //the first " is always at pos. 0 (we checked that above)
NSString *key = [line substringWithRange:keyRange];
NSString *value = [line substringFromIndex:NSMaxRange(quoteEqualsQuoteRange)]; // chop off leading: "blah" = "
value = [value substringToIndex:[value length] - 2]; // chop off trailing: ";
[result setValue:value forKey:key];
- return;
+ continue;
}
}
NSLog(@"Warning: skipped garbage trans line %lu, contents: \"%@\"", (unsigned long)lineCount, line);
-
- }];
+ }
+
return result;
}