diff --git a/Example-App/Android/app/src/main/res/values-de/Lingua-General.xml b/Example-App/Android/app/src/main/res/values-de/Lingua-General.xml index 2e3e1ec..5ceec19 100644 --- a/Example-App/Android/app/src/main/res/values-de/Lingua-General.xml +++ b/Example-App/Android/app/src/main/res/values-de/Lingua-General.xml @@ -1,6 +1,7 @@ - - + + Erfolg + Speichern diff --git a/Example-App/Android/app/src/main/res/values/Lingua-General.xml b/Example-App/Android/app/src/main/res/values/Lingua-General.xml index 09e475e..e1f5697 100644 --- a/Example-App/Android/app/src/main/res/values/Lingua-General.xml +++ b/Example-App/Android/app/src/main/res/values/Lingua-General.xml @@ -1,6 +1,7 @@ - - + + Success + Save diff --git a/Example-App/iOS/Example-App/Example-App/Resources/Localization/Lingua.swift b/Example-App/iOS/Example-App/Example-App/Resources/Localization/Lingua.swift index f600bd2..51fd6f1 100644 --- a/Example-App/iOS/Example-App/Example-App/Resources/Localization/Lingua.swift +++ b/Example-App/iOS/Example-App/Example-App/Resources/Localization/Lingua.swift @@ -1,12 +1,13 @@ +// swiftlint:disable all // This file was generated with Lingua command line tool. Please do not change it! // Source: https://github.com/poviolabs/Lingua -// swiftlint:disable all import Foundation enum Lingua { enum General { - + /// Save + static let save = tr("General", "save") /// Success static let success = tr("General", "success") } diff --git a/Example-App/iOS/Example-App/Example-App/Resources/Localization/de.lproj/General.strings b/Example-App/iOS/Example-App/Example-App/Resources/Localization/de.lproj/General.strings index 35fe71d..4118ad0 100644 --- a/Example-App/iOS/Example-App/Example-App/Resources/Localization/de.lproj/General.strings +++ b/Example-App/iOS/Example-App/Example-App/Resources/Localization/de.lproj/General.strings @@ -2,3 +2,4 @@ // Source: https://github.com/poviolabs/Lingua "success" = "Erfolg"; +"save" = "Speichern"; diff --git a/Example-App/iOS/Example-App/Example-App/Resources/Localization/en.lproj/General.strings b/Example-App/iOS/Example-App/Example-App/Resources/Localization/en.lproj/General.strings index a06f74b..23bba16 100644 --- a/Example-App/iOS/Example-App/Example-App/Resources/Localization/en.lproj/General.strings +++ b/Example-App/iOS/Example-App/Example-App/Resources/Localization/en.lproj/General.strings @@ -2,3 +2,4 @@ // Source: https://github.com/poviolabs/Lingua "success" = "Success"; +"save" = "Save"; diff --git a/Sources/Lingua/Common/Extensions/String+Extension.swift b/Sources/Lingua/Common/Extensions/String+Extension.swift index 8a6bc3d..7b3da3e 100644 --- a/Sources/Lingua/Common/Extensions/String+Extension.swift +++ b/Sources/Lingua/Common/Extensions/String+Extension.swift @@ -2,7 +2,7 @@ import Foundation extension String { static let packageName = "Lingua" - static let version = "0.2.4" + static let version = "0.2.6" static let swiftLocalizedName = "\(String.packageName).swift" static let fileHeader = """ This file was generated with Lingua command line tool. Please do not change it! diff --git a/Sources/Lingua/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatter.swift b/Sources/Lingua/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatter.swift index 9199197..c59fec9 100644 --- a/Sources/Lingua/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatter.swift +++ b/Sources/Lingua/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatter.swift @@ -8,6 +8,6 @@ struct IOSNonPluralFormatter: LocalizedContentFormatting { } func wrapContent(_ content: String) -> String { - [String.fileHeader.commentOut(for: .ios), content].joined(separator: "\n") + String.fileHeader.commentOut(for: .ios) + "\n\n" + content } } diff --git a/Sources/Lingua/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGenerator.swift b/Sources/Lingua/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGenerator.swift index 3214fe5..fee1034 100644 --- a/Sources/Lingua/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGenerator.swift +++ b/Sources/Lingua/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGenerator.swift @@ -47,7 +47,7 @@ private extension LocalizedSwiftCodeGenerator { private extension String { func commented() -> String { components(separatedBy: "\n") - .map { "\n\t\t/// \($0)" } - .joined() + .map { "/// \($0)" } + .joined(separator: "\n\t\t") } } diff --git a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatterTests.swift b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatterTests.swift index 4ff120c..bb3b200 100644 --- a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatterTests.swift +++ b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Output/iOS/IOSNonPluralFormatterTests.swift @@ -26,7 +26,7 @@ final class IOSNonPluralFormatterTests: XCTestCase { let content = "content" let sut = makeSUT() let wrappedContent = sut.wrapContent(content) - let expectedContent = [String.fileHeader.commentOut(for: .ios), content].joined(separator: "\n") + let expectedContent = String.fileHeader.commentOut(for: .ios) + "\n\n" + content XCTAssertEqual(expectedContent, wrappedContent) } diff --git a/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGeneratorTests.swift b/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGeneratorTests.swift index 2763910..35ee4b0 100644 --- a/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGeneratorTests.swift +++ b/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/LocalizedSwiftCodeGeneratorTests.swift @@ -6,7 +6,7 @@ final class LocalizedSwiftCodeGeneratorTests: XCTestCase { let sut = makeSUT() let code = sut.generateCode(section: "section", key: "key", translation: "translation %d %@") let expectedCode = """ - \n\t\t/// translation %d %@ + /// translation %d %@ \t\tstatic func key(_ param1: Int, _ param2: String) -> String { \t\t\treturn tr("section", "key", param1, param2) \t\t} @@ -17,7 +17,7 @@ final class LocalizedSwiftCodeGeneratorTests: XCTestCase { func test_generateCode_createsStaticPropertyCode_forNoStringFormatSpecifiers() { let sut = makeSUT() let code = sut.generateCode(section: "section", key: "key", translation: "translation") - XCTAssertEqual(code, "\n\t\t/// translation\n\t\tstatic let key = tr(\"section\", \"key\")") + XCTAssertEqual(code, "/// translation\n\t\tstatic let key = tr(\"section\", \"key\")") } }