Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White space ICU pluralization fix #29

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading