diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest index cd178a1..7262596 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest @@ -12,7 +12,7 @@ + Version="1.1.208.0" /> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs index f1b2edb..6769458 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs @@ -6,6 +6,7 @@ using BetterLyrics.WinUI3.Services.AlbumArtSearchService; using BetterLyrics.WinUI3.Services.DiscordService; using BetterLyrics.WinUI3.Services.LastFMService; using BetterLyrics.WinUI3.Services.LibWatcherService; +using BetterLyrics.WinUI3.Services.LocalizationService; using BetterLyrics.WinUI3.Services.LyricsSearchService; using BetterLyrics.WinUI3.Services.MediaSessionsService; using BetterLyrics.WinUI3.Services.SettingsService; @@ -20,14 +21,11 @@ using Microsoft.UI.Xaml; using Microsoft.Windows.ApplicationModel.Resources; using Serilog; using System; -using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Vanara.PInvoke; -using Windows.Storage; -using WinUI3Localizer; namespace BetterLyrics.WinUI3 { @@ -69,10 +67,8 @@ namespace BetterLyrics.WinUI3 } } - protected override async void OnLaunched(LaunchActivatedEventArgs args) + protected override void OnLaunched(LaunchActivatedEventArgs args) { - await InitializeLocalizer(); - var settingsService = Ioc.Default.GetRequiredService(); settingsService.UpdateLanguage(); @@ -124,6 +120,7 @@ namespace BetterLyrics.WinUI3 .AddSingleton() .AddSingleton() .AddSingleton() + .AddSingleton() // ViewModels .AddSingleton() .AddSingleton() @@ -147,43 +144,6 @@ namespace BetterLyrics.WinUI3 ); } - private async Task InitializeLocalizer() - { - // Initialize a "Strings" folder in the "LocalFolder" for the packaged app. - StorageFolder localFolder = ApplicationData.Current.LocalFolder; - StorageFolder stringsFolder = await localFolder.CreateFolderAsync("Strings", CreationCollisionOption.ReplaceExisting); - - // Create string resources file from app resources. - string resourceFileName = "Resources.resw"; - foreach (var item in LanguageHelper.SupportedDisplayLanguages) - { - await CreateStringResourceFile(stringsFolder, item.LanguageCode, resourceFileName); - } - - ILocalizer localizer = await new LocalizerBuilder() - .AddStringResourcesFolderForLanguageDictionaries(stringsFolder.Path) - .SetOptions(options => - { - options.DefaultLanguage = "en"; - }) - .Build(); - } - - private static async Task CreateStringResourceFile(StorageFolder stringsFolder, string language, string resourceFileName) - { - StorageFolder languageFolder = await stringsFolder.CreateFolderAsync(language, CreationCollisionOption.ReplaceExisting); - - string resourceFilePath = Path.Combine(stringsFolder.Name, language, resourceFileName); - StorageFile resourceFile = await LoadStringResourcesFileFromAppResource(resourceFilePath); - _ = await resourceFile.CopyAsync(languageFolder); - } - - private static async Task LoadStringResourcesFileFromAppResource(string filePath) - { - Uri resourcesFileUri = new($"ms-appx:///{filePath}"); - return await StorageFile.GetFileFromApplicationUriAsync(resourcesFileUri); - } - private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) { _logger.LogError(e.Exception, "App_UnhandledException"); diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj index 4e60d2a..361b8a1 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj @@ -105,7 +105,6 @@ - @@ -342,36 +341,6 @@ MSBuild:Compile - - - Always - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - MSBuild:Compile @@ -417,6 +386,44 @@ MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AboutControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AboutControl.xaml index 91aac3b..1d6156e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AboutControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AboutControl.xaml @@ -7,7 +7,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dev="using:DevWinUI" xmlns:helper="using:BetterLyrics.WinUI3.Helper" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:uc="using:BetterLyrics.WinUI3.Controls" @@ -49,7 +48,7 @@ VerticalAlignment="Center" Foreground="{ThemeResource TextFillColorSecondaryBrush}"> - + @@ -60,9 +59,9 @@ - - - + + + @@ -70,18 +69,18 @@ - + - - - + + + - + @@ -122,14 +121,14 @@ - + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/FontFamilyAutoSuggestBox.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/FontFamilyAutoSuggestBox.xaml index 9085437..6681eab 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/FontFamilyAutoSuggestBox.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/FontFamilyAutoSuggestBox.xaml @@ -4,7 +4,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:models="using:BetterLyrics.WinUI3.Models" @@ -46,12 +45,12 @@ Glyph=}" Style="{StaticResource GhostButtonStyle}"> - + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBackgroundSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBackgroundSettingsControl.xaml index cd3bfce..74c27a1 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBackgroundSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBackgroundSettingsControl.xaml @@ -7,7 +7,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dev="using:DevWinUI" xmlns:enums="using:BetterLyrics.WinUI3.Enums" - xmlns:l="using:WinUI3Localizer" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:uc="using:BetterLyrics.WinUI3.Controls" xmlns:ui="using:CommunityToolkit.WinUI" @@ -18,25 +17,25 @@ - + - + - - - + + + - + - + - + - + - - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + @@ -134,7 +133,7 @@ @@ -164,7 +163,7 @@ Unit="°" Value="{x:Bind LyricsEffectSettings.Lyrics3DZAngle, Mode=TwoWay}" /> - + - + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - + - + - + - + - + @@ -46,9 +45,9 @@ + VerticalAlignment="Center" /> - + @@ -81,9 +80,9 @@ + VerticalAlignment="Center" /> - + @@ -120,7 +119,7 @@ CornerRadius="4"> - + @@ -130,9 +129,9 @@ + VerticalAlignment="Center" /> - + - + @@ -52,12 +51,12 @@ Glyph=}" Style="{StaticResource GhostButtonStyle}"> - + - + @@ -87,10 +86,10 @@ Spacing="6"> - - + + @@ -109,7 +108,7 @@ HorizontalAlignment="Stretch" Click="SetDefaultMenuFlyoutItem_Click" IsChecked="{Binding IsDefault, Mode=OneWay}"> - + @@ -120,7 +119,7 @@ Grid.Column="0" HorizontalAlignment="Stretch" Click="ConfigButton_Click"> - + @@ -129,13 +128,13 @@ - + - + @@ -192,25 +191,25 @@ Style="{StaticResource PivotSegmentedStyle}"> - + - + - + - + - + - + - + @@ -236,19 +235,19 @@ - + - + - - - + + + - + - - + + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml index a064c36..624571c 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml @@ -6,7 +6,6 @@ xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" - xmlns:l="using:WinUI3Localizer" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:uc="using:BetterLyrics.WinUI3.Controls" xmlns:ui="using:CommunityToolkit.WinUI" @@ -26,10 +25,10 @@ + VerticalAlignment="Top" /> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs index 7691d20..be5452e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs @@ -1,12 +1,13 @@ using BetterLyrics.WinUI3.Helper; using BetterLyrics.WinUI3.Hooks; +using BetterLyrics.WinUI3.Services.LocalizationService; +using CommunityToolkit.Mvvm.DependencyInjection; using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; using System.Collections.Generic; using Windows.UI.Core; -using WinUI3Localizer; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -15,7 +16,7 @@ namespace BetterLyrics.WinUI3.Controls { public sealed partial class ShortcutTextBox : UserControl { - private readonly ILocalizer _localizer = Localizer.Get(); + private readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService(); public ShortcutTextBox() { diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/SystemTray.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/SystemTray.xaml index a546ea9..6eda0c6 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/SystemTray.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/SystemTray.xaml @@ -4,7 +4,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:tb="using:H.NotifyIcon" @@ -30,37 +29,37 @@ diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/WindowSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/WindowSettingsControl.xaml index 671e94c..a763b05 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/WindowSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/WindowSettingsControl.xaml @@ -5,7 +5,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dev="using:DevWinUI" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="using:CommunityToolkit.WinUI" @@ -16,9 +15,9 @@ - + - + - + - + - - + + - + @@ -157,7 +156,7 @@ FontFamily="{StaticResource IconFontFamily}" FontSize="16" Glyph="" /> - + @@ -218,8 +217,8 @@ Visibility="{x:Bind IsClosable, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}"> - - + + @@ -283,9 +282,9 @@ @@ -320,17 +319,17 @@ Spacing="6"> - - - - + + + + @@ -347,12 +346,12 @@ SelectionMode="Multiple"> - - - + + + @@ -508,8 +507,8 @@ Spacing="12"> @@ -533,9 +532,9 @@ - + @@ -570,9 +569,9 @@ - - - + + + @@ -622,7 +621,7 @@ Glyph=}" Style="{StaticResource GhostButtonStyle}"> - + @@ -636,7 +635,7 @@ Glyph=}" Style="{StaticResource GhostButtonStyle}"> - + @@ -668,7 +667,7 @@ Glyph=}" Style="{StaticResource GhostButtonStyle}"> - + @@ -698,8 +697,8 @@ Spacing="12"> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs index f675063..dd96bbb 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/MusicGalleryPage.xaml.cs @@ -14,7 +14,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using WinUI3Localizer; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -26,8 +25,6 @@ namespace BetterLyrics.WinUI3.Views /// public sealed partial class MusicGalleryPage : Page { - private readonly ILocalizer _localizer = Localizer.Get(); - public MusicGalleryPageViewModel ViewModel => (MusicGalleryPageViewModel)DataContext; public MusicGalleryPage() diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml index ac1afe6..704a8d4 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml @@ -11,7 +11,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dev="using:DevWinUI" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:media="using:CommunityToolkit.WinUI.Media" @@ -80,11 +79,11 @@ diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingWindow.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingWindow.xaml index fc6ce63..1aee783 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingWindow.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingWindow.xaml @@ -7,7 +7,6 @@ xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dev="using:DevWinUI" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:media="using:CommunityToolkit.WinUI.Media" @@ -57,7 +56,7 @@ FontSize="{x:Bind ViewModel.TitleBarFontSize, Mode=OneWay}" Glyph="" /> - + @@ -71,7 +70,7 @@ FontSize="{x:Bind ViewModel.TitleBarFontSize, Mode=OneWay}" Glyph="" /> - + @@ -82,7 +81,7 @@ FontSize="{x:Bind ViewModel.TitleBarFontSize, Mode=OneWay}" Glyph="" /> - + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml index 3c84b14..07fb90b 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml @@ -8,7 +8,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dev="using:DevWinUI" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:models="using:BetterLyrics.WinUI3.Models" @@ -27,32 +26,32 @@ diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml index a22a59e..ad920b1 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml @@ -4,7 +4,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:l="using:WinUI3Localizer" xmlns:local="using:BetterLyrics.WinUI3.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:uc="using:BetterLyrics.WinUI3.Controls" @@ -22,7 +21,7 @@ FontSize="12" Glyph="" /> - + @@ -33,7 +32,7 @@ Glyph=}" Style="{StaticResource TitleBarButtonStyle}"> - +