mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-04-22 19:10:19 +10:00
Added a function to assign language strings.
Added a function to assign language strings to improve the organization of the script and increase future flexibility. This should not cause any issues or require any other changes to the script. Removed lines 69 to 201 Added lines 69 to 256
This commit is contained in:
307
Install.ps1
307
Install.ps1
@@ -66,139 +66,194 @@ param (
|
|||||||
# Ignore errors from `Stop-Process`
|
# Ignore errors from `Stop-Process`
|
||||||
$PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue
|
$PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue
|
||||||
|
|
||||||
|
function Set-ScriptLanguage
|
||||||
|
{
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the language strings to be used.
|
||||||
|
|
||||||
function langRu() {
|
.DESCRIPTION
|
||||||
|
Returns an object with language strings. Use the 'LangCode' switch to specify a language, or use without parameters to detect the system language.
|
||||||
|
|
||||||
ConvertFrom-StringData -StringData @'
|
.PARAMETER LangCode
|
||||||
Author = Автор:
|
Specify the language to be used. Two letter language codes (ex: 'en' or 'ru') and four letter language culture codes accepted (ex: 'en-US' or 'ru-RU').
|
||||||
Incorrect = Ой, некорректное значение,
|
Default is to attempt to detect system language.
|
||||||
Incorrect2 = повторите ввод через
|
|
||||||
CuttError = Ошибка запроса в cutt
|
.EXAMPLE
|
||||||
Download = Ошибка загрузки
|
PS C:\> Set-ScriptLanguage
|
||||||
Download2 = Повторный запрос через 5 секунд...
|
|
||||||
Download3 = Опять ошибка
|
.EXAMPLE
|
||||||
Download4 = Попробуйте проверить подключение к интернету и снова запустить установку
|
PS C:\> Set-ScriptLanguage -LangCode 'en'
|
||||||
Download5 = Загрузка Spotify
|
#>
|
||||||
StopScrpit = Cкрипт остановлен
|
|
||||||
MsSpoti = Обнаружена версия Spotify из Microsoft Store, которая не поддерживается
|
[CmdletBinding()]
|
||||||
MsSpoti2 = Хотите удалить Spotify Microsoft Store ? [Y/N]
|
[OutputType([object])]
|
||||||
MsSpoti3 = Автоматическое удаление Spotify MS...
|
param
|
||||||
MsSpoti4 = Удаление Spotify MS...
|
(
|
||||||
Prem = Модификация для премиум аккаунта...
|
[Parameter(HelpMessage = 'Two, three, or four letter language names accepted.')]
|
||||||
DownBts = Загружаю последний патч BTS...
|
[ValidateScript({ $_ -match '^(en|ru|py)' })]
|
||||||
OldV = Найдена устаревшая версия Spotify
|
[string]$LangCode
|
||||||
OldV2 = Ваша версия Spotify {0} устарела, рекомендуется обновиться до {1}
|
)
|
||||||
OldV3 = Обновить ? [Y/N]
|
BEGIN
|
||||||
AutoUpd = Автоматическое обновление до рекомендуемой версии
|
{
|
||||||
DelOrOver = Вы хотите удалить текущую версию {0} или установить поверх нее? Y [Удалить] / N [Поверх]
|
# Define language strings.
|
||||||
DelOld = Удаление устаревшего Spotify...
|
$langStringsEN = [PSCustomObject]@{
|
||||||
NewV = Найдена неподдерживаемая версия Spotify
|
Author = "Author:"
|
||||||
NewV2 = Ваша версия Spotify {0} еще не тестировалась, стабильная версия сейчас {1}
|
Incorrect = "Oops, an incorrect value,"
|
||||||
NewV3 = Хотите продолжить с {0} (возможны ошибки) ? [Y/N]
|
Incorrect2 = "enter again through "
|
||||||
Recom = Хотите установить рекомендуемую {0} версию ? [Y/N]
|
CuttError = "Request error in cutt"
|
||||||
DelNew = Удаление неподдерживаемого Spotify...
|
Download = "Error downloading"
|
||||||
DownSpoti = Загружаю и устанавливаю Spotify
|
Download2 = "Will re-request in 5 seconds..."
|
||||||
DownSpoti2 = Пожалуйста подождите...
|
Download3 = "Error again"
|
||||||
PodcatsOff = Подкасты отключены
|
Download4 = "Try to check your internet connection and run the installation again"
|
||||||
PodcastsOn = Подкасты не отключены
|
Download5 = "Downloading Spotify"
|
||||||
PodcatsSelect = Хотите отключить подкасты ? [Y/N]
|
StopScrpit = "Script is stopped"
|
||||||
DowngradeNote = Рекомендуется заблокировать т.к. было понижение версии Spotify
|
MsSpoti = "The Microsoft Store version of Spotify has been detected which is not supported"
|
||||||
UpdBlock = Обновления заблокированы
|
MsSpoti2 = "Uninstall Spotify Windows Store edition [Y/N]"
|
||||||
UpdUnblock = Обновления не заблокированы
|
MsSpoti3 = "Automatic uninstalling Spotify MS..."
|
||||||
UpdSelect = Хотите заблокировать обновления ? [Y/N]
|
MsSpoti4 = "Uninstalling Spotify MS..."
|
||||||
CacheOn = Очистка кеша включена ({0})
|
Prem = "Modification for premium account..."
|
||||||
CacheOff = Очистка кеша не включена
|
DownBts = "Downloading latest patch BTS..."
|
||||||
CacheSelect = Хотите установить автоматическую очистку кеша ? [Y/N]
|
OldV = "Found outdated version of Spotify"
|
||||||
CacheDays = Кэш старше: XX дней будет очищен
|
OldV2 = "Your Spotify {0} version is outdated, it is recommended to upgrade to {1}"
|
||||||
CacheDays2 = Пожалуйста, введите количество дней от 1 до 100
|
OldV3 = "Want to update ? [Y/N]"
|
||||||
NoVariable = Не нашел переменную
|
AutoUpd = "Automatic update to the recommended version"
|
||||||
NoVariable2 = в xpui.js
|
DelOrOver = "Do you want to uninstall the current version of {0} or install over it? Y [Uninstall] / N [Install Over]"
|
||||||
NoVariable3 = в licenses.html
|
DelOld = "Uninstalling old Spotify..."
|
||||||
NoVariable4 = в html
|
NewV = "Unsupported version of Spotify found"
|
||||||
NoVariable5 = в ru.json
|
NewV2 = "Your Spotify {0} version hasn't been tested yet, currently it's a stable {1} version"
|
||||||
ModSpoti = Модифицирую Spotify...
|
NewV3 = "Do you want to continue with {0} version (errors possible) ? [Y/N]"
|
||||||
Error = Ошибка
|
Recom = "Do you want to install the recommended {0} version ? [Y/N]"
|
||||||
FileLocBroken = Расположение файлов Spotify нарушено, удалите клиент и снова запустите скрипт
|
DelNew = "Uninstalling an untested Spotify..."
|
||||||
Spicetify = Обнаружен Spicetify
|
DownSpoti = "Downloading and installing Spotify"
|
||||||
NoRestore = SpotX уже был установлен, но файлы для восстановления xpui.js.bak и xpui.css.bak не найдены. `nУдалите клиент Spotify и снова запустите Install.bat
|
DownSpoti2 = "Please wait..."
|
||||||
ExpOff = Экспереметальные функции отключены
|
PodcatsOff = "Off Podcasts"
|
||||||
NoRestore2 = SpotX уже был установлен, но файл для восстановления xpui.bak не найден. `nУдалите клиент Spotify и снова запустите Install.bat
|
PodcastsOn = "On Podcasts"
|
||||||
UpdateBlocked = Обновления Spotify уже заблокированы
|
PodcatsSelect = "Want to turn off podcasts ? [Y/N]"
|
||||||
UpdateError = Не удалось заблокировать обновления
|
DowngradeNote = "It is recommended to block because there was a downgrade of Spotify"
|
||||||
NoSpotifyExe = Spotify.exe не найден
|
UpdBlock = "Updates blocked"
|
||||||
InstallComplete = Установка завершена
|
UpdUnblock = "Updates are not blocked"
|
||||||
'@
|
UpdSelect = "Want to block updates ? [Y/N]"
|
||||||
|
CacheOn = "Clear cache enabled ({0})"
|
||||||
|
CacheOff = "Clearing the cache is not enabled"
|
||||||
|
CacheSelect = "Want to set up automatic cache cleanup? [Y/N]"
|
||||||
|
CacheDays = "Cache older: XX days to be cleared "
|
||||||
|
CacheDays2 = "Enter the number of days from 1 to 100"
|
||||||
|
NoVariable = "Didn't find variable"
|
||||||
|
NoVariable2 = "in xpui.js"
|
||||||
|
NoVariable3 = "in licenses.html"
|
||||||
|
NoVariable4 = "in html"
|
||||||
|
ModSpoti = "Patching Spotify..."
|
||||||
|
Error = "Error"
|
||||||
|
FileLocBroken = "Location of Spotify files is broken, uninstall the client and run the script again"
|
||||||
|
Spicetify = "Spicetify detected"
|
||||||
|
NoRestore = "SpotX has already been installed, xpui.js and xpui.css not found. `nPlease uninstall Spotify client and run Install.bat again"
|
||||||
|
ExpOff = "Experimental features disabled"
|
||||||
|
NoRestore2 = "SpotX has already been installed, xpui.bak not found. `nPlease uninstall Spotify client and run Install.bat again"
|
||||||
|
UpdateBlocked = "Spotify updates are already blocked"
|
||||||
|
UpdateError = "Failed to block updates"
|
||||||
|
NoSpotifyExe = "Could not find Spotify.exe"
|
||||||
|
InstallComplete = "installation completed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$langStringsRU = [PSCustomObject]@{
|
||||||
function langEn() {
|
Author = "Автор:"
|
||||||
|
Incorrect = "Ой, некорректное значение,"
|
||||||
ConvertFrom-StringData -StringData @'
|
Incorrect2 = "повторите ввод через"
|
||||||
Author = Author:
|
CuttError = "Ошибка запроса в cutt"
|
||||||
Incorrect = Oops, an incorrect value,
|
Download = "Ошибка загрузки"
|
||||||
Incorrect2 = enter again through
|
Download2 = "Повторный запрос через 5 секунд..."
|
||||||
CuttError = Request error in cutt
|
Download3 = "Опять ошибка"
|
||||||
Download = Error downloading
|
Download4 = "Попробуйте проверить подключение к интернету и снова запустить установку"
|
||||||
Download2 = Will re-request in 5 seconds...
|
Download5 = "Загрузка Spotify"
|
||||||
Download3 = Error again
|
StopScrpit = "Cкрипт остановлен"
|
||||||
Download4 = Try to check your internet connection and run the installation again
|
MsSpoti = "Обнаружена версия Spotify из Microsoft Store, которая не поддерживается"
|
||||||
Download5 = Downloading Spotify
|
MsSpoti2 = "Хотите удалить Spotify Microsoft Store ? [Y/N]"
|
||||||
StopScrpit = Script is stopped
|
MsSpoti3 = "Автоматическое удаление Spotify MS..."
|
||||||
MsSpoti = The Microsoft Store version of Spotify has been detected which is not supported
|
MsSpoti4 = "Удаление Spotify MS..."
|
||||||
MsSpoti2 = Uninstall Spotify Windows Store edition [Y/N]
|
Prem = "Модификация для премиум аккаунта..."
|
||||||
MsSpoti3 = Automatic uninstalling Spotify MS...
|
DownBts = "Загружаю последний патч BTS..."
|
||||||
MsSpoti4 = Uninstalling Spotify MS...
|
OldV = "Найдена устаревшая версия Spotify"
|
||||||
Prem = Modification for premium account...
|
OldV2 = "Ваша версия Spotify {0} устарела, рекомендуется обновиться до {1}"
|
||||||
DownBts = Downloading latest patch BTS...
|
OldV3 = "Обновить ? [Y/N]"
|
||||||
OldV = Found outdated version of Spotify
|
AutoUpd = "Автоматическое обновление до рекомендуемой версии"
|
||||||
OldV2 = Your Spotify {0} version is outdated, it is recommended to upgrade to {1}
|
DelOrOver = "Вы хотите удалить текущую версию {0} или установить поверх нее? Y [Удалить] / N [Поверх]"
|
||||||
OldV3 = Want to update ? [Y/N]
|
DelOld = "Удаление устаревшего Spotify..."
|
||||||
AutoUpd = Automatic update to the recommended version
|
NewV = "Найдена неподдерживаемая версия Spotify"
|
||||||
DelOrOver = Do you want to uninstall the current version of {0} or install over it? Y [Uninstall] / N [Install Over]
|
NewV2 = "Ваша версия Spotify {0} еще не тестировалась, стабильная версия сейчас {1}"
|
||||||
DelOld = Uninstalling old Spotify...
|
NewV3 = "Хотите продолжить с {0} (возможны ошибки) ? [Y/N]"
|
||||||
NewV = Unsupported version of Spotify found
|
Recom = "Хотите установить рекомендуемую {0} версию ? [Y/N]"
|
||||||
NewV2 = Your Spotify {0} version hasn't been tested yet, currently it's a stable {1} version
|
DelNew = "Удаление неподдерживаемого Spotify..."
|
||||||
NewV3 = Do you want to continue with {0} version (errors possible) ? [Y/N]
|
DownSpoti = "Загружаю и устанавливаю Spotify"
|
||||||
Recom = Do you want to install the recommended {0} version ? [Y/N]
|
DownSpoti2 = "Пожалуйста подождите..."
|
||||||
DelNew = Uninstalling an untested Spotify...
|
PodcatsOff = "Подкасты отключены"
|
||||||
DownSpoti = Downloading and installing Spotify
|
PodcastsOn = "Подкасты не отключены"
|
||||||
DownSpoti2 = Please wait...
|
PodcatsSelect = "Хотите отключить подкасты ? [Y/N]"
|
||||||
PodcatsOff = Off Podcasts
|
DowngradeNote = "Рекомендуется заблокировать т.к. было понижение версии Spotify"
|
||||||
PodcastsOn = On Podcasts
|
UpdBlock = "Обновления заблокированы"
|
||||||
PodcatsSelect = Want to turn off podcasts ? [Y/N]
|
UpdUnblock = "Обновления не заблокированы"
|
||||||
DowngradeNote = It is recommended to block because there was a downgrade of Spotify
|
UpdSelect = "Хотите заблокировать обновления ? [Y/N]"
|
||||||
UpdBlock = Updates blocked
|
CacheOn = "Очистка кеша включена ({0})"
|
||||||
UpdUnblock = Updates are not blocked
|
CacheOff = "Очистка кеша не включена"
|
||||||
UpdSelect = Want to block updates ? [Y/N]
|
CacheSelect = "Хотите установить автоматическую очистку кеша ? [Y/N]"
|
||||||
CacheOn = Clear cache enabled ({0})
|
CacheDays = "Кэш старше: XX дней будет очищен"
|
||||||
CacheOff = Clearing the cache is not enabled
|
CacheDays2 = "Пожалуйста, введите количество дней от 1 до 100"
|
||||||
CacheSelect = Want to set up automatic cache cleanup? [Y/N]
|
NoVariable = "Не нашел переменную"
|
||||||
CacheDays = Cache older: XX days to be cleared
|
NoVariable2 = "в xpui.js"
|
||||||
CacheDays2 = Enter the number of days from 1 to 100
|
NoVariable3 = "в licenses.html"
|
||||||
NoVariable = Didn't find variable
|
NoVariable4 = "в html"
|
||||||
NoVariable2 = in xpui.js
|
NoVariable5 = "в ru.json"
|
||||||
NoVariable3 = in licenses.html
|
ModSpoti = "Модифицирую Spotify..."
|
||||||
NoVariable4 = in html
|
Error = "Ошибка"
|
||||||
ModSpoti = Patching Spotify...
|
FileLocBroken = "Расположение файлов Spotify нарушено, удалите клиент и снова запустите скрипт"
|
||||||
Error = Error
|
Spicetify = "Обнаружен Spicetify"
|
||||||
FileLocBroken = Location of Spotify files is broken, uninstall the client and run the script again
|
NoRestore = "SpotX уже был установлен, но файлы для восстановления xpui.js.bak и xpui.css.bak не найдены. `nУдалите клиент Spotify и снова запустите Install.bat"
|
||||||
Spicetify = Spicetify detected
|
ExpOff = "Экспереметальные функции отключены"
|
||||||
NoRestore = SpotX has already been installed, xpui.js and xpui.css not found. `nPlease uninstall Spotify client and run Install.bat again
|
NoRestore2 = "SpotX уже был установлен, но файл для восстановления xpui.bak не найден. `nУдалите клиент Spotify и снова запустите Install.bat"
|
||||||
ExpOff = Experimental features disabled
|
UpdateBlocked = "Обновления Spotify уже заблокированы"
|
||||||
NoRestore2 = SpotX has already been installed, xpui.bak not found. `nPlease uninstall Spotify client and run Install.bat again
|
UpdateError = "Не удалось заблокировать обновления"
|
||||||
UpdateBlocked = Spotify updates are already blocked
|
NoSpotifyExe = "Spotify.exe не найден"
|
||||||
UpdateError = Failed to block updates
|
InstallComplete = "Установка завершена"
|
||||||
NoSpotifyExe = Could not find Spotify.exe
|
}
|
||||||
InstallComplete = installation completed
|
|
||||||
'@
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checking the system language
|
process
|
||||||
$langTest = [CultureInfo]::InstalleduICulture
|
{
|
||||||
|
# If a language code was not specified, detect system language.
|
||||||
|
if (-not $LangCode)
|
||||||
|
{
|
||||||
|
$LangCode = [CultureInfo]::InstalledUICulture.TwoLetterISOLanguageName
|
||||||
|
}
|
||||||
|
|
||||||
if ($langTest -eq 'ru-Ru') { $lang = langRu; $ru = $true }
|
# Assign language strings.
|
||||||
else { $lang = langEn }
|
switch -regex ($LangCode)
|
||||||
|
{
|
||||||
|
'^en'
|
||||||
|
{
|
||||||
|
$langStrings = $langStringsEN
|
||||||
|
break
|
||||||
|
}
|
||||||
|
'^(ru|py)'
|
||||||
|
{
|
||||||
|
$langStrings = $langStringsRU
|
||||||
|
break
|
||||||
|
}
|
||||||
|
Default
|
||||||
|
{
|
||||||
|
# Default to English if unable to find a match.
|
||||||
|
$langStrings = $langStringsEN
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
{
|
||||||
|
return $langStrings
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set script language strings.
|
||||||
|
$lang = Set-ScriptLanguage
|
||||||
|
|
||||||
|
|
||||||
Write-Host "*****************"
|
Write-Host "*****************"
|
||||||
|
|||||||
Reference in New Issue
Block a user