Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ishkawa committed Feb 15, 2015
1 parent 1d9562c commit ea97cad
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions ls2xs/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,17 @@ func executeWithPath(path: String) {

for lprojFile in lprojFiles.filter({ $0.URL != baseLprojFile.URL }) {
if let localizableStringsFile = lprojFile.localizableStringsFile {
for stringsFile in StringsFile.stringsFilesInDirectory(lprojFile.URL) {
if stringsFile.URL == localizableStringsFile.URL {
continue
}

let name = stringsFile.URL.lastPathComponent!.stringByDeletingPathExtension
if !contains(xibNames, name) {
continue
}

let stringsFiles = StringsFile.stringsFilesInDirectory(lprojFile.URL).filter(){ stringsFile in
stringsFile.URL != localizableStringsFile.URL &&
contains(xibNames, stringsFile.URL.lastPathComponent!.stringByDeletingPathExtension)
}

for stringsFile in StringsFile.stringsFilesInDirectory(lprojFile.URL).filter({ $0.URL != localizableStringsFile.URL }) {
for (key, value) in stringsFile.dictionary {
if let newValue = localizableStringsFile.dictionary[value] {
stringsFile.dictionary[key] = newValue
}
}

stringsFile.save()
}
}
Expand Down

0 comments on commit ea97cad

Please sign in to comment.