#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Locale {
Ru,
En,
}
#[derive(Clone, Copy, Debug)]
pub enum Text {
WindowTitleInstaller,
WindowTitleUninstaller,
InstallerTitle,
InstallerSubtitle,
Mode,
System,
SystemCaption,
Portable,
PortableCaption,
WindowsScope,
CurrentUser,
NoElevation,
AllUsers,
MachinePath,
#[cfg(not(windows))]
Scope,
#[cfg(not(windows))]
UserInstall,
Folder,
InstallationFolder,
Browse,
AddKrPath,
DesktopShortcut,
Associate580,
Ready,
ReadyBody,
Installing,
InstallingBody,
InstallFailed,
Installed,
Location,
TerminalLaunchEnabled,
TerminalLaunchUnchanged,
FileAssociationCreated,
FileAssociationUnchanged,
PortableReady,
SearchDesktopUninstallReady,
SearchUninstallReady,
OpenInstallationFolder,
LaunchKr580,
InstallKr580,
InstallingEllipsis,
Done,
UninstallerTitle,
UninstallerSubtitle,
InstallFolder,
Removed,
RemovedBody,
UninstallFailed,
Removing,
RemovingBody,
ClosingEllipsis,
Close,
}
impl Locale {
pub fn system() -> Self {
match k580_ui::system_locale::default_language() {
k580_ui::persistence::Language::Ru => Self::Ru,
k580_ui::persistence::Language::En => Self::En,
}
}
pub fn t(self, text: Text) -> &'static str {
match self {
Self::Ru => ru(text),
Self::En => en(text),
}
}
}
fn en(text: Text) -> &'static str {
match text {
Text::WindowTitleInstaller => "KR580 Installer",
Text::WindowTitleUninstaller => "KR580 Uninstaller",
Text::InstallerTitle => "Installer",
Text::InstallerSubtitle => "Choose storage mode and install target.",
Text::Mode => "Mode",
Text::System => "System",
Text::SystemCaption => "OS config directories",
Text::Portable => "Portable",
Text::PortableCaption => "Data beside install root",
Text::WindowsScope => "Windows scope",
Text::CurrentUser => "Current user",
Text::NoElevation => "No elevation",
Text::AllUsers => "All users",
Text::MachinePath => "Machine PATH",
#[cfg(not(windows))]
Text::Scope => "Scope",
#[cfg(not(windows))]
Text::UserInstall => "User install",
Text::Folder => "Folder",
Text::InstallationFolder => "Installation folder",
Text::Browse => "Browse",
Text::AddKrPath => "Add kr command to PATH",
Text::DesktopShortcut => "Create desktop shortcut",
Text::Associate580 => "Associate .580 files with KR580",
Text::Ready => "Ready",
Text::ReadyBody => "Choose mode, folder, and install options.",
Text::Installing => "Installing",
Text::InstallingBody => "Copying files and writing install metadata.",
Text::InstallFailed => "Install failed",
Text::Installed => "Installed",
Text::Location => "Location",
Text::TerminalLaunchEnabled => "Terminal launch enabled.",
Text::TerminalLaunchUnchanged => "Terminal launch unchanged.",
Text::FileAssociationCreated => ".580 files open with KR580.",
Text::FileAssociationUnchanged => ".580 association unchanged.",
Text::PortableReady => "Portable layout ready.",
Text::SearchDesktopUninstallReady => "Search, desktop shortcut, and uninstall entry ready.",
Text::SearchUninstallReady => "Search and uninstall entry ready.",
Text::OpenInstallationFolder => "Open installation folder",
Text::LaunchKr580 => "Launch KR580",
Text::InstallKr580 => "Install KR580",
Text::InstallingEllipsis => "Installing...",
Text::Done => "Done",
Text::UninstallerTitle => "Uninstaller",
Text::UninstallerSubtitle => "Removing KR580 from this computer.",
Text::InstallFolder => "Install folder",
Text::Removed => "Removed",
Text::RemovedBody => "Press Close to finish and remove the installation folder.",
Text::UninstallFailed => "Uninstall failed",
Text::Removing => "Removing",
Text::RemovingBody => "Cleaning shortcuts, registry entries, PATH, and file associations.",
Text::ClosingEllipsis => "Closing...",
Text::Close => "Close",
}
}
fn ru(text: Text) -> &'static str {
match text {
Text::WindowTitleInstaller => "Установщик KR580",
Text::WindowTitleUninstaller => "Удаление KR580",
Text::InstallerTitle => "Установщик",
Text::InstallerSubtitle => "Выберите режим хранения и папку установки.",
Text::Mode => "Режим",
Text::System => "Системная",
Text::SystemCaption => "Каталоги настроек ОС",
Text::Portable => "Портативная",
Text::PortableCaption => "Данные рядом с программой",
Text::WindowsScope => "Область Windows",
Text::CurrentUser => "Текущий пользователь",
Text::NoElevation => "Без повышения прав",
Text::AllUsers => "Все пользователи",
Text::MachinePath => "Общий PATH",
#[cfg(not(windows))]
Text::Scope => "Область",
#[cfg(not(windows))]
Text::UserInstall => "Установка для пользователя",
Text::Folder => "Папка",
Text::InstallationFolder => "Папка установки",
Text::Browse => "Обзор",
Text::AddKrPath => "Добавить команду kr в PATH",
Text::DesktopShortcut => "Создать ярлык на рабочем столе",
Text::Associate580 => "Связать .580 с KR580",
Text::Ready => "Готово",
Text::ReadyBody => "Выберите режим, папку и параметры установки.",
Text::Installing => "Установка",
Text::InstallingBody => "Копирование файлов и запись данных установки.",
Text::InstallFailed => "Установка не выполнена",
Text::Installed => "Установлено",
Text::Location => "Папка",
Text::TerminalLaunchEnabled => "Запуск из терминала включён.",
Text::TerminalLaunchUnchanged => "Запуск из терминала не изменён.",
Text::FileAssociationCreated => "Файлы .580 открываются через KR580.",
Text::FileAssociationUnchanged => "Связь с .580 не изменена.",
Text::PortableReady => "Портативная установка готова.",
Text::SearchDesktopUninstallReady => "Поиск, ярлык и удаление готовы.",
Text::SearchUninstallReady => "Поиск и удаление готовы.",
Text::OpenInstallationFolder => "Открыть папку установки",
Text::LaunchKr580 => "Запустить KR580",
Text::InstallKr580 => "Установить KR580",
Text::InstallingEllipsis => "Установка...",
Text::Done => "Готово",
Text::UninstallerTitle => "Удаление",
Text::UninstallerSubtitle => "Удаление KR580 с этого компьютера.",
Text::InstallFolder => "Папка установки",
Text::Removed => "Удалено",
Text::RemovedBody => "Нажмите «Закрыть», чтобы завершить и удалить папку установки.",
Text::UninstallFailed => "Удаление не выполнено",
Text::Removing => "Удаление",
Text::RemovingBody => "Очистка ярлыков, реестра, PATH и связей файлов.",
Text::ClosingEllipsis => "Закрытие...",
Text::Close => "Закрыть",
}
}