Skip to content

Commit

Permalink
Update itt.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
emadadel4 committed Oct 17, 2024
1 parent c697f54 commit e353467
Showing 1 changed file with 48 additions and 24 deletions.
72 changes: 48 additions & 24 deletions itt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $itt = [Hashtable]::Synchronized(@{
Date = (Get-Date -Format "MM/dd/yyy")
Music = "100"
PopupWindow = "On"
Language = "en"
Language = "default"
ittDir = "$env:localappdata\itt\"

})
Expand Down Expand Up @@ -12659,10 +12659,6 @@ function Show-Event {
'.Trim()


$itt.event.FindName('contribute').add_MouseLeftButtonDown({
Start-Process('https://github.com/emadadel4/itt?tab=readme-ov-file#-how-to-contribute')
})

$itt.event.FindName('ytv').add_MouseLeftButtonDown({
Start-Process('https://www.youtube.com/watch?v=QmO82OTsU5c')
})
Expand All @@ -12671,6 +12667,10 @@ function Show-Event {
Start-Process('https://github.com/emadadel4/shelltube')
})

$itt.event.FindName('contribute').add_MouseLeftButtonDown({
Start-Process('https://github.com/emadadel4/itt?tab=readme-ov-file#-how-to-contribute')
})


$CloseBtn.add_MouseLeftButtonDown({
$itt.event.Close()
Expand Down Expand Up @@ -16623,7 +16623,7 @@ foreach ($function in $functions) {
$initialSessionState.Commands.Add($functionEntry)

# debug
#Write-Output "Added function: $($function.Name)"
if($Debug){Write-Output "Added function: $($function.Name)"}
}

# Create and open the runspace pool
Expand Down Expand Up @@ -16664,7 +16664,7 @@ try {
New-Item -Path $itt.registryPath -Force | Out-Null
Set-ItemProperty -Path $itt.registryPath -Name "Theme" -Value "default" -Force
Set-ItemProperty -Path $itt.registryPath -Name "UserTheme" -Value "none" -Force
Set-ItemProperty -Path $itt.registryPath -Name "locales" -Value $shortCulture -Force
Set-ItemProperty -Path $itt.registryPath -Name "locales" -Value "default" -Force
Set-ItemProperty -Path $itt.registryPath -Name "Music" -Value "100" -Force
Set-ItemProperty -Path $itt.registryPath -Name "PopupWindow" -Value "On" -Force
}
Expand All @@ -16682,7 +16682,7 @@ try {
if($Debug) {Add-Log -Message "An error occurred. Creating missing registry keys..." -Level "INFO"}
New-ItemProperty -Path $itt.registryPath -Name "Theme" -Value "default" -PropertyType String -Force *> $Null
New-ItemProperty -Path $itt.registryPath -Name "UserTheme" -Value "none" -PropertyType String -Force *> $Null
New-ItemProperty -Path $itt.registryPath -Name "locales" -Value $shortCulture -PropertyType String -Force *> $Null
New-ItemProperty -Path $itt.registryPath -Name "locales" -Value "default" -PropertyType String -Force *> $Null
New-ItemProperty -Path $itt.registryPath -Name "Music" -Value "100" -PropertyType String -Force *> $Null
New-ItemProperty -Path $itt.registryPath -Name "PopupWindow" -Value "On" -PropertyType String -Force *> $Null
}
Expand All @@ -16695,20 +16695,47 @@ try {
#region Set Language based on culture
#===========================================================================

switch ($shortCulture) {
"ar" { $locale = "ar" }
"en" { $locale = "en" }
"fr" { $locale = "fr" }
"tr" { $locale = "tr" }
"zh" { $locale = "zh" }
"ko" { $locale = "ko" }
"de" { $locale = "de" }
"ru" { $locale = "ru" }
"es" { $locale = "es" }
default { $locale = "en" }
try {

switch ($itt.Locales) {

"default" {

switch($shortCulture)
{
"ar" { $locale = "ar" }
"en" { $locale = "en" }
"fr" { $locale = "fr" }
"tr" { $locale = "tr" }
"zh" { $locale = "zh" }
"ko" { $locale = "ko" }
"de" { $locale = "de" }
"ru" { $locale = "ru" }
"es" { $locale = "es" }
default { $locale = "en" }

}

}
"ar" { $locale = "ar" }
"en" { $locale = "en" }
"fr" { $locale = "fr" }
"tr" { $locale = "tr" }
"zh" { $locale = "zh" }
"ko" { $locale = "ko" }
"de" { $locale = "de" }
"ru" { $locale = "ru" }
"es" { $locale = "es" }
default { $locale = "en" }
}
$itt["window"].DataContext = $itt.database.locales.Controls.$locale
$itt.Language = $locale
}
catch {

# fallbak to en lang
$itt["window"].DataContext = $itt.database.locales.Controls.en
}
$itt["window"].DataContext = $itt.database.locales.Controls.$locale
$itt.Language = $locale

#===========================================================================
#endregion Set Language based on culture
Expand All @@ -16720,8 +16747,6 @@ try {

try {



$themeResource = switch($itt.Theme)
{
"Light"{
Expand All @@ -16741,7 +16766,6 @@ try {
"0" { "Dark" }
"1" { "Light" }
}


}
}
Expand Down

0 comments on commit e353467

Please sign in to comment.