Skip to content

Commit 43e2d98

Browse files
committed
Fix search 'Localizable.strings' file path
1 parent 8881371 commit 43e2d98

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Sources/LocalizedGenStringsCore/CommandLineTool.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public final class CommandLineTool {
103103
do {
104104
try self.writer.write(toXcodeProjPath: fullPath, translatedStrings: translatedLocalizedStrings, lang: lang, originalStrings: localizedStrings)
105105
} catch {
106+
Log.e(error)
106107
throw Error.failedSave
107108
}
108109
}

Sources/LocalizedGenStringsCore/Parser/DefaultParser.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ struct DefaultParser: Parser {
112112
}
113113
}
114114

115-
// ibtool Avatar.storyboard --generate-strings-file temp.strings
116-
117115
return LocalizedStrings(codeStrings: localizedStrings, storyboardStrings: storyboardLocalizedStrings)
118116
}
119117
}

Sources/LocalizedGenStringsCore/Writer/DefaultWriter.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,19 @@ class DefaultWriter: Writer {
4343

4444
while let element = enumerator?.nextObject() as? String {
4545
if element.hasSuffix("\(lang).lproj") {
46-
let localizableFilePath = Path(element) + Path(Constants.generatedFilename)
46+
let localizableFilePath = mainProjectPath + Path(element) + Path(Constants.generatedFilename)
4747

48-
return mainProjectPath + localizableFilePath
48+
if localizableFilePath.exists {
49+
return localizableFilePath
50+
}
4951
}
5052
}
5153

5254
return nil
5355
}
5456

5557
private func readLocalizedStrings(from filePath: Path) throws -> [String: String] {
56-
var content: String = try filePath.read(.unicode)
58+
var content: String = try filePath.read()
5759

5860
let regex = try NSRegularExpression(pattern: Constants.pattern, options: .caseInsensitive)
5961

0 commit comments

Comments
 (0)