Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/Transform/TransformBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ protected CommandHelp ConvertCmdletInfo(CommandInfo? commandInfo)
}

CommandHelp cmdHelp = new(commandInfo.Name, commandInfo.ModuleName, Settings.Locale);
cmdHelp.Metadata = MetadataUtils.GetCommandHelpBaseMetadataFromCommandInfo(commandInfo);
cmdHelp.ExternalHelpFile = cmdHelp.Metadata["external help file"].ToString() ?? string.Empty;
cmdHelp.Metadata = MetadataUtils.GetCommandHelpBaseMetadata(cmdHelp);
cmdHelp.ExternalHelpFile = cmdHelp.Metadata["external help file"] as string ?? string.Empty;
cmdHelp.OnlineVersionUrl = Settings.OnlineVersionUrl ?? cmdHelp.Metadata["HelpUri"] as string;
cmdHelp.SchemaVersion = cmdHelp.Metadata["PlatyPS schema version"] as string ?? string.Empty;
cmdHelp.Synopsis = GetSynopsis(helpItem, addDefaultStrings);
Expand Down
27 changes: 27 additions & 0 deletions test/Pester/NewMarkdownHelp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -657,4 +657,31 @@ Write-Host 'Hello World!'
$file | Should -FileContentMatch 'Runs the command in a mode that only reports what would happen without performing the actions.'
}
}

Context 'Locale parameter' {
BeforeAll {
function global:Test-Locale {
[CmdletBinding()]
param()
}
}

It 'No Locale parameter' {
$file = New-MarkdownCommandHelp -Command (Get-Command 'Test-Locale') -OutputFolder "$TestDrive/NewMarkdownHelp" -Force

Get-Content -Path $file -First 10 | Where-Object { $_ -match "^Locale" } | Should -Be "Locale: en-US"
}

It 'Invariant Locale parameter' {
$file = New-MarkdownCommandHelp -Command (Get-Command 'Test-Locale') -OutputFolder "$TestDrive/NewMarkdownHelp" -Force -Locale C

Get-Content -Path $file -First 10 | Where-Object { $_ -match "^Locale" } | Should -Be "Locale: en-US"
}

It 'ja-JP Locale parameter' {
$file = New-MarkdownCommandHelp -Command (Get-Command 'Test-Locale') -OutputFolder "$TestDrive/NewMarkdownHelp" -Force -Locale ja-JP

Get-Content -Path $file -First 10 | Where-Object { $_ -match "^Locale" } | Should -Be "Locale: ja-JP"
}
}
}