diff --git a/CompactGUI.Core/Analyser.cs b/CompactGUI.Core/Analyser.cs index 0fb1f3a2..920e308e 100644 --- a/CompactGUI.Core/Analyser.cs +++ b/CompactGUI.Core/Analyser.cs @@ -116,7 +116,7 @@ private static bool GetContainsCompressedFiles(List fileCom ? WOFCompressionAlgorithm.NO_COMPRESSION : WOFHelper.DetectCompression(fileInfo); - return new AnalysedFileDetails { FileName = file, CompressedSize = compressedSize, UncompressedSize = uncompressedSize, CompressionMode = compressionMode, FileInfo = fileInfo }; + return new AnalysedFileDetails { FileName = file, CompressedSize = compressedSize, UncompressedSize = uncompressedSize, CompressionMode = compressionMode}; } catch (IOException ex) { @@ -151,7 +151,7 @@ public List GetPoorlyCompressedExtensions() public void Dispose() { _folderMonitor.Dispose(); - _analysedFileDetails?.Clear(); + _analysedFileDetails = null; } } diff --git a/CompactGUI.Core/Settings/Settings.cs b/CompactGUI.Core/Settings/Settings.cs index 2716e23c..4c598fe0 100644 --- a/CompactGUI.Core/Settings/Settings.cs +++ b/CompactGUI.Core/Settings/Settings.cs @@ -46,7 +46,7 @@ public partial class Settings : ObservableRecipient [ObservableProperty] private WindowState windowState = WindowState.Normal; [ObservableProperty] private bool alwaysShowDetailedCompressionMode = false; - [ObservableProperty] private string language = "en-US"; + [ObservableProperty] private string language = "en-AU"; partial void OnScheduledBackgroundIntervalChanged(int value) => UpdateNextScheduledBackgroundRun(); diff --git a/CompactGUI.Core/SharedObjects.cs b/CompactGUI.Core/SharedObjects.cs index 61f67fe9..447c72d5 100644 --- a/CompactGUI.Core/SharedObjects.cs +++ b/CompactGUI.Core/SharedObjects.cs @@ -7,7 +7,6 @@ public sealed class AnalysedFileDetails public long UncompressedSize { get; set; } public long CompressedSize { get; set; } public WOFCompressionAlgorithm CompressionMode { get; set; } - public FileInfo? FileInfo { get; set; } } diff --git a/CompactGUI/Application.xaml.vb b/CompactGUI/Application.xaml.vb index ea26da18..af52cc3f 100644 --- a/CompactGUI/Application.xaml.vb +++ b/CompactGUI/Application.xaml.vb @@ -58,6 +58,7 @@ Partial Public Class Application 'Settings handler services.AddSingleton(Of ISettingsService)(SettingsService) + services.AddSingleton(Of LocalisationService)() services.AddLogging(Sub(logging) logging.SetMinimumLevel(SettingsService.AppSettings.LogLevel) @@ -131,7 +132,6 @@ Partial Public Class Application Return TryCast(_host?.Services.GetService(GetType(T)), T) End Function - Public Shared ReadOnly mutex As New Mutex(False, "Global\CompactGUI") Private pipeServerCancellation As New CancellationTokenSource() Private pipeServerTask As Task @@ -155,7 +155,7 @@ Partial Public Class Application End If InitializeHost() - LanguageHelper.Initialize(GetService(Of ISettingsService).AppSettings) + Await GetService(Of LocalisationService).InitializeAsync() GetService(Of Watcher.Watcher)() @@ -345,4 +345,4 @@ Partial Public Class Application ' End If 'End Function -End Class \ No newline at end of file +End Class diff --git a/CompactGUI/CompactGUI.vbproj b/CompactGUI/CompactGUI.vbproj index 53f273ae..d810d58e 100644 --- a/CompactGUI/CompactGUI.vbproj +++ b/CompactGUI/CompactGUI.vbproj @@ -27,6 +27,7 @@ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 + true @@ -45,6 +46,7 @@ + @@ -55,6 +57,8 @@ + + @@ -79,29 +83,8 @@ - - i18n.es-ES.resx - True - True - - - True - True - i18n.resx - - - - - - i18n - i18n.es-ES.Designer.vb - PublicResXFileCodeGenerator - - - i18n - PublicResXFileCodeGenerator - i18n.Designer.vb - + + diff --git a/CompactGUI/Components/Converters/IValueConverters.vb b/CompactGUI/Components/Converters/IValueConverters.vb index 01acbafc..1ed516cc 100644 --- a/CompactGUI/Components/Converters/IValueConverters.vb +++ b/CompactGUI/Components/Converters/IValueConverters.vb @@ -18,13 +18,13 @@ Public Class BytesToReadableConverter : Implements IValueConverter Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert Dim suf As String() = { - LanguageHelper.GetString("SizeUnit_B"), - LanguageHelper.GetString("SizeUnit_KB"), - LanguageHelper.GetString("SizeUnit_MB"), - LanguageHelper.GetString("SizeUnit_GB"), - LanguageHelper.GetString("SizeUnit_TB"), - LanguageHelper.GetString("SizeUnit_PB"), - LanguageHelper.GetString("SizeUnit_EB") + "B".LT("File size"), + "KB".LT("File size"), + "MB".LT("File size"), + "GB".LT("File size"), + "TB".LT("File size"), + "PB".LT("File size"), + "EB".LT("File size") } If value = 1010101010101010 Then Return "?" @@ -102,16 +102,16 @@ Public Class RelativeDateConverter : Implements IValueConverter Dim ts As TimeSpan = DateTime.Now - dt If ts > TimeSpan.FromDays(19000) Then - Return LanguageHelper.GetString("Time_Unknown") + Return "Unknown".LT("Relative date") End If If ts > TimeSpan.FromDays(2) Then - Return String.Format(LanguageHelper.GetString("Time_DaysAgo"), ts.TotalDays) + Return "{0:0} days ago".LTF(ts.TotalDays) ElseIf ts > TimeSpan.FromHours(2) Then - Return String.Format(LanguageHelper.GetString("Time_HoursAgo"), ts.TotalHours) + Return "{0:0} hours ago".LTF(ts.TotalHours) ElseIf ts > TimeSpan.FromMinutes(2) Then - Return String.Format(LanguageHelper.GetString("Time_MinutesAgo"), ts.TotalMinutes) + Return "{0:0} minutes ago".LTF(ts.TotalMinutes) Else - Return LanguageHelper.GetString("Time_Now") + Return "just now".LT() End If End Function @@ -300,15 +300,15 @@ Public Class FolderStatusToStringConverter : Implements IValueConverter Dim status = CType(value, ActionState) Select Case status Case ActionState.Idle - Return LanguageHelper.GetString("Status_AwaitingCompression") + Return "Awaiting Compression".LT() Case ActionState.Analysing - Return LanguageHelper.GetString("Status_Analysing") + Return "Analysing".LT() Case ActionState.Working, ActionState.Paused - Return LanguageHelper.GetString("Status_Working") + Return "Working".LT() Case ActionState.Results - Return LanguageHelper.GetString("Status_Compressed") + Return "Compressed".LT() Case Else - Return LanguageHelper.GetString("Status_Unknown") + Return "Unknown".LT("Folder status") End Select End Function Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack @@ -493,4 +493,4 @@ Public Class EnumToIntConverter If targetType Is Nothing OrElse Not targetType.IsEnum OrElse value Is Nothing Then Return Binding.DoNothing Return [Enum].ToObject(targetType, value) End Function -End Class \ No newline at end of file +End Class diff --git a/CompactGUI/Components/Settings/Settings_skiplistflyout.xaml b/CompactGUI/Components/Settings/Settings_skiplistflyout.xaml index 5e3eb144..f5752895 100644 --- a/CompactGUI/Components/Settings/Settings_skiplistflyout.xaml +++ b/CompactGUI/Components/Settings/Settings_skiplistflyout.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:CompactGUI" + xmlns:loc="clr-namespace:LazyTranslate;assembly=LazyTranslate" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" Width="620" @@ -89,9 +90,8 @@ + Margin="10" FontSize="22" FontWeight="SemiBold" + loc:L.Value="edit skipped filetypes" /> @@ -104,9 +104,8 @@ Background="{StaticResource CardBackground}" Visibility="Collapsed"> - + @@ -145,15 +144,13 @@ Margin="10 10 10 0" Visibility="Collapsed"> + VerticalAlignment="Center" Checked="UiChkIncludeWiki_Checked" + loc:L.Value="Include smart skipped file types" + ToolTip="{loc:T 'For Steam Games, this uses the database to determine types to skip. For non-Steam folders this is based on the smart analyser.'}" Unchecked="UiChkIncludeWiki_Unchecked" /> + Margin="0 0 130 20" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="UISave_Click" + loc:L.Context="Skiplist editor" + loc:L.Value="Save" /> @@ -112,7 +112,7 @@ + diff --git a/CompactGUI/Views/Pages/PendingCompression.xaml b/CompactGUI/Views/Pages/PendingCompression.xaml index 1a00997c..ca9d03ae 100644 --- a/CompactGUI/Views/Pages/PendingCompression.xaml +++ b/CompactGUI/Views/Pages/PendingCompression.xaml @@ -4,6 +4,7 @@ xmlns:core="clr-namespace:CompactGUI.Core;assembly=CompactGUI.Core" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:CompactGUI" + xmlns:loc="clr-namespace:LazyTranslate;assembly=LazyTranslate" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" d:DataContext="{d:DesignInstance Type=local:FolderViewModel}" @@ -21,9 +22,8 @@ - + --> - + @@ -138,18 +136,16 @@ + Text="{loc:Binding Folder.SkippedFileCount, Format={} {0} files will be skipped}" /> - @@ -161,11 +157,11 @@ + diff --git a/CompactGUI/Views/Pages/ResultsTemplate.xaml b/CompactGUI/Views/Pages/ResultsTemplate.xaml index 29fc7cad..40511184 100644 --- a/CompactGUI/Views/Pages/ResultsTemplate.xaml +++ b/CompactGUI/Views/Pages/ResultsTemplate.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:CompactGUI" + xmlns:loc="clr-namespace:LazyTranslate;assembly=LazyTranslate" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" d:DesignHeight="450" @@ -23,9 +24,8 @@ - + - + loc:L.Context="Compression size" + loc:L.Value="Before" /> - + loc:L.Context="Compression size" + loc:L.Value="After" /> @@ -69,9 +69,8 @@ Margin="0 0 20 20" Padding="10 20 10 20" Background="#30FFFFFF" BorderThickness="0"> - + @@ -81,9 +80,8 @@ Margin="0 0 20 20" Padding="10 20 10 20" Background="#30FFFFFF" BorderThickness="0"> - + @@ -96,9 +94,8 @@ Margin="0 0 20 20" Padding="10 20 10 20" Background="#30FFFFFF" BorderThickness="0"> - + @@ -115,25 +112,22 @@ @@ -151,3 +145,4 @@ + diff --git a/CompactGUI/Views/Pages/WatcherPage.xaml b/CompactGUI/Views/Pages/WatcherPage.xaml index 936422bf..663d0ef1 100644 --- a/CompactGUI/Views/Pages/WatcherPage.xaml +++ b/CompactGUI/Views/Pages/WatcherPage.xaml @@ -4,12 +4,13 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:CompactGUI" + xmlns:loc="clr-namespace:LazyTranslate;assembly=LazyTranslate" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" - Title="{local:Localize PageNameWatcher}" - d:Title="WatcherPage"> + Title="{loc:T 'WatcherPage'}"> + diff --git a/CompactGUI/Views/SettingsPage.xaml b/CompactGUI/Views/SettingsPage.xaml index 6e2515c0..4ec02a79 100644 --- a/CompactGUI/Views/SettingsPage.xaml +++ b/CompactGUI/Views/SettingsPage.xaml @@ -4,6 +4,7 @@ xmlns:Flags="clr-namespace:FamFamFam.Flags.Wpf;assembly=FamFamFam.Flags.Wpf" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" + xmlns:loc="clr-namespace:LazyTranslate;assembly=LazyTranslate" xmlns:local="clr-namespace:CompactGUI" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" @@ -20,11 +21,9 @@ - + - + @@ -36,6 +35,7 @@ + @@ -53,7 +53,7 @@ + Text="{Binding NativeName}" /> @@ -62,8 +62,20 @@ + + + + + + + + - -