iainbrighton/PScribo

The variable $localized

Closed this issue · 6 comments

Trying to run PSCribo on Powershell core 6.1.2 results in an error that the variable $localized can't be found. Just trying it with for instance

Document 'PScribo Example' {

    Paragraph -Style Heading1 'This is Heading 1'
    Paragraph -Style Heading2 'This is Heading 2'
    Paragraph -Style Heading3 'This is Heading 3'
} | Export-Document -Path ~/Desktop -Format Word,Html,Text -Verbose

Doesn't work with -Format Text neither.

PS> $PSVersionTable

Name Value


PSVersion 6.1.2
PSEdition Core
GitCommitId 6.1.2
OS Darwin 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

The variable '$localized' cannot be retrieved because it has not been set.
At line:39 char:28
+         WriteLog -Message ($localized.ProcessingSectionStarted -f $Na ...
+                            ~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (localized:String) [], RuntimeException
+ FullyQualifiedErrorId : VariableIsUndefined

The variable '$localized' cannot be retrieved because it has not been set.
At line:74 char:28
+         WriteLog -Message ($localized.ProcessingParagraph -f $paragra ...
+                            ~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (localized:String) [], RuntimeException
+ FullyQualifiedErrorId : VariableIsUndefined

Ah this seems to have been fixed in the latest version (at least on GitHub) however that code doesn't seem to fit with what is on psgallery atm.

The issue can be fixed by changing the if statement on line 7 in the psm1 file to
If (-not (Test-Path -Path 'Variable:\localized')) {

Get the same issue, when there is plan a new release ?

I'll look at releasing a new version (with only this change in it) shortly.

Thanks !

Hi,

Any news ?!

Resolved in v0.7.26