Skip to content

Commit

Permalink
Enhance file formatting (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgzonArifi authored Aug 11, 2023
1 parent 5ea5060 commit 30c12cf
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--This file was generated with Lingua command line tool. Please do not change it!-->
<!--Source: https://github.com/poviolabs/Lingua-->
<!-- This file was generated with Lingua command line tool. Please do not change it! -->
<!-- Source: https://github.com/poviolabs/Lingua -->
<resources>
<string name="general_success">Erfolg</string>
<string name="general_save">Speichern</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--This file was generated with Lingua command line tool. Please do not change it!-->
<!--Source: https://github.com/poviolabs/Lingua-->
<!-- This file was generated with Lingua command line tool. Please do not change it! -->
<!-- Source: https://github.com/poviolabs/Lingua -->
<resources>
<string name="general_success">Success</string>
<string name="general_save">Save</string>
</resources>
Original file line number Diff line number Diff line change
@@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
// Source: https://github.com/poviolabs/Lingua

"success" = "Erfolg";
"save" = "Speichern";
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
// Source: https://github.com/poviolabs/Lingua

"success" = "Success";
"save" = "Save";
2 changes: 1 addition & 1 deletion Sources/Lingua/Common/Extensions/String+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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\")")
}
}

Expand Down

0 comments on commit 30c12cf

Please sign in to comment.