Skip to content

Commit

Permalink
Merge pull request #104 from alexhauser/installer_localization
Browse files Browse the repository at this point in the history
Installer localization
  • Loading branch information
alexhauser authored Apr 13, 2020
2 parents 4cc4fa8 + 09def4c commit cbe1c40
Show file tree
Hide file tree
Showing 13 changed files with 506 additions and 334 deletions.
72 changes: 69 additions & 3 deletions SQRLPlatformAwareInstaller/Assets/Localization/localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,81 @@
{
"SQRLTag": "Secure Quick Reliable Login",
"InstallerGreeting": "Welcome to the SQRL (Secure Quick Reliable Login) Client Installer.\r\n\r\nIn a nutshell, SQRL is an Authentication Protocol which allows you to log in to Websites and Services which support it without using a standard username and password.\r\n\r\nInstead, SQRL relies on state-of-the-art cryptography to accomplish a much more secure, and much more convenient way of authenticating.\r\n\r\nThere is a lot of fancy math involved and the technology has been proven, suffice it to say that with SQRL you can login to any site with the push of a button and you will not have to know your username or password for any of it.\r\n\r\nSQRL takes care of it all in a convenient yet extremely secure package. To learn more about SQRL please visit: https://sqrl.grc.com/pages/what_is_sqrl/",
"DetectedPlatform": "Detected Platform:"
"DetectedPlatform": "Detected Platform:",
"TitleMainInstall": "SQRL Client Installer",
"TitleVersionSelector": "SQRL Client Installer - Version Selection",
"TitleChooseInstallFolderDialog": "Select installation folder",
"TitleInstallationCompleteDialog": "SQRL Client Installer - Installation Complete",
"BtnNext": "Next",
"BtnCancel": "Cancel",
"BtnBack": "Back",
"BtnInstall": "Install",
"BtnInstallPath": "Install Path...",
"BtnFinish": "Finish",
"InstallStatusInstalling": "Installing...",
"InstallStatusDownloading": "Downloading...",
"SchemaRegistrationWarning": "WARNING: Exising sqrl:// schema registration found, if you proceed, it will be overwritten!",
"SelectInstallVersionLabel": "Select version to install:",
"DescriptionLabel": "Description:",
"ProductionReadyLabel": "Production-ready:",
"ReleaseDateLabel": "Release date:",
"SizeLabel": "Size:",
"InstallSuccessMessage": "The SQRL client has been successfully installed!",
"LaunchClientCheckBox": "Launch SQRL client on finish"
}
],
"en-US": [
{
"SQRLTag": "Secure Quick Reliable Login",
"InstallerGreeting": "Welcome to the SQRL (Secure Quick Reliable Login) Client Installer.\r\n\r\nIn a nutshell, SQRL is an Authentication Protocol which allows you to log in to Websites and Services which support it without using a standard username and password.\r\n\r\nInstead, SQRL relies on state-of-the-art cryptography to accomplish a much more secure, and much more convenient way of authenticating.\r\n\r\nThere is a lot of fancy math involved and the technology has been proven, suffice it to say that with SQRL you can login to any site with the push of a button and you will not have to know your username or password for any of it.\r\n\r\nSQRL takes care of it all in a convenient yet extremely secure package. To learn more about SQRL please visit: https://sqrl.grc.com/pages/what_is_sqrl/",
"DetectedPlatform": "Detected Platform:"
"DetectedPlatform": "Detected Platform:",
"TitleMainInstall": "SQRL Client Installer",
"TitleVersionSelector": "SQRL Client Installer - Version Selection",
"TitleChooseInstallFolderDialog": "Select installation folder",
"TitleInstallationCompleteDialog": "SQRL Client Installer - Installation Complete",
"BtnNext": "Next",
"BtnCancel": "Cancel",
"BtnBack": "Back",
"BtnInstall": "Install",
"BtnInstallPath": "Install Path...",
"BtnFinish": "Finish",
"InstallStatusInstalling": "Installing...",
"InstallStatusDownloading": "Downloading...",
"SchemaRegistrationWarning": "WARNING: Exising sqrl:// schema registration found, if you proceed, it will be overwritten!",
"SelectInstallVersionLabel": "Select version to install:",
"DescriptionLabel": "Description:",
"ProductionReadyLabel": "Production-ready:",
"ReleaseDateLabel": "Release date:",
"SizeLabel": "Size:",
"InstallSuccessMessage": "The SQRL client has been successfully installed!",
"LaunchClientCheckBox": "Launch SQRL client on finish"
}
],
"de-DE": [
{
"SQRLTag": "Secure Quick Reliable Login",
"InstallerGreeting": "Willkommen zum Installations-Programm für SQRL (Secure Quick Reliable Login).\r\n\r\nKurz gesagt handelt es sich bei SQRL um ein Authentifizierungs-Protokoll, das es Ihnen erlaubt, sich bei unterstützten Webseiten und Diensten ohne Benutzername und Passwort einzuloggen.\r\n\r\nStattdessen setzt SQRL auf moderne Kryptographie, um eine deutlich sicherere und beqemere Art der Authentifizierung zu ermöglichen.\r\n\r\nUm mehr über SQRL zu erfahren, besuchen Sie einfach https://sqrl.grc.com/pages/what_is_sqrl/",
"DetectedPlatform": "Erkannte Plattform:",
"TitleMainInstall": "SQRL Client Installer",
"TitleVersionSelector": "SQRL Client Installer - Versions-Auswahl",
"TitleChooseInstallFolderDialog": "Installations-Ordner wählen",
"TitleInstallationCompleteDialog": "SQRL Client Installer - Installation beendet",
"BtnNext": "Weiter",
"BtnCancel": "Abbrechen",
"BtnBack": "Zurück",
"BtnInstall": "Installieren",
"BtnInstallPath": "Install.-Pfad...",
"BtnFinish": "Fertig",
"InstallStatusInstalling": "Installiere...",
"InstallStatusDownloading": "Lade herunter...",
"SchemaRegistrationWarning": "WARNUNG: Existierende sqrl:// Schema-Registrierung gefunden, diese wird überschrieben!",
"SelectInstallVersionLabel": "Version auswählen:",
"DescriptionLabel": "Beschreibung:",
"ProductionReadyLabel": "Produktiveinsatz:",
"ReleaseDateLabel": "Release-Datum:",
"SizeLabel": "Größe:",
"InstallSuccessMessage": "Der SQRL-Client wurde erfolgreich installiert!",
"LaunchClientCheckBox": "SQRL Client beim Fertigstellen starten"
}

]
}
4 changes: 4 additions & 0 deletions SQRLPlatformAwareInstaller/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Program
// yet and stuff might break.
public static void Main(string[] args)
{
// Set up logging
string currentDir = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
string logFilePath = Path.Combine(currentDir, "SQRLInstallerLog.log");

Expand All @@ -26,6 +27,9 @@ public static void Main(string[] args)
.WriteTo.File(logFilePath, rollingInterval: RollingInterval.Day)
.CreateLogger();

Log.Information("New app instance is being launched on {OSDescription}",
RuntimeInformation.OSDescription);

BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
Expand Down
11 changes: 8 additions & 3 deletions SQRLPlatformAwareInstaller/SQRLPlatformAwareInstaller.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<AvaloniaResource Remove="Assets\VL.png" />
<AvaloniaResource Remove="Assets\windows.png" />
<AvaloniaResource Remove="Views\InstallationCompleteView.xaml" />
<AvaloniaResource Remove="Views\MainInstalView.xaml" />
<AvaloniaResource Remove="Views\MainInstallView.xaml" />
<AvaloniaResource Remove="Views\VersionSelectorView.xaml" />
</ItemGroup>
<ItemGroup>
Expand All @@ -77,7 +77,7 @@
<None Remove="Assets\VL.png" />
<None Remove="Assets\windows.png" />
<None Remove="Views\InstallationCompleteView.xaml" />
<None Remove="Views\MainInstalView.xaml" />
<None Remove="Views\MainInstallView.xaml" />
<None Remove="Views\VersionSelectorView.xaml" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -122,7 +122,7 @@
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Views\MainInstalView.xaml">
<EmbeddedResource Include="Views\MainInstallView.xaml">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
Expand All @@ -143,4 +143,9 @@
<ItemGroup>
<Resource Include="Assets\sqrl_icon_normal_256.ico" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\MainInstallView.xaml.cs">
<DependentUpon>MainInstallView.xaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,51 +1,72 @@
using Avalonia;
using ReactiveUI;
using System;
using System.Collections.Generic;
using ReactiveUI;
using System.Diagnostics;
using System.Text;

namespace SQRLPlatformAwareInstaller.ViewModels
{
/// <summary>
/// A view model representing the final confirmation screen
/// of the SQRL installer.
/// </summary>
public class InstallationCompleteViewModel: ViewModelBase
{
private string installPath = "";
private string _installPath = "";
private bool _launchOnFinish = true;


private bool _LaunchOnFinish = true;
/// <summary>
/// Gets or sets whether the SQRL client should be launched
/// when the dialog is closed using the "finish" button.
/// </summary>
public bool LaunchOnFinish
{
get { return _LaunchOnFinish; }
set { this.RaiseAndSetIfChanged(ref _LaunchOnFinish, value); }
get { return _launchOnFinish; }
set { this.RaiseAndSetIfChanged(ref _launchOnFinish, value); }

}

/// <summary>
/// Creates a new instance and initializes things.
/// </summary>
public InstallationCompleteViewModel()
{
this.Title = "SQRL Client Installer - Installation Complete";
Init();
}

public InstallationCompleteViewModel(string installPath)
{
this.installPath = installPath;
this.Title = "SQRL Client Installer - Installation Complete";
this._installPath = installPath;
Init();
}

/// <summary>
/// Performs some common initialization like setting the dialog title etc.
/// </summary>
private void Init()
{
this.Title = _loc.GetLocalizationValue("TitleInstallationCompleteDialog");
}

/// <summary>
/// Launches the SQRL client (if selected) and exits the installer.
/// </summary>
public void Finish()
{
if(this.LaunchOnFinish)
{
LaunchSQRL(this.installPath);
LaunchSQRL(this._installPath);
}
System.Environment.Exit(0);
}

/// <summary>
/// Launches the freshly installed SQRL client app.
/// </summary>
/// <param name="installPath"></param>
private void LaunchSQRL(string installPath)
{
var process = new Process();
process.StartInfo.FileName = installPath;
process.StartInfo.UseShellExecute = true;
process.Start();

}
}
}
71 changes: 0 additions & 71 deletions SQRLPlatformAwareInstaller/ViewModels/MainInstalViewModel.cs

This file was deleted.

91 changes: 91 additions & 0 deletions SQRLPlatformAwareInstaller/ViewModels/MainInstallViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Runtime.InteropServices;
using Avalonia.Media.Imaging;
using ReactiveUI;
using Serilog;

namespace SQRLPlatformAwareInstaller.ViewModels
{
/// <summary>
/// A view model representing the main installer screen.
/// </summary>
public class MainInstallViewModel: ViewModelBase
{
private Bitmap _platformImg;

/// <summary>
/// An image representing the current OS platform.
/// </summary>
public Bitmap PlatformImg
{
get
{
return _platformImg;
}
set { this.RaiseAndSetIfChanged(ref _platformImg, value); }
}

/// <summary>
/// A string representing the current OS platform.
/// </summary>
public string Platform
{
get
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return "Windows";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return "MacOSX";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
return "Linux";
else
return "";
}
}

/// <summary>
/// Creates a new instance, sets the window title and
/// starts the platform detection.
/// </summary>
public MainInstallViewModel()
{
Log.Information("Installer main screen launched");

this.Title = _loc.GetLocalizationValue("TitleMainInstall");
DetectPlatform();
Log.Information($"Detected platform: {Platform}");
}

/// <summary>
/// Detects the OS platform and sets some UI elements accordingly.
/// </summary>
public void DetectPlatform()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
this.PlatformImg = new Bitmap(_assets.Open(new Uri("resm:SQRLPlatformAwareInstaller.Assets.windows.png")));
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
this.PlatformImg = new Bitmap(_assets.Open(new Uri("resm:SQRLPlatformAwareInstaller.Assets.mac.png")));
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
this.PlatformImg = new Bitmap(_assets.Open(new Uri("resm:SQRLPlatformAwareInstaller.Assets.linux.png")));
else
this.PlatformImg = new Bitmap(_assets.Open(new Uri("resm:SQRLPlatformAwareInstaller.Assets.unknown.png")));
}

/// <summary>
/// Moves on to the version selection screen.
/// </summary>
public void Next()
{
((MainWindowViewModel)_mainWindow.DataContext).Content =
new VersionSelectorViewModel();
}

/// <summary>
/// Exits the application.
/// </summary>
public void Cancel()
{
Environment.Exit(0);
}
}
}
Loading

0 comments on commit cbe1c40

Please sign in to comment.