Skip to content

Commit

Permalink
Merge pull request #29 from stelabouras/fix/plural-rules
Browse files Browse the repository at this point in the history
White space ICU pluralization fix
  • Loading branch information
Nikos Vasileiou authored Oct 11, 2023
2 parents 87dd281 + 4677160 commit bd4b7aa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,10 @@ the format used by Xcode and iOS is different than the format used by Transifex
(e.g `en-US` instead of `en_US`). For that reason the source locale string is
now normalized before being passed to the exporter logic so that the latter can
always be able to export the source locale from the Xcode project.

## Transifex Command Line Tool 2.1.2

*October 11, 2023*

- Fixes the issue where leading and trailing white space was being added around
the extracted ICU pluralization rules.
2 changes: 1 addition & 1 deletion Sources/TXCli/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ that can be bundled with the iOS application.
The tool can be also used to force CDS cache invalidation so that the next pull
command will fetch fresh translations from CDS.
""",
version: "2.1.1",
version: "2.1.2",
subcommands: [Push.self, Pull.self, Invalidate.self])
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/TXCliLib/XLIFFParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ extension TranslationUnit {
continue
}

icuRules.append("\(pluralRule) { \(target) }")
icuRules.append("\(pluralRule) {\(target)}")
}

guard icuRules.count > 0 else {
Expand Down
4 changes: 2 additions & 2 deletions Tests/TXCliTests/XLIFFParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ final class XLIFFParserTests: XCTestCase {
XCTAssertTrue(pluralizationRules?.count == 3)

let icuRule = results.first!.generateICURuleIfPossible()
let expectedIcuRule = "{cnt, plural, one { %d minute } other { %d minutes }}"
let expectedIcuRule = "{cnt, plural, one {%d minute} other {%d minutes}}"

XCTAssertEqual(icuRule, expectedIcuRule)
}
Expand Down Expand Up @@ -212,7 +212,7 @@ final class XLIFFParserTests: XCTestCase {
XCTAssertTrue(result.pluralizationRules!.count == 3)

let icuRule = result.generateICURuleIfPossible()
let expectedIcuRule = "{cnt, plural, one { %d minute } other { %d minutes }}"
let expectedIcuRule = "{cnt, plural, one {%d minute} other {%d minutes}}"

XCTAssertEqual(icuRule, expectedIcuRule)
}
Expand Down

0 comments on commit bd4b7aa

Please sign in to comment.