From 081148172d261e1f83bfa7b7bf7cee2383382421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 27 May 2022 16:34:40 +0200 Subject: [PATCH 1/2] Add new option 'separateWithEmptyLine' to allow removing newline Fixes https://github.com/FlineDev/BartyCrouch/issues/251. --- .../UpdateOptions/NormalizeOptions.swift | 15 +++--- .../UpdateOptions/TransformOptions.swift | 22 ++++---- .../UpdateOptions/TranslateOptions.swift | 12 +++-- .../FileHandling/StringsFileUpdater.swift | 50 ++++++++++++++----- .../OldCommandLine/CommandLineActor.swift | 24 ++++++--- .../TaskHandlers/CodeTaskHandler.swift | 6 --- .../TaskHandlers/InterfacesTaskHandler.swift | 6 --- .../TaskHandlers/LintTaskHandler.swift | 6 --- .../TaskHandlers/NormalizeTaskHandler.swift | 9 +--- .../TaskHandlers/TransformTaskHandler.swift | 12 ++--- .../TaskHandlers/TranslateTaskHandler.swift | 9 +--- .../ConfigurationTests.swift | 5 +- .../DemoTests/DemoTests.swift | 6 ++- 13 files changed, 102 insertions(+), 80 deletions(-) diff --git a/Sources/BartyCrouchConfiguration/Options/UpdateOptions/NormalizeOptions.swift b/Sources/BartyCrouchConfiguration/Options/UpdateOptions/NormalizeOptions.swift index 90dc929..cff9527 100644 --- a/Sources/BartyCrouchConfiguration/Options/UpdateOptions/NormalizeOptions.swift +++ b/Sources/BartyCrouchConfiguration/Options/UpdateOptions/NormalizeOptions.swift @@ -8,6 +8,7 @@ public struct NormalizeOptions { public let sourceLocale: String public let harmonizeWithSource: Bool public let sortByKeys: Bool + public let separateWithEmptyLine: Bool } extension NormalizeOptions: TomlCodable { @@ -20,18 +21,20 @@ extension NormalizeOptions: TomlCodable { subpathsToIgnore: toml.array(update, normalize, "subpathsToIgnore") ?? Constants.defaultSubpathsToIgnore, sourceLocale: toml.string(update, normalize, "sourceLocale") ?? "en", harmonizeWithSource: toml.bool(update, normalize, "harmonizeWithSource") ?? true, - sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true + sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true, + separateWithEmptyLine: toml.bool(update, normalize, "separateWithEmptyLine") ?? true ) } func tomlContents() -> String { var lines: [String] = ["[update.normalize]"] - lines.append("paths = \(paths)") - lines.append("subpathsToIgnore = \(subpathsToIgnore)") - lines.append("sourceLocale = \"\(sourceLocale)\"") - lines.append("harmonizeWithSource = \(harmonizeWithSource)") - lines.append("sortByKeys = \(sortByKeys)") + lines.append("paths = \(self.paths)") + lines.append("subpathsToIgnore = \(self.subpathsToIgnore)") + lines.append("sourceLocale = \"\(self.sourceLocale)\"") + lines.append("harmonizeWithSource = \(self.harmonizeWithSource)") + lines.append("sortByKeys = \(self.sortByKeys)") + lines.append("separateWithEmptyLine = \(self.separateWithEmptyLine)") return lines.joined(separator: "\n") } diff --git a/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TransformOptions.swift b/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TransformOptions.swift index daf651c..5c90dfc 100644 --- a/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TransformOptions.swift +++ b/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TransformOptions.swift @@ -12,6 +12,7 @@ public struct TransformOptions { public let typeName: String public let translateMethodName: String public let customLocalizableName: String? + public let separateWithEmptyLine: Bool } extension TransformOptions: TomlCodable { @@ -43,25 +44,28 @@ extension TransformOptions: TomlCodable { supportedLanguageEnumPath: toml.string(update, transform, "supportedLanguageEnumPath") ?? ".", typeName: toml.string(update, transform, "typeName") ?? "BartyCrouch", translateMethodName: toml.string(update, transform, "translateMethodName") ?? "translate", - customLocalizableName: toml.string(update, transform, "customLocalizableName") + customLocalizableName: toml.string(update, transform, "customLocalizableName"), + separateWithEmptyLine: toml.bool(update, transform, "separateWithEmptyLine") ?? true ) } func tomlContents() -> String { var lines: [String] = ["[update.transform]"] - lines.append("codePaths = \(codePaths)") - lines.append("subpathsToIgnore = \(subpathsToIgnore)") - lines.append("localizablePaths = \(localizablePaths)") - lines.append("transformer = \"\(transformer.rawValue)\"") - lines.append("supportedLanguageEnumPath = \"\(supportedLanguageEnumPath)\"") - lines.append("typeName = \"\(typeName)\"") - lines.append("translateMethodName = \"\(translateMethodName)\"") + lines.append("codePaths = \(self.codePaths)") + lines.append("subpathsToIgnore = \(self.subpathsToIgnore)") + lines.append("localizablePaths = \(self.localizablePaths)") + lines.append(#"transformer = "\#(self.transformer.rawValue)""#) + lines.append(#"supportedLanguageEnumPath = "\#(self.supportedLanguageEnumPath)""#) + lines.append(#"typeName = "\#(self.typeName)""#) + lines.append(#"translateMethodName = "\#(self.translateMethodName)""#) if let customLocalizableName = customLocalizableName { - lines.append("customLocalizableName = \"\(customLocalizableName)\"") + lines.append(#"customLocalizableName = "\#(customLocalizableName)""#) } + lines.append("separateWithEmptyLine = \(self.separateWithEmptyLine)") + return lines.joined(separator: "\n") } } diff --git a/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TranslateOptions.swift b/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TranslateOptions.swift index 44e2701..ae0d439 100644 --- a/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TranslateOptions.swift +++ b/Sources/BartyCrouchConfiguration/Options/UpdateOptions/TranslateOptions.swift @@ -13,6 +13,7 @@ public struct TranslateOptions { public let subpathsToIgnore: [String] public let secret: Secret public let sourceLocale: String + public let separateWithEmptyLine: Bool } extension TranslateOptions: TomlCodable { @@ -25,6 +26,7 @@ extension TranslateOptions: TomlCodable { let paths = toml.filePaths(update, translate, singularKey: "path", pluralKey: "paths") let subpathsToIgnore = toml.array(update, translate, "subpathsToIgnore") ?? Constants.defaultSubpathsToIgnore let sourceLocale: String = toml.string(update, translate, "sourceLocale") ?? "en" + let separateWithEmptyLine = toml.bool(update, translate, "separateWithEmptyLine") ?? true let secret: Secret switch Translator(rawValue: translator) { case .microsoftTranslator, .none: @@ -38,7 +40,8 @@ extension TranslateOptions: TomlCodable { paths: paths, subpathsToIgnore: subpathsToIgnore, secret: secret, - sourceLocale: sourceLocale + sourceLocale: sourceLocale, + separateWithEmptyLine: separateWithEmptyLine ) } else { @@ -56,13 +59,14 @@ extension TranslateOptions: TomlCodable { lines.append("subpathsToIgnore = \(subpathsToIgnore)") switch secret { case let .deepL(secret): - lines.append("secret = \"\(secret)\"") + lines.append(#"secret = "\#(secret)""#) case let .microsoftTranslator(secret): - lines.append("secret = \"\(secret)\"") + lines.append(#"secret = "\#(secret)""#) } - lines.append("sourceLocale = \"\(sourceLocale)\"") + lines.append(#"sourceLocale = "\#(sourceLocale)""#) + lines.append("separateWithEmptyLine = \(self.separateWithEmptyLine)") return lines.joined(separator: "\n") } diff --git a/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift b/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift index d206922..d5ad0c9 100644 --- a/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift +++ b/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift @@ -46,7 +46,8 @@ public class StringsFileUpdater { keepExistingKeys: Bool = false, overrideComments: Bool = false, keepWhitespaceSurroundings: Bool = false, - ignoreEmptyStrings: Bool = false + ignoreEmptyStrings: Bool = false, + separateWithEmptyLine: Bool = true ) { do { let newContentString = try String(contentsOfFile: otherStringFilePath) @@ -132,14 +133,18 @@ public class StringsFileUpdater { return translations.sorted(by: sortingClosure) }() - rewriteFile(with: updatedTranslations, keepWhitespaceSurroundings: keepWhitespaceSurroundings) + rewriteFile( + with: updatedTranslations, + keepWhitespaceSurroundings: keepWhitespaceSurroundings, + separateWithEmptyLine: separateWithEmptyLine + ) } catch { print(error.localizedDescription, level: .error, file: path) } } - func insert(translateEntries: [CodeFileHandler.TranslateEntry]) { + func insert(translateEntries: [CodeFileHandler.TranslateEntry], separateWithEmptyLine: Bool) { guard let langCode = extractLangCode(fromPath: path) else { print("Could not extract langCode from file.", level: .warning, file: path) return @@ -151,14 +156,22 @@ public class StringsFileUpdater { } let newTranslations: [TranslationEntry] = translateEntries.map { ($0.key, getTranslation($0), $0.comment, 0) } - rewriteFile(with: oldTranslations + newTranslations, keepWhitespaceSurroundings: true) + rewriteFile( + with: oldTranslations + newTranslations, + keepWhitespaceSurroundings: true, + separateWithEmptyLine: separateWithEmptyLine + ) } - public func sortByKeys(keepWhitespaceSurroundings: Bool = false) { + public func sortByKeys(separateWithEmptyLine: Bool, keepWhitespaceSurroundings: Bool = false) { let translations = findTranslations(inString: oldContentString) let sortedTranslations = translations.sorted(by: translationEntrySortingClosure(lhs:rhs:), stable: true) - rewriteFile(with: sortedTranslations, keepWhitespaceSurroundings: false) + rewriteFile( + with: sortedTranslations, + keepWhitespaceSurroundings: false, + separateWithEmptyLine: separateWithEmptyLine + ) } private func translationEntrySortingClosure(lhs: TranslationEntry, rhs: TranslationEntry) -> Bool { @@ -181,9 +194,13 @@ public class StringsFileUpdater { } // Rewrites file with specified translations and reloads lines from new file. - func rewriteFile(with translations: [TranslationEntry], keepWhitespaceSurroundings: Bool) { + func rewriteFile(with translations: [TranslationEntry], keepWhitespaceSurroundings: Bool, separateWithEmptyLine: Bool) + { do { - var newContentsOfFile = stringFromTranslations(translations: translations) + var newContentsOfFile = stringFromTranslations( + translations: translations, + separateWithEmptyLine: separateWithEmptyLine + ) if keepWhitespaceSurroundings { var whitespacesOrNewlinesAtEnd = "" @@ -239,6 +256,7 @@ public class StringsFileUpdater { public func translateEmptyValues( usingValuesFromStringsFile sourceStringsFilePath: String, clientSecret: Secret, + separateWithEmptyLine: Bool, override: Bool = false ) throws -> Int { guard let (sourceLanguage, sourceRegion) = extractLocale(fromPath: sourceStringsFilePath) else { @@ -356,7 +374,13 @@ public class StringsFileUpdater { } } - if translatedValuesCount > 0 { rewriteFile(with: updatedTargetTranslations, keepWhitespaceSurroundings: false) } + if translatedValuesCount > 0 { + rewriteFile( + with: updatedTargetTranslations, + keepWhitespaceSurroundings: false, + separateWithEmptyLine: separateWithEmptyLine + ) + } return translatedValuesCount } @@ -408,14 +432,14 @@ public class StringsFileUpdater { return translations } - func stringFromTranslations(translations: [TranslationEntry]) -> String { + func stringFromTranslations(translations: [TranslationEntry], separateWithEmptyLine: Bool) -> String { return translations.map { key, value, comment, _ -> String in let translationLine = "\"\(key)\" = \"\(value)\";" if let comment = comment { return "/*\(comment)*/\n" + translationLine } return translationLine } - .joined(separator: "\n\n") + "\n" + .joined(separator: separateWithEmptyLine ? "\n\n" : "\n") + "\n" } /// Extracts locale from a path containing substring `{language}-{region}.lproj` or `{language}.lproj`. @@ -465,7 +489,7 @@ public class StringsFileUpdater { return translations.filter { $0.value.isEmpty } } - func harmonizeKeys(withSource sourceFilePath: String) throws { + func harmonizeKeys(withSource sourceFilePath: String, separateWithEmptyLine: Bool) throws { let sourceFileContentString = try String(contentsOfFile: sourceFilePath) let sourceTranslations = findTranslations(inString: sourceFileContentString) @@ -501,7 +525,7 @@ public class StringsFileUpdater { fixedTranslations = fixedTranslations.filter { $0.key != keyToRemove } } - rewriteFile(with: fixedTranslations, keepWhitespaceSurroundings: true) + rewriteFile(with: fixedTranslations, keepWhitespaceSurroundings: true, separateWithEmptyLine: separateWithEmptyLine) } } diff --git a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift index 45309eb..4fc0b4c 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift @@ -111,7 +111,8 @@ public class CommandLineActor { override: Bool, verbose: Bool, secret: Secret, - locale: String + locale: String, + separateWithEmptyLine: Bool ) { let inputFilePaths = paths.flatMap { @@ -132,7 +133,14 @@ public class CommandLineActor { let outputStringsFilePaths = StringsFilesSearch.shared.findAllLocalesForStringsFile(sourceFilePath: inputFilePath) .filter { $0 != inputFilePath } - self.translate(secret: secret, inputFilePath, outputStringsFilePaths, override: override, verbose: verbose) + self.translate( + secret: secret, + inputFilePath, + outputStringsFilePaths, + override: override, + verbose: verbose, + separateWithEmptyLine: separateWithEmptyLine + ) } } @@ -143,7 +151,8 @@ public class CommandLineActor { verbose: Bool, locale: String, sortByKeys: Bool, - harmonizeWithSource: Bool + harmonizeWithSource: Bool, + separateWithEmptyLine: Bool ) { let sourceFilePaths = paths.flatMap { @@ -176,7 +185,8 @@ public class CommandLineActor { for filePath in targetStringsFilePaths { let stringsFileUpdater = StringsFileUpdater(path: filePath) do { - try stringsFileUpdater?.harmonizeKeys(withSource: sourceFilePath) + try stringsFileUpdater? + .harmonizeKeys(withSource: sourceFilePath, separateWithEmptyLine: separateWithEmptyLine) } catch { print("Could not harmonize keys with source file at path \(sourceFilePath).", level: .error) @@ -188,7 +198,7 @@ public class CommandLineActor { if sortByKeys { for filePath in allStringsFilePaths { let stringsFileUpdater = StringsFileUpdater(path: filePath) - stringsFileUpdater?.sortByKeys() + stringsFileUpdater?.sortByKeys(separateWithEmptyLine: separateWithEmptyLine) } } } @@ -418,7 +428,8 @@ public class CommandLineActor { _ inputFilePath: String, _ outputStringsFilePaths: [String], override: Bool, - verbose: Bool + verbose: Bool, + separateWithEmptyLine: Bool ) { var overallTranslatedValuesCount = 0 var filesWithTranslatedValuesCount = 0 @@ -430,6 +441,7 @@ public class CommandLineActor { let translationsCount = try stringsFileUpdater.translateEmptyValues( usingValuesFromStringsFile: inputFilePath, clientSecret: secret, + separateWithEmptyLine: separateWithEmptyLine, override: override ) diff --git a/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift index bc87edf..459ed09 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift @@ -3,12 +3,6 @@ import Foundation struct CodeTaskHandler { let options: CodeOptions - - init( - options: CodeOptions - ) { - self.options = options - } } extension CodeTaskHandler: TaskHandler { diff --git a/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift index 852abaf..6be329f 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift @@ -3,12 +3,6 @@ import Foundation struct InterfacesTaskHandler { let options: InterfacesOptions - - init( - options: InterfacesOptions - ) { - self.options = options - } } extension InterfacesTaskHandler: TaskHandler { diff --git a/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift index 18a5bd0..819b373 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift @@ -3,12 +3,6 @@ import Foundation struct LintTaskHandler { let options: LintOptions - - init( - options: LintOptions - ) { - self.options = options - } } extension LintTaskHandler: TaskHandler { diff --git a/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift index b99a245..aaed6f7 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift @@ -3,12 +3,6 @@ import Foundation struct NormalizeTaskHandler { let options: NormalizeOptions - - init( - options: NormalizeOptions - ) { - self.options = options - } } extension NormalizeTaskHandler: TaskHandler { @@ -23,7 +17,8 @@ extension NormalizeTaskHandler: TaskHandler { verbose: GlobalOptions.verbose.value, locale: options.sourceLocale, sortByKeys: options.sortByKeys, - harmonizeWithSource: options.harmonizeWithSource + harmonizeWithSource: options.harmonizeWithSource, + separateWithEmptyLine: options.separateWithEmptyLine ) } } diff --git a/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift index 35cfd97..fdb3a79 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift @@ -3,12 +3,6 @@ import Foundation struct TransformTaskHandler { let options: TransformOptions - - init( - options: TransformOptions - ) { - self.options = options - } } extension TransformTaskHandler: TaskHandler { @@ -71,7 +65,11 @@ extension TransformTaskHandler: TaskHandler { ) for stringsFile in stringsFiles { - StringsFileUpdater(path: stringsFile)!.insert(translateEntries: translateEntries) + StringsFileUpdater(path: stringsFile)! + .insert( + translateEntries: translateEntries, + separateWithEmptyLine: self.options.separateWithEmptyLine + ) } } } diff --git a/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift index 1754a6b..4d0e5fd 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift @@ -3,12 +3,6 @@ import Foundation struct TranslateTaskHandler { let options: TranslateOptions - - init( - options: TranslateOptions - ) { - self.options = options - } } extension TranslateTaskHandler: TaskHandler { @@ -24,7 +18,8 @@ extension TranslateTaskHandler: TaskHandler { override: false, verbose: GlobalOptions.verbose.value, secret: options.secret, - locale: options.sourceLocale + locale: options.sourceLocale, + separateWithEmptyLine: self.options.separateWithEmptyLine ) } } diff --git a/Tests/BartyCrouchConfigurationTests/ConfigurationTests.swift b/Tests/BartyCrouchConfigurationTests/ConfigurationTests.swift index 85ebe61..54a6566 100644 --- a/Tests/BartyCrouchConfigurationTests/ConfigurationTests.swift +++ b/Tests/BartyCrouchConfigurationTests/ConfigurationTests.swift @@ -177,12 +177,14 @@ class ConfigurationTests: XCTestCase { supportedLanguageEnumPath = "." typeName = "BartyCrouch" translateMethodName = "translate" + separateWithEmptyLine = true [update.translate] paths = ["Sources"] subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"] secret = "bingSecret" sourceLocale = "de" + separateWithEmptyLine = true [update.normalize] paths = ["Sources"] @@ -190,6 +192,7 @@ class ConfigurationTests: XCTestCase { sourceLocale = "de" harmonizeWithSource = false sortByKeys = false + separateWithEmptyLine = true [lint] paths = ["Sources"] @@ -201,6 +204,6 @@ class ConfigurationTests: XCTestCase { let toml: Toml = try! Toml(withString: tomlContents) let configuration: Configuration = try! Configuration.make(toml: toml) - XCTAssertNoDifference(configuration.tomlContents(), tomlContents) + XCTAssertNoDifference(tomlContents, configuration.tomlContents()) } } diff --git a/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift b/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift index 2f72a16..040f6c5 100644 --- a/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift +++ b/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift @@ -162,7 +162,8 @@ class DemoTests: XCTestCase { paths: ["."], subpathsToIgnore: [], secret: .microsoftTranslator(secret: microsoftSubscriptionKey), - sourceLocale: "en" + sourceLocale: "en", + separateWithEmptyLine: true ) TranslateTaskHandler(options: translateOptions).perform() @@ -254,7 +255,8 @@ class DemoTests: XCTestCase { supportedLanguageEnumPath: ".", typeName: "BartyCrouch", translateMethodName: "translate", - customLocalizableName: nil + customLocalizableName: nil, + separateWithEmptyLine: true ) TransformTaskHandler(options: transformOptions).perform() From d26f95d03cd04d415445d1f30c89f96dcafa2edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 27 May 2022 16:38:07 +0200 Subject: [PATCH 2/2] Document changes of #254 --- CHANGELOG.md | 77 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceeabf5..3d8a015 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Each entry should use the following format: ```markdown - Summary of what was changed in a single line using past tense & followed by two whitespaces. - Issue: [#0](https://github.com/Flinesoft/BartyCrouch/issues/0) | PR: [#0](https://github.com/Flinesoft/BartyCrouch/pull/0) | Author: [Cihat Gündüz](https://github.com/Jeehut) + Issue: [#0](https://github.com/FlineDev/BartyCrouch/issues/0) | PR: [#0](https://github.com/FlineDev/BartyCrouch/pull/0) | Author: [Cihat Gündüz](https://github.com/Jeehut) ``` Note that at the end of the summary line, you need to add two whitespaces (` `) for correct rendering on GitHub. @@ -19,7 +19,8 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [Unreleased] ### Added -- None. +- Adds new `separateWithEmptyLine` options to allow removing the empty line between Strings entries. + Issues: [#251](https://github.com/FlineDev/BartyCrouch/issues/251) | PR: [#254](https://github.com/FlineDev/BartyCrouch/pull/254) | Author: [Cihat Gündüz](https://github.com/Jeehut) ### Changed - None. ### Deprecated @@ -35,21 +36,21 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [4.10.2] - 2022-03-26 ### Changed - Update SwiftSyntax dependency to Swift 5.5 to support Xcode 13. - Issues: [#201](https://github.com/Flinesoft/BartyCrouch/issues/201), [#249](https://github.com/Flinesoft/BartyCrouch/issues/249) | Author: [Cihat Gündüz](https://github.com/Jeehut) + Issues: [#201](https://github.com/FlineDev/BartyCrouch/issues/201), [#249](https://github.com/FlineDev/BartyCrouch/issues/249) | Author: [Cihat Gündüz](https://github.com/Jeehut) ## [4.9.0] - 2022-01-21 ### Added - Added a new option `ignoreKeys` to provide custom alternatives to the default `bc-ignore` kind of keys if needed. New option defaults to `["#bartycrouch-ignore!", "#bc-ignore!", "#i!"]` if not specified otherwise. - PR: [#242](https://github.com/Flinesoft/BartyCrouch/pull/242) | Author: [Cihat Gündüz](https://github.com/Jeehut) + PR: [#242](https://github.com/FlineDev/BartyCrouch/pull/242) | Author: [Cihat Gündüz](https://github.com/Jeehut) - Added a new option `subpathsToIgnore` to provide subpaths to be ignored (with case-insensitive comparison) inside of the provided `paths`. New option defaults to `[".git", "carthage", "pods", "build", ".build", "docs"]` if not specified otherwise. - PR: [#242](https://github.com/Flinesoft/BartyCrouch/pull/242) | Author: [Cihat Gündüz](https://github.com/Jeehut) + PR: [#242](https://github.com/FlineDev/BartyCrouch/pull/242) | Author: [Cihat Gündüz](https://github.com/Jeehut) ### Fixed - Removed ignoring all `InfoPlist.strings` files by default. If you want this to actually be the case, just add `InfoPlist.strings` to the array in the new `subpathsToIgnore` option, e.g.: `subPathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs", "InfoPlist.strings"]` - PR: [#242](https://github.com/Flinesoft/BartyCrouch/pull/242) | Author: [Cihat Gündüz](https://github.com/Jeehut) + PR: [#242](https://github.com/FlineDev/BartyCrouch/pull/242) | Author: [Cihat Gündüz](https://github.com/Jeehut) - Less situations where the empty `tmpstring` folder continues to exist. - PR: [#238](https://github.com/Flinesoft/BartyCrouch/pull/238) | Author: [Benjamin Erhart](https://github.com/tladesignz) + PR: [#238](https://github.com/FlineDev/BartyCrouch/pull/238) | Author: [Benjamin Erhart](https://github.com/tladesignz) - Only apply ignores on subpaths of explicitly mentioned folders in `path` options, don't ignore any paths that are explicitly mentioned. - PR: [#240](https://github.com/Flinesoft/BartyCrouch/pull/240) | Author: [Benjamin Erhart](https://github.com/tladesignz) + PR: [#240](https://github.com/FlineDev/BartyCrouch/pull/240) | Author: [Benjamin Erhart](https://github.com/tladesignz) ## [4.8.0] - 2021-10-10 ### Changed @@ -59,22 +60,22 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [4.7.1] - 2021-08-26 ### Fixed - Fixed that DeepL translation doesn't work for Simplified Chinese. - PR: [#232](https://github.com/Flinesoft/BartyCrouch/pull/232) | Author: [Manabu Nakazawa](https://github.com/mshibanami) + PR: [#232](https://github.com/FlineDev/BartyCrouch/pull/232) | Author: [Manabu Nakazawa](https://github.com/mshibanami) ## [4.7.0] - 2021-07-31 ### Added - Add support for DeepL API Free - PR: [#230](https://github.com/Flinesoft/BartyCrouch/pull/230) | Author: [Manabu Nakazawa](https://github.com/mshibanami) + PR: [#230](https://github.com/FlineDev/BartyCrouch/pull/230) | Author: [Manabu Nakazawa](https://github.com/mshibanami) ## [4.6.0] - 2021-05-08 ### Changed - Updated swift-syntax to match Swift 5.4 to support Xcode 12.5. - Issues: [#222](https://github.com/Flinesoft/BartyCrouch/issues/222) | PR: [#223](https://github.com/Flinesoft/BartyCrouch/pull/223) | Author: [Matt Sanford](https://github.com/mzsanford) + Issues: [#222](https://github.com/FlineDev/BartyCrouch/issues/222) | PR: [#223](https://github.com/FlineDev/BartyCrouch/pull/223) | Author: [Matt Sanford](https://github.com/mzsanford) ## [4.5.0] - 2021-02-21 ### Added - Add support for DeepL API as an alternative for Microsoft Translator API. - PR: [#220](https://github.com/Flinesoft/BartyCrouch/pull/220) | Author: [noppe](https://github.com/noppefoxwolf) + PR: [#220](https://github.com/FlineDev/BartyCrouch/pull/220) | Author: [noppe](https://github.com/noppefoxwolf) ## [4.4.1] - 2021-01-16 ### Fixed @@ -84,78 +85,78 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [4.4.0] - 2021-01-16 ### Changed - Updated languages supported by Microsoft Translator – 17 more languages available now! - Issue: [#216](https://github.com/Flinesoft/BartyCrouch/issues/216) | PR: [#219](https://github.com/Flinesoft/BartyCrouch/pull/219) | Author: [Jamie Gough](https://github.com/jamiegough) + Issue: [#216](https://github.com/FlineDev/BartyCrouch/issues/216) | PR: [#219](https://github.com/FlineDev/BartyCrouch/pull/219) | Author: [Jamie Gough](https://github.com/jamiegough) - BartyCrouch doesn't fail anymore when there's a language not supported by Microsoft Translator (yet) – it prints a warning instead. - Issue: [#215](https://github.com/Flinesoft/BartyCrouch/issues/215) | PR: [#219](https://github.com/Flinesoft/BartyCrouch/pull/219) | Author: [Jamie Gough](https://github.com/jamiegough) + Issue: [#215](https://github.com/FlineDev/BartyCrouch/issues/215) | PR: [#219](https://github.com/FlineDev/BartyCrouch/pull/219) | Author: [Jamie Gough](https://github.com/jamiegough) ## [4.3.2] - 2020-12-24 ### Fixed - Fixed an issue where BartyCrouch did not skip the directories ".git", "Carthage", "Pods", "build", ".build", "docs" anymore. - Issues: [#213](https://github.com/Flinesoft/BartyCrouch/issues/213), [#2](https://github.com/Flinesoft/BartyCrouch/issues/177) | PR: [#214](https://github.com/Flinesoft/BartyCrouch/pull/214) | Author: [Bill Panagiotopoulos](https://github.com/billp) + Issues: [#213](https://github.com/FlineDev/BartyCrouch/issues/213), [#2](https://github.com/FlineDev/BartyCrouch/issues/177) | PR: [#214](https://github.com/FlineDev/BartyCrouch/pull/214) | Author: [Bill Panagiotopoulos](https://github.com/billp) ## [4.3.1] - 2020-10-06 ### Fixed - Fix missing usage of `harmonizeWithSource` parameter for `normalize` task. - Issue: [#196](https://github.com/Flinesoft/BartyCrouch/issues/196) | PR: [#182](https://github.com/Flinesoft/BartyCrouch/pull/197) | Author: [Marco Pagliari](https://github.com/lechuckcaptain) + Issue: [#196](https://github.com/FlineDev/BartyCrouch/issues/196) | PR: [#182](https://github.com/FlineDev/BartyCrouch/pull/197) | Author: [Marco Pagliari](https://github.com/lechuckcaptain) ## [4.3.0] - 2020-09-28 ### Changed - Updated swift-syntax to match Swift 5.3. - Issues: [#199](https://github.com/Flinesoft/BartyCrouch/issues/199), [#201](https://github.com/Flinesoft/BartyCrouch/issues/201) | PR: [#204](https://github.com/Flinesoft/BartyCrouch/pull/204) | Author: [w8wjb](https://github.com/w8wjb) + Issues: [#199](https://github.com/FlineDev/BartyCrouch/issues/199), [#201](https://github.com/FlineDev/BartyCrouch/issues/201) | PR: [#204](https://github.com/FlineDev/BartyCrouch/pull/204) | Author: [w8wjb](https://github.com/w8wjb) ## [4.2.0] - 2020-04-24 ### Added - Added new `-p` / `--path` option to run BartyCrouch from a different path than current. - Issues: [#166](https://github.com/Flinesoft/BartyCrouch/issues/166), [#177](https://github.com/Flinesoft/BartyCrouch/issues/177) | PR: [#181](https://github.com/Flinesoft/BartyCrouch/pull/181) | Author: [Cihat Gündüz](https://github.com/Jeehut) + Issues: [#166](https://github.com/FlineDev/BartyCrouch/issues/166), [#177](https://github.com/FlineDev/BartyCrouch/issues/177) | PR: [#181](https://github.com/FlineDev/BartyCrouch/pull/181) | Author: [Cihat Gündüz](https://github.com/Jeehut) ### Removed - Removed code magic that used the localization comment from Interface Builder files as a source for new translation values. - Issue: [#140](https://github.com/Flinesoft/BartyCrouch/issues/140) | PR: [#182](https://github.com/Flinesoft/BartyCrouch/pull/182) | Author: [Cihat Gündüz](https://github.com/Jeehut) + Issue: [#140](https://github.com/FlineDev/BartyCrouch/issues/140) | PR: [#182](https://github.com/FlineDev/BartyCrouch/pull/182) | Author: [Cihat Gündüz](https://github.com/Jeehut) ### Fixed - Normalize sortByKeys no longer adds empty line to begining of .strings file. - Issue: [#178](https://github.com/Flinesoft/BartyCrouch/issues/178) | PR: [#180](https://github.com/Flinesoft/BartyCrouch/pull/180) | Author: [Patrick Wolowicz](https://github.com/hactar) + Issue: [#178](https://github.com/FlineDev/BartyCrouch/issues/178) | PR: [#180](https://github.com/FlineDev/BartyCrouch/pull/180) | Author: [Patrick Wolowicz](https://github.com/hactar) ## [4.1.1] - 2020-04-16 ### Fixed - Fixed crashes in projects with large number of files by introducing new `plist` file based approach for passing arguments. See the new `--plist-arguments` option. Will be automatically turned on when needed (many files in project). - Issues: [#92](https://github.com/Flinesoft/BartyCrouch/issues/92), [#99](https://github.com/Flinesoft/BartyCrouch/issues/99) | PRs: [#150](https://github.com/Flinesoft/BartyCrouch/pull/150), [#176](https://github.com/Flinesoft/BartyCrouch/pull/176) | Authors: [Christos Koninis](https://github.com/csknns), [Cihat Gündüz](https://github.com/Jeehut) + Issues: [#92](https://github.com/FlineDev/BartyCrouch/issues/92), [#99](https://github.com/FlineDev/BartyCrouch/issues/99) | PRs: [#150](https://github.com/FlineDev/BartyCrouch/pull/150), [#176](https://github.com/FlineDev/BartyCrouch/pull/176) | Authors: [Christos Koninis](https://github.com/csknns), [Cihat Gündüz](https://github.com/Jeehut) ## [4.1.0] - 2020-04-10 ### Added - Added support for specifying multiple paths for all `path` options. - Issue: [#155](https://github.com/Flinesoft/BartyCrouch/issues/155) | PR: [#167](https://github.com/Flinesoft/HandySwift/pull/167) | Author: [Frederick Pietschmann](https://github.com/fredpi) + Issue: [#155](https://github.com/FlineDev/BartyCrouch/issues/155) | PR: [#167](https://github.com/FlineDev/HandySwift/pull/167) | Author: [Frederick Pietschmann](https://github.com/fredpi) ### Changed - Upgraded SwiftSyntax to Swift 5.2 version `0.50200.0`. - Issue: [#170](https://github.com/Flinesoft/BartyCrouch/issues/170) | PRs: [#171](https://github.com/Flinesoft/BartyCrouch/pull/171), [#172](https://github.com/Flinesoft/BartyCrouch/pull/172), [#173](https://github.com/Flinesoft/BartyCrouch/pull/173) | Authors: [Tomoya Hirano](https://github.com/noppefoxwolf), [Cihat Gündüz](https://github.com/Jeehut) + Issue: [#170](https://github.com/FlineDev/BartyCrouch/issues/170) | PRs: [#171](https://github.com/FlineDev/BartyCrouch/pull/171), [#172](https://github.com/FlineDev/BartyCrouch/pull/172), [#173](https://github.com/FlineDev/BartyCrouch/pull/173) | Authors: [Tomoya Hirano](https://github.com/noppefoxwolf), [Cihat Gündüz](https://github.com/Jeehut) - Updated all dependencies to their latest versions to prevent warnings. - PR: [#172](https://github.com/Flinesoft/BartyCrouch/pull/172) | Author: [Cihat Gündüz](https://github.com/Jeehut) + PR: [#172](https://github.com/FlineDev/BartyCrouch/pull/172) | Author: [Cihat Gündüz](https://github.com/Jeehut) ## [4.0.2] - 2019-05-13 ### Fixed -- Make Code Transform, Normalize & Lint fast again (up to 50x faster). Fixes [#128](https://github.com/Flinesoft/BartyCrouch/issues/128) by [Frederick Pietschmann](https://github.com/fredpi). +- Make Code Transform, Normalize & Lint fast again (up to 50x faster). Fixes [#128](https://github.com/FlineDev/BartyCrouch/issues/128) by [Frederick Pietschmann](https://github.com/fredpi). ## [4.0.1] - 2019-03-26 ### Added - Support for Swift 5.0 and Xcode 10.2 command line tools. By [Cihat Gündüz](https://github.com/Dschee). ### Changed -- Don't rewrite files if they didn't change to improve performance. Via [#111](https://github.com/Flinesoft/BartyCrouch/issues/120) by [Keith Bauer](https://github.com/OneSadCookie). +- Don't rewrite files if they didn't change to improve performance. Via [#111](https://github.com/FlineDev/BartyCrouch/issues/120) by [Keith Bauer](https://github.com/OneSadCookie). ### Deprecated - None. ### Removed - Support for Swift 4.2 and Xcode <=10.1. If you need to run BartyCrouch with older Xcode versions and had a previous version of BartyCrouch installed, then simply switch to it via `brew switch bartycrouch 4.0.0`. By [Cihat Gündüz](https://github.com/Dschee). ### Fixed -- Turns off multiple key/value pairs warning by default. Fixes [#120](https://github.com/Flinesoft/BartyCrouch/issues/120) via [#121](https://github.com/Flinesoft/BartyCrouch/pull/121) by [Robert Baker](https://github.com/magneticrob). +- Turns off multiple key/value pairs warning by default. Fixes [#120](https://github.com/FlineDev/BartyCrouch/issues/120) via [#121](https://github.com/FlineDev/BartyCrouch/pull/121) by [Robert Baker](https://github.com/magneticrob). ### Security - None. ## [4.0.0] - 2019-02-04 ### Added -- Support for [installation](https://github.com/Flinesoft/BartyCrouch#installation) via Mint (SwiftSPM based). -- Use [configuration file](https://github.com/Flinesoft/BartyCrouch#configuration) instead of thousands of command line options. -- [Demo project based](https://github.com/Flinesoft/BartyCrouch/tree/stable/Demo/Untouched) integration tests. +- Support for [installation](https://github.com/FlineDev/BartyCrouch#installation) via Mint (SwiftSPM based). +- Use [configuration file](https://github.com/FlineDev/BartyCrouch#configuration) instead of thousands of command line options. +- [Demo project based](https://github.com/FlineDev/BartyCrouch/tree/stable/Demo/Untouched) integration tests. - Sophisticated [SwiftGen](https://github.com/SwiftGen/SwiftGen)-Integration (automatic static NSLocalizedString code replacement) via new `transform` option. ### Changed - All subcommands except `lint` were bundled into the `update` subcommand. -- [Own client implementation](https://github.com/Flinesoft/BartyCrouch/tree/stable/Sources/BartyCrouchTranslator) of updated Microsowft Translator API. +- [Own client implementation](https://github.com/FlineDev/BartyCrouch/tree/stable/Sources/BartyCrouchTranslator) of updated Microsowft Translator API. ### Deprecated - None. ### Removed @@ -169,7 +170,7 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [3.13.1] - 2018-07-26 ### Added - Added ability to ignore empty strings. - via [#107](https://github.com/Flinesoft/BartyCrouch/pull/107) by [Ludvig Eriksson](https://github.com/ludvigeriksson) + via [#107](https://github.com/FlineDev/BartyCrouch/pull/107) by [Ludvig Eriksson](https://github.com/ludvigeriksson) ### Changed - Restructure code for SPM compatibility. - Introduce CHANGELOG.md, CONTRIBUTION.md and CODE_OF_CONDUCT.md @@ -222,7 +223,7 @@ This will: ## [3.10.1] - 2018-03-08 ### Fixed -- Reverts [#67](https://github.com/Flinesoft/BartyCrouch/issues/67) to fix [#11](https://github.com/Flinesoft/BartyCrouch/issues/11) and [#88](https://github.com/Flinesoft/BartyCrouch/issues/88). +- Reverts [#67](https://github.com/FlineDev/BartyCrouch/issues/67) to fix [#11](https://github.com/FlineDev/BartyCrouch/issues/11) and [#88](https://github.com/FlineDev/BartyCrouch/issues/88). ## [3.10.0] - 2018-02-05 ### Added @@ -231,21 +232,21 @@ This will: ## [3.9.2] - 2018-01-09 ### Fixed -Fixes [#72](https://github.com/Flinesoft/BartyCrouch/issues/72). +Fixes [#72](https://github.com/FlineDev/BartyCrouch/issues/72). ## [3.9.1] - 2017-12-11 ### Fixed -Fixes [#65](https://github.com/Flinesoft/BartyCrouch/issues/65). +Fixes [#65](https://github.com/FlineDev/BartyCrouch/issues/65). ## [3.9.0] - 2017-09-26 ### Changed - Update to Swift 4 & Xcode 9 ### Fixed -Fixes [#66](https://github.com/Flinesoft/BartyCrouch/issues/66). +Fixes [#66](https://github.com/FlineDev/BartyCrouch/issues/66). ## [3.8.1] - 2017-08-02 ### Fixed -Fixes [#55](https://github.com/Flinesoft/BartyCrouch/issues/55), [#60](https://github.com/Flinesoft/BartyCrouch/issues/60) and [#63](https://github.com/Flinesoft/BartyCrouch/issues/63). +Fixes [#55](https://github.com/FlineDev/BartyCrouch/issues/55), [#60](https://github.com/FlineDev/BartyCrouch/issues/60) and [#63](https://github.com/FlineDev/BartyCrouch/issues/63). ## [3.8.0] - 2017-05-22 ### Added @@ -305,7 +306,7 @@ See also their documentation sections in the README for additional details. ### Removed - Input (`-i`), Exclude (`-e`) and Output (`-o`) options -Please have a look at the [migration guide](https://github.com/Flinesoft/BartyCrouch#migration-guides) for a flawless upgrade from version 2.x. +Please have a look at the [migration guide](https://github.com/FlineDev/BartyCrouch#migration-guides) for a flawless upgrade from version 2.x. ## [2.0.0] - 2016-04-30