2023-03-31 15:56:07 +00:00
|
|
|
#Function to get the locale file for notifications
|
2022-03-14 13:55:02 +00:00
|
|
|
|
2022-04-13 16:50:06 +00:00
|
|
|
Function Get-NotifLocale {
|
2022-10-26 22:49:10 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Get OS locale
|
2023-03-17 23:06:29 +00:00
|
|
|
$OSLocale = (Get-UICulture).Parent
|
2022-03-14 13:55:02 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Test if OS locale notif file exists
|
|
|
|
$TestOSLocalPath = ('{0}\locale\{1}.xml' -f $WorkingDir, $OSLocale.Name)
|
2022-10-11 08:41:35 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Set OS Local if file exists
|
|
|
|
if (Test-Path -Path $TestOSLocalPath -ErrorAction SilentlyContinue) {
|
2022-03-14 13:55:02 +00:00
|
|
|
$LocaleDisplayName = $OSLocale.DisplayName
|
|
|
|
$LocaleFile = $TestOSLocalPath
|
|
|
|
}
|
2022-06-10 08:26:41 +00:00
|
|
|
else {
|
2023-09-15 14:33:51 +00:00
|
|
|
# Set English if file doesn't exist
|
|
|
|
$LocaleDisplayName = 'English'
|
|
|
|
$LocaleFile = ('{0}\locale\en.xml' -f $WorkingDir)
|
2022-03-14 13:55:02 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Get locale XML file content
|
|
|
|
[xml]$Script:NotifLocale = (Get-Content -Path $LocaleFile -Encoding UTF8 -ErrorAction SilentlyContinue)
|
2022-04-13 16:50:06 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Rerturn langague display name
|
2022-10-11 08:41:35 +00:00
|
|
|
Return $LocaleDisplayName
|
|
|
|
|
2022-10-26 22:49:10 +00:00
|
|
|
}
|