-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add support for PowerShell 5.1, extend TimeSpan type #19
base: feat/update2024
Are you sure you want to change the base?
Conversation
…l 5.1; Try ISO language name as last resort when adding resources
…casing in format files
@cdhunt Thoughts? @kborowinski Thanks for the PR. I'd prefer smaller PRs, easier to test :) |
@dfinke I can close that PR and prepare bunch of smaller ones, if you like. |
Thanks, let's hold off till @cdhunt can respond. He was planning a bunch of things. |
I'm pretty swamped this week, but I kicked off the tests and it did hit one failure for the 5.1 run. https://github.com/dfinke/PowerShellHumanizer/actions/runs/9827401928/job/27170421774#step:4:67 |
The test fails because on PS 5.1 range operator does not support characters : BeforeAll {
$listAlphaLower = 'a'..'z'
$listAlphaUpper = 'A'..'Z' I'll fix tests to work on PS 5.1 |
@cdhunt @dfinke
This PR amends
update2024
branch with the following:Updates
Humanizer
package to latest beta.Adds support for
PowerShell 5.1
by adding specific versions ofSystem.Buffer
andSystem.Runtime.CompilerServices.Unsafe
assemblies (other option would be to register them in GAC manually)Tries to locateHummanizer.resources.dll
by two letter ISO language name, as last resort, when folder specified in$PSCulture
does not exist. For example, Polish culture can be reported either aspl-PL
orpl
, and resource file for Polish culture is stored inpl
folder. This fails to load on Windows 11 where Polish culture is reported aspl-PL
. I'm usingCurrentUICulture
rather thanCurrentCulture
to be in line with current GUI language and not locale.Extends
TimeSpan.types
so user can specify maximumTimeUnit
,CultureInfo
, separator and numeric to word conversion. This is handy, when one want's to use different culuture that current:ConvertTo-Quantity
so this example fromTryPowerShellHumanizer.ps1
works as expected:EDIT:
I don't know if that changed in latest beta but
Humanizer.dll
automatically loads proper resource file. You can test is by commenting out this block of code inPowerShellHumanizer.psm1
: