WindowsCommunityToolkit icon indicating copy to clipboard operation
WindowsCommunityToolkit copied to clipboard

Fixed StringFormatConverter ignoring Language parameter, cleanup

Open Arlodotexe opened this issue 1 year ago • 1 comments

Fixes #3243

This PR pulls in the changes from #4546, and cleans up a significant amount of plumbing that isn't needed. All unit tests are passing, and new tests have been added.

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Code style update (formatting)

What is the current behavior?

In IValueConverter, the language parameter is being ignored.

That means passing a language via ConverterLanguage wouldn't format the string with respect to the provided language.

What is the new behavior?

The language property is being passed to the string formatter. Now, the following will format as expected:

Example usage:

<TextBlock Text="{x:Bind SomeCurrencyValue, Converter={StaticResource MyConverter}, ConverterLanguage='en-GB'}" />
<TextBlock Text="{Binding SomeDateValue, Converter={StaticResource MyConverter}, ConverterLanguage='de-DE'}" />

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • [x] Based off latest main branch of toolkit
  • [x] Tested code with current supported SDKs
  • [ ] New component
    • [ ] Pull Request has been submitted to the documentation repository instructions. Link:
    • [ ] Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
    • [ ] If control, added to Visual Studio Design project
  • [ ] Sample in sample app has been added / updated (for bug fixes / features)
  • [ ] New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • [x] Tests for the changes have been added (for bug fixes / features) (if applicable)
  • [ ] Header has been added to all new source files (run build/UpdateHeaders.bat)
  • [x] Contains NO breaking changes

Arlodotexe avatar Sep 13 '22 17:09 Arlodotexe

Thanks Arlodotexe for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

msftbot[bot] avatar Sep 13 '22 17:09 msftbot[bot]

This PR has been marked as "needs attention 👋" and awaiting a response from the team.

msftbot[bot] avatar Oct 11 '22 20:10 msftbot[bot]