Browse Source

Localized missing stuff and removed Discord RP localization

Krzysztof Krysiński 2 years ago
parent
commit
1bb1d62bf9

+ 1 - 5
src/PixiEditor/Data/Localization/Languages/en.json

@@ -28,10 +28,6 @@
   "RESIZE": "Resize",
   "RESIZE": "Resize",
 
 
   "DISCORD": "Discord",
   "DISCORD": "Discord",
-  "EDITING_IMG": "Editing an image",
-  "EDITING_IMG_DETAIL": "Editing {0}",
-  "ONE_LAYER": "1 layer",
-  "LAYERS": "{0} layers",
 
 
   "KEY_BINDINGS": "Key Bindings",
   "KEY_BINDINGS": "Key Bindings",
 
 
@@ -184,7 +180,6 @@
   "PATH_DOES_NOT_EXIST": "{0} does not exist.",
   "PATH_DOES_NOT_EXIST": "{0} does not exist.",
   "LOCATION_DOES_NOT_EXIST": "Location does not exist.",
   "LOCATION_DOES_NOT_EXIST": "Location does not exist.",
   "FILE_NOT_FOUND": "File not found.",
   "FILE_NOT_FOUND": "File not found.",
-  "FILE_NOT_FOUND_PATH_FULL_PATH": "File {0} does not exist\n(Full Path: {1})",
   "ARE_YOU_SURE": "Are you sure?",
   "ARE_YOU_SURE": "Are you sure?",
   "ARE_YOU_SURE_PATH_FULL_PATH": "Are you sure you want to delete {0}?\nThis data will be lost for all installations.\n(Full Path: {1})",
   "ARE_YOU_SURE_PATH_FULL_PATH": "Are you sure you want to delete {0}?\nThis data will be lost for all installations.\n(Full Path: {1})",
 
 
@@ -333,6 +328,7 @@
   "COPY_COLOR_SECONDARY_RGB_DESCRIPTIVE": "Copy secondary color as RGB code",
   "COPY_COLOR_SECONDARY_RGB_DESCRIPTIVE": "Copy secondary color as RGB code",
 
 
   "PALETTE_COLORS": "Palette Colors",
   "PALETTE_COLORS": "Palette Colors",
+  "DROP_PALETTE": "Drop palette here",
   "REPLACE_SECONDARY_BY_PRIMARY": "Replace secondary color by primary",
   "REPLACE_SECONDARY_BY_PRIMARY": "Replace secondary color by primary",
   "REPLACE_SECONDARY_BY_PRIMARY_DESCRIPTIVE": "Replace the secondary color by the primary color",
   "REPLACE_SECONDARY_BY_PRIMARY_DESCRIPTIVE": "Replace the secondary color by the primary color",
   "REPLACE_PRIMARY_BY_SECONDARY": "Replace primary color by secondary",
   "REPLACE_PRIMARY_BY_SECONDARY": "Replace primary color by secondary",

+ 4 - 2
src/PixiEditor/Models/Commands/Attributes/Commands/FilterAttribute.cs

@@ -1,10 +1,12 @@
-namespace PixiEditor.Models.Commands.Attributes.Commands;
+using PixiEditor.Localization;
+
+namespace PixiEditor.Models.Commands.Attributes.Commands;
 
 
 internal partial class Command
 internal partial class Command
 {
 {
     public class FilterAttribute : CommandAttribute
     public class FilterAttribute : CommandAttribute
     {
     {
-        public string SearchTerm { get; }
+        public LocalizedString SearchTerm { get; }
         
         
         public FilterAttribute(string internalName, string displayName, string searchTerm) : base(internalName, displayName, string.Empty)
         public FilterAttribute(string internalName, string displayName, string searchTerm) : base(internalName, displayName, string.Empty)
         {
         {

+ 1 - 1
src/PixiEditor/Models/Commands/CommandController.cs

@@ -250,7 +250,7 @@ internal class CommandController
                             {
                             {
                                 InternalName = menu.InternalName,
                                 InternalName = menu.InternalName,
                                 DisplayName = menu.DisplayName,
                                 DisplayName = menu.DisplayName,
-                                Description = string.Empty,
+                                Description = menu.DisplayName,
                                 IconEvaluator = IconEvaluator.Default,
                                 IconEvaluator = IconEvaluator.Default,
                                 DefaultShortcut = menu.GetShortcut(),
                                 DefaultShortcut = menu.GetShortcut(),
                                 Shortcut = GetShortcut(name, attribute.GetShortcut(), template)
                                 Shortcut = GetShortcut(name, attribute.GetShortcut(), template)

+ 1 - 1
src/PixiEditor/ViewModels/SubViewModels/Main/DiscordViewModel.cs

@@ -137,7 +137,7 @@ internal class DiscordViewModel : SubViewModel<ViewModelMain>, IDisposable
             if (ShowLayerCount)
             if (ShowLayerCount)
             {
             {
                 int count = CountLayers(document.StructureRoot);
                 int count = CountLayers(document.StructureRoot);
-                state += count == 1 ? new LocalizedString("ONE_LAYER") : new LocalizedString("LAYERS", count);
+                state += count == 1 ? "1 layer" : $"{count} layers";
             }
             }
 
 
             richPresence.State = state;
             richPresence.State = state;

+ 1 - 1
src/PixiEditor/Views/Dialogs/AboutPopup.xaml

@@ -37,7 +37,7 @@
                 <Image Source="../../Images/PixiEditorLogo.png" Height="40" VerticalAlignment="Center"/>
                 <Image Source="../../Images/PixiEditorLogo.png" Height="40" VerticalAlignment="Center"/>
                 <TextBlock FontSize="40" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="10,0,0,0">PixiEditor</TextBlock>
                 <TextBlock FontSize="40" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="10,0,0,0">PixiEditor</TextBlock>
             </StackPanel>
             </StackPanel>
-            <TextBlock Foreground="White" HorizontalAlignment="Center" FontSize="20" FontWeight="Medium" Text="{Binding VersionText}"/>
+            <TextBlock Foreground="White" HorizontalAlignment="Center" FontSize="20" FontWeight="Medium" views:Translator.LocalizedString="{Binding VersionText}"/>
             <Label views:Translator.Key="PROJECT_MAINTAINERS" Style="{StaticResource Header2}" Margin="10 20 0 5"/>
             <Label views:Translator.Key="PROJECT_MAINTAINERS" Style="{StaticResource Header2}" Margin="10 20 0 5"/>
             <StackPanel Orientation="Horizontal" Margin="20 0">
             <StackPanel Orientation="Horizontal" Margin="20 0">
                 <Ellipse Width="32" Height="32" FlowDirection="LeftToRight">
                 <Ellipse Width="32" Height="32" FlowDirection="LeftToRight">

+ 3 - 1
src/PixiEditor/Views/Dialogs/AboutPopup.xaml.cs

@@ -1,12 +1,14 @@
 using System.Windows;
 using System.Windows;
 using System.Windows.Input;
 using System.Windows.Input;
 using PixiEditor.Helpers;
 using PixiEditor.Helpers;
+using PixiEditor.Localization;
 
 
 namespace PixiEditor.Views.Dialogs;
 namespace PixiEditor.Views.Dialogs;
 
 
 public partial class AboutPopup : Window
 public partial class AboutPopup : Window
 {
 {
-    public static string VersionText => $"Version: {VersionHelpers.GetCurrentAssemblyVersionString()}";
+    public static LocalizedString VersionText =>
+        new LocalizedString("VERSION", VersionHelpers.GetCurrentAssemblyVersionString());
 
 
     public bool DisplayDonationButton
     public bool DisplayDonationButton
     {
     {

+ 4 - 3
src/PixiEditor/Views/Translator.cs

@@ -103,7 +103,8 @@ public class Translator : UIElement
 
 
     private static void UpdateKey(DependencyObject d, string key)
     private static void UpdateKey(DependencyObject d, string key)
     {
     {
-        LocalizedString localizedString = new(key);
+        var parameters = GetLocalizedString(d).Parameters;
+        LocalizedString localizedString = new(key, parameters);
         Binding binding = new()
         Binding binding = new()
         {
         {
             Path = new PropertyPath("(0)", ValueProperty),
             Path = new PropertyPath("(0)", ValueProperty),
@@ -153,9 +154,9 @@ public class Translator : UIElement
         element.SetValue(LocalizedStringProperty, value);
         element.SetValue(LocalizedStringProperty, value);
     }
     }
 
 
-    public static string GetLocalizedString(DependencyObject element)
+    public static LocalizedString GetLocalizedString(DependencyObject element)
     {
     {
-        return (string)element.GetValue(LocalizedStringProperty);
+        return (LocalizedString)element.GetValue(LocalizedStringProperty);
     }
     }
     
     
     public static string GetValue(DependencyObject element)
     public static string GetValue(DependencyObject element)

+ 2 - 2
src/PixiEditor/Views/UserControls/DiscordRPPreview.xaml.cs

@@ -10,7 +10,7 @@ namespace PixiEditor.Views.UserControls;
 internal partial class DiscordRPPreview : UserControl
 internal partial class DiscordRPPreview : UserControl
 {
 {
     public static readonly DependencyProperty StateProperty =
     public static readonly DependencyProperty StateProperty =
-        DependencyProperty.Register(nameof(State), typeof(string), typeof(DiscordRPPreview), new PropertyMetadata(new LocalizedString("DISCORD_STATE").Value));
+        DependencyProperty.Register(nameof(State), typeof(string), typeof(DiscordRPPreview), new PropertyMetadata("16x16, 2 Layers"));
 
 
     public string State
     public string State
     {
     {
@@ -19,7 +19,7 @@ internal partial class DiscordRPPreview : UserControl
     }
     }
 
 
     public static readonly DependencyProperty DetailProperty =
     public static readonly DependencyProperty DetailProperty =
-        DependencyProperty.Register(nameof(Detail), typeof(string), typeof(DiscordRPPreview), new PropertyMetadata(new LocalizedString("DISCORD_DETAILS").Value));
+        DependencyProperty.Register(nameof(Detail), typeof(string), typeof(DiscordRPPreview), new PropertyMetadata("Editing an image"));
 
 
     public string Detail
     public string Detail
     {
     {

+ 1 - 1
src/PixiEditor/Views/UserControls/Palettes/PaletteViewer.xaml

@@ -52,7 +52,7 @@
             </StackPanel>
             </StackPanel>
             <Separator Grid.Row="1" Margin="0, 0, 0, 0" BorderBrush="{StaticResource DarkerAccentColor}" BorderThickness="2" />
             <Separator Grid.Row="1" Margin="0, 0, 0, 0" BorderBrush="{StaticResource DarkerAccentColor}" BorderThickness="2" />
             <Grid Visibility="Hidden" Background="{StaticResource AccentColor}" Opacity="0.7" Grid.Row="2" Name="dragDropGrid">
             <Grid Visibility="Hidden" Background="{StaticResource AccentColor}" Opacity="0.7" Grid.Row="2" Name="dragDropGrid">
-                <TextBlock Text="Drop palette here" Foreground="White" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                <TextBlock TextWrapping="Wrap" views:Translator.Key="DROP_PALETTE" Foreground="White" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             </Grid>
             </Grid>
             <ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
             <ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                 <ItemsControl ItemsSource="{Binding Colors, ElementName=paletteControl}" AlternationCount="9999">
                 <ItemsControl ItemsSource="{Binding Colors, ElementName=paletteControl}" AlternationCount="9999">