2
0
Эх сурвалжийг харах

Localized action displays

CPKreuz 2 жил өмнө
parent
commit
0097de45f9

+ 9 - 0
src/PixiEditor/Data/Localization/Languages/en.json

@@ -581,6 +581,15 @@
   "YOUTUBE": "YouTube",
   "DONATE": "Donate",
   
+  "IMPORT_AS_NEW_LAYER": "Import as new layer",
+  "PASTE_AS_PRIMARY_COLOR": "Paste as primary color",
+  "IMPORT_AS_NEW_FILE": "Import as new file",
+  "IMPORT_PALETTE_FILE": "Import palette file",
+  "IMPORT_MULTIPLE_PALETTE_COLORS": "Import colors into palette",
+  "IMPORT_SINGLE_PALETTE_COLOR": "Import color into palette",
+  "IMPORT_AS_REFERENCE_LAYER": "Import as reference layer",
+  "NAVIGATOR_PICK_ACTION_DISPLAY": "Right-click to pick color, Shift-right-click to copy color to clipboard",
+  
   "OPEN_LOCALIZATION_DEBUG_WINDOW": "Open Localization Debug Window",
   "FORCE_OTHER_FLOW_DIRECTION": "Force other flow direction",
   "API_KEY": "API Key",

+ 7 - 6
src/PixiEditor/Helpers/Collections/ActionDisplayList.cs

@@ -1,10 +1,11 @@
 using System.Collections;
+using PixiEditor.Localization;
 
 namespace PixiEditor.Helpers.Collections;
 
-public class ActionDisplayList : IEnumerable<KeyValuePair<string, string>>
+public class ActionDisplayList : IEnumerable<KeyValuePair<string, LocalizedString>>
 {
-    private Dictionary<string, string> _dictionary = new();
+    private Dictionary<string, LocalizedString> _dictionary = new();
     private Action notifyUpdate;
 
     public ActionDisplayList(Action notifyUpdate)
@@ -12,7 +13,7 @@ public class ActionDisplayList : IEnumerable<KeyValuePair<string, string>>
         this.notifyUpdate = notifyUpdate;
     }
 
-    public string this[string key]
+    public LocalizedString? this[string key]
     {
         get => _dictionary[key];
         set
@@ -24,16 +25,16 @@ public class ActionDisplayList : IEnumerable<KeyValuePair<string, string>>
                 return;
             }
             
-            _dictionary[key] = value;
+            _dictionary[key] = value.Value;
             notifyUpdate();
         }
     }
 
-    public string GetActive() => _dictionary.Last().Value;
+    public LocalizedString GetActive() => _dictionary.Last().Value;
 
     public bool HasActive() => _dictionary.Count != 0;
 
-    public IEnumerator<KeyValuePair<string, string>> GetEnumerator() => _dictionary.GetEnumerator();
+    public IEnumerator<KeyValuePair<string, LocalizedString>> GetEnumerator() => _dictionary.GetEnumerator();
 
     IEnumerator IEnumerable.GetEnumerator() => _dictionary.GetEnumerator();
 }

+ 2 - 2
src/PixiEditor/Views/MainWindow.xaml.cs

@@ -222,7 +222,7 @@ internal partial class MainWindow : Window
         {
             if (ColorHelper.ParseAnyFormat(e.Data, out _))
             {
-                DataContext.ActionDisplays[nameof(MainWindow_Drop)] = "Paste as primary color";
+                DataContext.ActionDisplays[nameof(MainWindow_Drop)] = "PASTE_AS_PRIMARY_COLOR";
                 e.Effects = DragDropEffects.Copy;
                 return;
             }
@@ -232,7 +232,7 @@ internal partial class MainWindow : Window
             return;
         }
 
-        DataContext.ActionDisplays[nameof(MainWindow_Drop)] = "Import as new file";
+        DataContext.ActionDisplays[nameof(MainWindow_Drop)] = "IMPORT_AS_NEW_FILE";
     }
 
     private void MainWindow_DragLeave(object sender, DragEventArgs e)

+ 1 - 1
src/PixiEditor/Views/UserControls/Layers/LayersManager.xaml.cs

@@ -154,7 +154,7 @@ internal partial class LayersManager : UserControl
                 return;
             }
 
-            ViewModelMain.Current.ActionDisplays[nameof(LayersManager)] = "Import as new layer";
+            ViewModelMain.Current.ActionDisplays[nameof(LayersManager)] = "IMPORT_AS_NEW_LAYER";
             e.Effects = DragDropEffects.Copy;
         }
         else

+ 1 - 1
src/PixiEditor/Views/UserControls/Layers/ReferenceLayer.xaml.cs

@@ -37,7 +37,7 @@ internal partial class ReferenceLayer : UserControl
             return;
         }
 
-        ViewModelMain.Current.ActionDisplays[nameof(ReferenceLayer_Drop)] = "Import as reference layer";
+        ViewModelMain.Current.ActionDisplays[nameof(ReferenceLayer_Drop)] = "IMPORT_AS_REFERENCE_LAYER";
         e.Handled = true;
     }
 

+ 2 - 2
src/PixiEditor/Views/UserControls/Palettes/PaletteViewer.xaml.cs

@@ -147,12 +147,12 @@ internal partial class PaletteViewer : UserControl
         if (IsSupportedFilePresent(e, out _))
         {
             dragDropGrid.Visibility = Visibility.Visible;
-            ViewModelMain.Current.ActionDisplays[nameof(PaletteViewer)] = "Import palette file";
+            ViewModelMain.Current.ActionDisplays[nameof(PaletteViewer)] = "IMPORT_PALETTE_FILE";
         }
         else if (ColorHelper.ParseAnyFormatList(e.Data, out var list))
         {
             e.Effects = DragDropEffects.Copy;
-            ViewModelMain.Current.ActionDisplays[nameof(PaletteViewer)] = list.Count > 1 ? "Import colors into palette" : "Import color into palette";
+            ViewModelMain.Current.ActionDisplays[nameof(PaletteViewer)] = list.Count > 1 ? "IMPORT_MULTIPLE_PALETTE_COLORS" : "IMPORT_SINGLE_PALETTE_COLOR";
             e.Handled = true;
         }
     }

+ 1 - 1
src/PixiEditor/Views/UserControls/PreviewWindow.xaml.cs

@@ -73,7 +73,7 @@ internal partial class PreviewWindow : UserControl
     {
         if (ViewModelMain.Current != null)
         {
-            ViewModelMain.Current.ActionDisplays[nameof(PreviewWindow)] = "Right-click to pick color, Shift-right-click to copy color to clipboard";
+            ViewModelMain.Current.ActionDisplays[nameof(PreviewWindow)] = "NAVIGATOR_PICK_ACTION_DISPLAY";
         }
     }