Add language notification translates
parent
1a7cd6cc68
commit
8a7d36dbdb
|
@ -15,6 +15,22 @@
|
||||||
$Log = "##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format 'dd/MM/yyyy')`n##################################################"
|
$Log = "##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format 'dd/MM/yyyy')`n##################################################"
|
||||||
$Log | Write-host
|
$Log | Write-host
|
||||||
$Log | out-file -filepath $LogFile -Append
|
$Log | out-file -filepath $LogFile -Append
|
||||||
|
|
||||||
|
#Get locale file for Notification
|
||||||
|
#Default en-US
|
||||||
|
$DefaultLocal = "$WorkingDir\locale\en-US.xml"
|
||||||
|
#Get OS locale
|
||||||
|
$Locale = Get-WinSystemLocale
|
||||||
|
#Test if OS locale config file exists
|
||||||
|
$LocalFile = "$WorkingDir\locale\$($locale.Name).xml"
|
||||||
|
if(Test-Path $LocalFile){
|
||||||
|
[xml]$Script:NotifLocal = Get-Content $LocalFile -Encoding UTF8 -ErrorAction SilentlyContinue
|
||||||
|
Write-Log "Local : $($locale.Name)"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
[xml]$Script:NotifLocal = Get-Content $DefaultLocal -Encoding UTF8 -ErrorAction SilentlyContinue
|
||||||
|
Write-Log "Local : en-US"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Write-Log ($LogMsg,$LogColor = "White") {
|
function Write-Log ($LogMsg,$LogColor = "White") {
|
||||||
|
@ -73,8 +89,8 @@ function Test-Network {
|
||||||
if ($timeout -eq 300){
|
if ($timeout -eq 300){
|
||||||
#Send Notif if no connection for 5 min
|
#Send Notif if no connection for 5 min
|
||||||
Write-Log "Notify 'No connection'" "Yellow"
|
Write-Log "Notify 'No connection'" "Yellow"
|
||||||
$Title = "Vérifiez votre connexion réseau"
|
$Title = $NotifLocal.local.outputs.output[0].title
|
||||||
$Message = "Impossible de vérifier les mises à jours logicielles pour le moment !"
|
$Message = $NotifLocal.local.outputs.output[0].message
|
||||||
$MessageType = "warning"
|
$MessageType = "warning"
|
||||||
$Balise = "connection"
|
$Balise = "connection"
|
||||||
Run-NotifTask $Title $Message $MessageType $Balise
|
Run-NotifTask $Title $Message $MessageType $Balise
|
||||||
|
@ -209,8 +225,8 @@ if ($ping){
|
||||||
Write-Log "Updating $($app.Name) from $($app.Version) to $($app.AvailableVersion)..." "Cyan"
|
Write-Log "Updating $($app.Name) from $($app.Version) to $($app.AvailableVersion)..." "Cyan"
|
||||||
|
|
||||||
#Send Notif
|
#Send Notif
|
||||||
$Title = "$($app.Name) va être mis à jour."
|
$Title = $NotifLocal.local.outputs.output[2].title -f $($app.Name)
|
||||||
$Message = "$($app.Version) -> $($app.AvailableVersion)"
|
$Message = $NotifLocal.local.outputs.output[2].message -f $($app.Version), $($app.AvailableVersion)
|
||||||
$MessageType = "info"
|
$MessageType = "info"
|
||||||
$Balise = $($app.Name)
|
$Balise = $($app.Name)
|
||||||
Run-NotifTask $Title $Message $MessageType $Balise
|
Run-NotifTask $Title $Message $MessageType $Balise
|
||||||
|
@ -243,8 +259,8 @@ if ($ping){
|
||||||
Write-Log "$($app.Name) updated to $($app.AvailableVersion) !" "Green"
|
Write-Log "$($app.Name) updated to $($app.AvailableVersion) !" "Green"
|
||||||
|
|
||||||
#Send Notif
|
#Send Notif
|
||||||
$Title = "$($app.Name) a été mis à jour."
|
$Title = $NotifLocal.local.outputs.output[3].title -f $($app.Name)
|
||||||
$Message = "Version installée : $($app.AvailableVersion)"
|
$Message = $NotifLocal.local.outputs.output[3].message -f $($app.AvailableVersion)
|
||||||
$MessageType = "success"
|
$MessageType = "success"
|
||||||
$Balise = $($app.Name)
|
$Balise = $($app.Name)
|
||||||
Run-NotifTask $Title $Message $MessageType $Balise
|
Run-NotifTask $Title $Message $MessageType $Balise
|
||||||
|
@ -256,15 +272,15 @@ if ($ping){
|
||||||
Write-Log "$($app.Name) update failed." "Red"
|
Write-Log "$($app.Name) update failed." "Red"
|
||||||
|
|
||||||
#Send Notif
|
#Send Notif
|
||||||
$Title = "$($app.Name) n'a pas pu être mis à jour !"
|
$Title = $NotifLocal.local.outputs.output[4].title -f $($app.Name)
|
||||||
$Message = "Contacter le support."
|
$Message = $NotifLocal.local.outputs.output[4].message
|
||||||
$MessageType = "error"
|
$MessageType = "error"
|
||||||
$Balise = $($app.Name)
|
$Balise = $($app.Name)
|
||||||
Run-NotifTask $Title $Message $MessageType $Balise
|
Run-NotifTask $Title $Message $MessageType $Balise
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Write-Log "Skipped upgrade because $($app.Name) is in the excluded app list" "Gray"
|
Write-Log "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,8 +294,8 @@ if ($ping){
|
||||||
else{
|
else{
|
||||||
Write-Log "Timeout. No internet connection !" "Red"
|
Write-Log "Timeout. No internet connection !" "Red"
|
||||||
#Send Notif
|
#Send Notif
|
||||||
$Title = "Aucune connexion réseau"
|
$Title = $NotifLocal.local.outputs.output[1].title
|
||||||
$Message = "Les mises à jour logicielles n'ont pas pu être vérifiées !"
|
$Message = $NotifLocal.local.outputs.output[1].message
|
||||||
$MessageType = "error"
|
$MessageType = "error"
|
||||||
$Balise = "connection"
|
$Balise = "connection"
|
||||||
Run-NotifTask $Title $Message $MessageType $Balise
|
Run-NotifTask $Title $Message $MessageType $Balise
|
||||||
|
|
Loading…
Reference in New Issue