Optional generation of extension (R.xx)
Optional generation of Colors/Fonts/Images/Stringium extension Fix swiftlint warning
This commit is contained in:
@ -19,8 +19,7 @@ enum StringsFileGenerator {
|
||||
langs: [String],
|
||||
defaultLang: String,
|
||||
tags: [String],
|
||||
outputPath: String,
|
||||
inputFilenameWithoutExt: String
|
||||
lprojPathFormat: String
|
||||
) {
|
||||
|
||||
var stringsFilesContent = [String: String]()
|
||||
@ -37,7 +36,7 @@ enum StringsFileGenerator {
|
||||
langs.forEach { lang in
|
||||
guard let fileContent = stringsFilesContent[lang] else { return }
|
||||
|
||||
let stringsFilePath = "\(outputPath)/\(lang).lproj/\(inputFilenameWithoutExt).strings"
|
||||
let stringsFilePath = String(format: lprojPathFormat, lang)
|
||||
let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
|
||||
do {
|
||||
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
|
||||
@ -54,8 +53,7 @@ enum StringsFileGenerator {
|
||||
langs: [String],
|
||||
defaultLang: String,
|
||||
tags: [String],
|
||||
outputPath: String,
|
||||
inputFilenameWithoutExt: String
|
||||
xcStringsFilePath: String
|
||||
) {
|
||||
|
||||
let fileContent: String = Self.generateXcStringsFileContent(
|
||||
@ -65,12 +63,11 @@ enum StringsFileGenerator {
|
||||
sections: sections
|
||||
)
|
||||
|
||||
let stringsFilePath = "\(outputPath)/\(inputFilenameWithoutExt).xcstrings"
|
||||
let stringsFilePathURL = URL(fileURLWithPath: stringsFilePath)
|
||||
let stringsFilePathURL = URL(fileURLWithPath: xcStringsFilePath)
|
||||
do {
|
||||
try fileContent.write(to: stringsFilePathURL, atomically: false, encoding: .utf8)
|
||||
} catch {
|
||||
let error = StringiumError.writeFile(error.localizedDescription, stringsFilePath)
|
||||
let error = StringiumError.writeFile(error.localizedDescription, xcStringsFilePath)
|
||||
print(error.description)
|
||||
Stringium.exit(withError: error)
|
||||
}
|
||||
|
Reference in New Issue
Block a user