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

Improve currency localization ergonomics #34

Merged
merged 1 commit into from
Mar 7, 2020
Merged

Conversation

Mordil
Copy link
Member

@Mordil Mordil commented Mar 7, 2020

Motivation:

String interpolation is powerful, but the syntax is not particularly discoverable as there is no code completion assistance, at least in Xcode.

In addition, the parameter labels don't match the Swift API Design Guidelines.

Modifications:

  • Add: localizedString(for:nilDescription:) to AnyCurrency that uses the String interpolation implementation
  • Add: localizedString(using:nilDescription:) to AnyCurrency that uses the String interpolation implementation
  • Change: (localize:withFormatter:nilDescription:) to (localize:with:nilDescription:)
  • Change: (localize:forLocale:nilDescription:) to (localize:for:nilDescription:)

Result:

Developers should have an easier time discovering the localization capabilities of currencies much easier, with more options for generating localized strings.

Motivation:

String interpolation is powerful, but the syntax is not particularly discoverable as there is no code completion assistance, at least in Xcode.

In addition, the parameter labels don't match the Swift API Design Guidelines.

Modifications:

- Add: `localizedString(for:nilDescription:)` to `AnyCurrency` that uses the String interpolation implementation
- Add: `localizedString(using:nilDescription:)` to `AnyCurrency` that uses the String interpolation implementation
- Change: `(localize:withFormatter:nilDescription:)` to `(localize:with:nilDescription:)`
- Change: `(localize:forLocale:nilDescription:)` to `(localize:for:nilDescription:)`

Result:

Developers should have an easier time discovering the localization capabilities of currencies much easier, with more options for generating localized strings.
@Mordil Mordil added the enhancement New feature or request label Mar 7, 2020
@codeclimate
Copy link

codeclimate bot commented Mar 7, 2020

Code Climate has analyzed commit 3a63bfa and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Mar 7, 2020

Codecov Report

Merging #34 into master will increase coverage by 0.23%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #34      +/-   ##
==========================================
+ Coverage   89.65%   89.88%   +0.23%     
==========================================
  Files           6        6              
  Lines         174      178       +4     
==========================================
+ Hits          156      160       +4     
  Misses         18       18              

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf39c18...3a63bfa. Read the comment docs.

@Mordil Mordil merged commit be54905 into master Mar 7, 2020
@Mordil Mordil deleted the localization-tweaks branch March 7, 2020 04:50
@Mordil Mordil added semver-minor Require SemVer Minor bump semver-major Require SemVer Major bump and removed semver-minor Require SemVer Minor bump labels Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver-major Require SemVer Major bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant