Selaa lähdekoodia

localization wip

Krzysztof Krysiński 2 vuotta sitten
vanhempi
commit
d6346e14c0

+ 9 - 0
src/PixiEditor/Data/Localization/LocalizationData.json

@@ -0,0 +1,9 @@
+{
+  "Languages": [
+    {
+      "name": "English",
+      "code": "en",
+      "localeFileName": "en.json"
+    }
+  ]
+}

+ 3 - 1
src/PixiEditor/Helpers/Extensions/ServiceCollectionHelpers.cs

@@ -1,4 +1,5 @@
 using Microsoft.Extensions.DependencyInjection;
+using PixiEditor.Localization;
 using PixiEditor.Models.Commands;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataProviders;
@@ -17,11 +18,12 @@ namespace PixiEditor.Helpers.Extensions;
 internal static class ServiceCollectionHelpers
 {
     /// <summary>
-    /// Add's all the services required to fully run PixiEditor's MainWindow
+    /// Adds all the services required to fully run PixiEditor's MainWindow
     /// </summary>
     public static IServiceCollection AddPixiEditor(this IServiceCollection collection) => collection
         .AddSingleton<ViewModelMain>()
         .AddSingleton<IPreferences, PreferencesSettings>()
+        .AddSingleton<ILocalizationProvider>()
         // View Models
         .AddSingleton<StylusViewModel>()
         .AddSingleton<WindowViewModel>()

+ 6 - 0
src/PixiEditor/Localization/ILocalizationProvider.cs

@@ -0,0 +1,6 @@
+namespace PixiEditor.Localization;
+
+public interface ILocalizationProvider
+{
+    public static ILocalizationProvider Current => ViewModelMain.Current.LocalizationProvider;
+}

+ 8 - 0
src/PixiEditor/Localization/LanguageData.cs

@@ -0,0 +1,8 @@
+namespace PixiEditor.Localization;
+
+public class LanguageData
+{
+    public string Name { get; set; }
+    public string LanguageCode { get; set; }
+    public string LocaleFileName { get; set; }
+}

+ 6 - 0
src/PixiEditor/Localization/LocalizationData.cs

@@ -0,0 +1,6 @@
+namespace PixiEditor.Localization;
+
+public class LocalizationData
+{
+    
+}

+ 6 - 0
src/PixiEditor/Localization/LocalizationProvider.cs

@@ -0,0 +1,6 @@
+namespace PixiEditor.Localization;
+
+internal class LocalizationProvider : ILocalizationProvider
+{
+    
+}

+ 2 - 0
src/PixiEditor/ViewModels/ViewModelMain.cs

@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.Helpers;
 using PixiEditor.Helpers.Collections;
+using PixiEditor.Localization;
 using PixiEditor.Models.Commands;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataHolders;
@@ -71,6 +72,7 @@ internal class ViewModelMain : ViewModelBase
     public RegistryViewModel RegistrySubViewModel { get; set; }
 
     public IPreferences Preferences { get; set; }
+    public ILocalizationProvider LocalizationProvider { get; set; }
 
     public string ActiveActionDisplay => ActionDisplays.HasActive() ? ActionDisplays.GetActive() : ToolsSubViewModel.ActiveTool?.ActionDisplay;