2022-04-13 16:50:06 +00:00
|
|
|
#Function to get locale file for Notification.
|
2022-03-14 13:55:02 +00:00
|
|
|
|
2022-04-13 16:50:06 +00:00
|
|
|
Function Get-NotifLocale {
|
|
|
|
|
2022-03-14 13:55:02 +00:00
|
|
|
#Get OS locale
|
|
|
|
$OSLocale = (Get-Culture).Parent
|
|
|
|
|
|
|
|
#Test if OS locale notif file exists
|
|
|
|
$TestOSLocalPath = "$WorkingDir\locale\$($OSLocale.Name).xml"
|
2022-10-11 08:41:35 +00:00
|
|
|
|
2022-03-14 13:55:02 +00:00
|
|
|
#Set OS Local if file exists
|
2022-06-10 08:26:41 +00:00
|
|
|
if (Test-Path $TestOSLocalPath) {
|
2022-03-14 13:55:02 +00:00
|
|
|
$LocaleDisplayName = $OSLocale.DisplayName
|
|
|
|
$LocaleFile = $TestOSLocalPath
|
|
|
|
}
|
|
|
|
#Set English if file doesn't exist
|
2022-06-10 08:26:41 +00:00
|
|
|
else {
|
2022-03-14 13:55:02 +00:00
|
|
|
$LocaleDisplayName = "English"
|
|
|
|
$LocaleFile = "$WorkingDir\locale\en.xml"
|
|
|
|
}
|
|
|
|
|
|
|
|
#Get locale XML file content
|
|
|
|
[xml]$Script:NotifLocale = Get-Content $LocaleFile -Encoding UTF8 -ErrorAction SilentlyContinue
|
2022-04-13 16:50:06 +00:00
|
|
|
|
2022-10-11 14:23:31 +00:00
|
|
|
#Test if new strings exist in $LocaleFile
|
|
|
|
if ($null -eq $NotifLocale.local.outputs.output[7].message){
|
|
|
|
$LocaleFile = "$WorkingDir\locale\en.xml"
|
|
|
|
#Get locale XML file content
|
|
|
|
[xml]$Script:NotifLocale = Get-Content $LocaleFile -Encoding UTF8 -ErrorAction SilentlyContinue
|
|
|
|
}
|
|
|
|
|
2022-10-11 08:41:35 +00:00
|
|
|
#Rerturn langague display name
|
|
|
|
Return $LocaleDisplayName
|
|
|
|
|
2022-03-14 13:55:02 +00:00
|
|
|
}
|