Skip to content

Commit 8c1ff80

Browse files
committed
Fix localization with default style
- Fixes #60
1 parent 102eab5 commit 8c1ff80

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

AsBuiltReport.Core.Style.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# AsBuiltReport Default Document Style
22
try {
33
# Try to initialize localized data for style elements
4+
# Use the report language from parent scope if available, otherwise fallback to OS language
45
if ($PSScriptRoot) {
5-
Initialize-LocalizedData -ModuleBasePath $PSScriptRoot -LanguageFile 'AsBuiltReportCoreStyle' -ModuleType 'Core'
6+
if ($FinalReportLanguage) {
7+
Initialize-LocalizedData -ModuleBasePath $PSScriptRoot -LanguageFile 'AsBuiltReportCoreStyle' -ModuleType 'Core' -Language $FinalReportLanguage
8+
} else {
9+
Initialize-LocalizedData -ModuleBasePath $PSScriptRoot -LanguageFile 'AsBuiltReportCoreStyle' -ModuleType 'Core'
10+
}
611
} else {
712
# Fallback if $PSScriptRoot is not available
813
$StyleModulePath = Split-Path -Path $MyInvocation.MyCommand.Path -Parent
9-
Initialize-LocalizedData -ModuleBasePath $StyleModulePath -LanguageFile 'AsBuiltReportCoreStyle' -ModuleType 'Core'
14+
if ($FinalReportLanguage) {
15+
Initialize-LocalizedData -ModuleBasePath $StyleModulePath -LanguageFile 'AsBuiltReportCoreStyle' -ModuleType 'Core' -Language $FinalReportLanguage
16+
} else {
17+
Initialize-LocalizedData -ModuleBasePath $StyleModulePath -LanguageFile 'AsBuiltReportCoreStyle' -ModuleType 'Core'
18+
}
1019
}
1120
} catch {
1221
# If localization fails, continue with default style (don't break report generation)

0 commit comments

Comments
 (0)