2
0
Krzysztof Krysiński 2 жил өмнө
parent
commit
34b66ae4e5

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

@@ -262,13 +262,16 @@
   "SELECTED_AREA_EMPTY": "Selected area is empty",
   "NOTHING_TO_COPY": "Nothing to copy",
   
-  "ADD_REFERENCE_LAYER": "Add reference layer",
+  "ADD_REFERENCE_LAYER": "Add Reference Layer",
+  "REFERENCE": "Reference",
   "DELETE_REFERENCE_LAYER": "Delete reference layer",
   "TRANSFORM_REFERENCE_LAYER": "Transform reference layer",
   "TOGGLE_REFERENCE_LAYER_POS": "Toggle reference layer position",
   "TOGGLE_REFERENCE_LAYER_POS_DESCRIPTIVE": "Toggle reference layer between topmost or most below",
   "RESET_REFERENCE_LAYER_POS": "Reset reference layer position",
   "REFERENCE_LAYER_PATH": "Reference layer path",
+  "PUT_REFERENCE_LAYER_ABOVE": "Put reference layer above",
+  "PUT_REFERENCE_LAYER_BELOW": "Put reference layer below",
 
   "CLIP_CANVAS": "Clip Canvas",
   "CLIP_LAYER_BELOW": "Clip with layer below",
@@ -416,7 +419,11 @@
   "FLIP_VIEWPORT_HORIZONTALLY": "Flip viewport horizontally",
   "HORIZONTAL_LINE_SYMMETRY": "Horizontal line symmetry",
   "VERTICAL_LINE_SYMMETRY": "Vertical line symmetry",
+  "TOGGLE_VERTICAL_SYMMETRY": "Toggle vertical symmetry",
+  "TOGGLE_HORIZONTAL_SYMMETRY": "Toggle horizontal symmetry",
   "FLIP_VIEWPORT_VERTICALLY": "Flip viewport vertically",
+  "RESET_VIEWPORT": "Reset viewport",
+  "VIEWPORT_SETTINGS": "Viewport settings",
   "SETTINGS": "Settings",
   "OPEN_SETTINGS": "Open settings",
   "OPEN_SETTINGS_DESCRIPTIVE": "Open settings window",

+ 12 - 5
src/PixiEditor/Data/Localization/Languages/pl.json

@@ -101,7 +101,7 @@
     "EXPORT": "Eksportuj",
     "EXPORT_IMAGE": "Eksportuj obraz",
     "IMPORT": "Importuj",
-    "SHORTCUT_TEMPLATES": "Szablonu skrótów klawiszowych",
+    "SHORTCUT_TEMPLATES": "Szablony",
     "RESET_ALL": "Resetuj wszystko",
     "LAYER": "Warstwa",
     "LAYER_DELETE_SELECTED": "Usuń aktywną warstwę/folder",
@@ -368,7 +368,7 @@
     "NOTHING_TO_COPY": "Nie ma nic do skopiowania",
     "REFERENCE_LAYER_PATH": "Ścieżka warstwy referencyjnej",
     "CLIP_LAYER_BELOW": "Dopasuj do warstwy niżej",
-    "FLIP": "Obróć",
+    "FLIP": "Przerzuć",
     "ROTATION": "Obrót",
     "ROT_IMG_90_D": "Obróć obraz 90°",
     "ROT_IMG_180_D": "Obróć obraz 180°",
@@ -384,7 +384,7 @@
     "VERTICAL_LINE_SYMMETRY": "Pionowa oś symetrii",
     "COLOR_PICKER_TITLE": "Próbnik Kolorów",
     "COLOR_SLIDERS_TITLE": "Suwaki Kolorów",
-    "PALETTE_TITLE": "Paleta",
+    "PALETTE_TITLE": "Paleta Kolorów",
     "SWATCHES_TITLE": "Swatche",
     "LAYERS_TITLE": "Warstwy",
     "NAVIGATION_TITLE": "Nawigacja",
@@ -453,7 +453,7 @@
     "LOCK_TRANSPARENCY": "Zablokuj przeźroczystość",
     "COULD_NOT_LOAD_PALETTE": "Nie udało się pobrać palet kolorów",
     "NO_PALETTES_FOUND": "Nie znaleziono żadnych palet.",
-    "LOSPEC_LINK_TEXT": "Słyszałem, że kilka palet możesz znaleźć tutaj: lospec.com/palette-list",
+    "LOSPEC_LINK_TEXT": "Słyszałem, że trochę możesz znaleźć tutaj: lospec.com/palette-list",
     "PALETTE_BROWSER": "Przeglądarka Palet",
     "DELETE_PALETTE_CONFIRMATION": "Czy jesteś pewien, że chcesz usunąć tę paletę? Tej akcji nie można cofnąć.",
     "SHORTCUTS_IMPORTED": "Skróty klawiszowe z {0} zostały zaimportowane poprawnie.",
@@ -491,5 +491,12 @@
     "STOP_IT_TEXT4": "Nie masz nic lepszego do roboty?",
     "LINEAR_DODGE_BLEND_MODE": "Liniowe unikanie (Dodatnie)",
     "PRESS_ANY_KEY": "Wciśnij klawisz",
-    "NONE_SHORTCUT": "Brak"
+    "NONE_SHORTCUT": "Brak",
+    "REFERENCE": "Referencja",
+    "PUT_REFERENCE_LAYER_ABOVE": "Daj warstwę referencyjną do góry",
+    "PUT_REFERENCE_LAYER_BELOW": "Daj warstwę referencyjną w dół",
+    "TOGGLE_VERTICAL_SYMMETRY": "Przełącz pionową oś symetrii",
+    "TOGGLE_HORIZONTAL_SYMMETRY": "Przełącz poziomą oś symetrii",
+    "RESET_VIEWPORT": "Resetuj widok",
+    "VIEWPORT_SETTINGS": "Ustawienia widoku"
 }

+ 14 - 3
src/PixiEditor/Helpers/Converters/BoolToValueConverter.cs

@@ -1,4 +1,5 @@
 using System.Globalization;
+using PixiEditor.Localization;
 
 namespace PixiEditor.Helpers.Converters;
 
@@ -10,12 +11,22 @@ internal class BoolToValueConverter : MarkupConverter
     
     public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
     {
-        if (value is bool boolean && boolean)
+        if (value is bool and true)
         {
-            return TrueValue;
+            return GetValue(TrueValue);
         }
 
-        return FalseValue;
+        return GetValue(FalseValue);
+    }
+
+    private object GetValue(object value)
+    {
+        if (value is string s && s.StartsWith("localized:"))
+        {
+            return new LocalizedString(s.Split("localized:")[1]);
+        }
+
+        return value;
     }
 
     public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

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

@@ -137,7 +137,7 @@ internal class CommandController
             CommandGroups.Add(new CommandGroup(groupDisplayName, storedCommands));
         }
         
-        CommandGroups.Add(new CommandGroup("Misc", miscList));
+        CommandGroups.Add(new CommandGroup(new LocalizedString("MISC"), miscList));
     }
 
     private void LoadTools(IServiceProvider serviceProvider, List<(string internalName, string displayName)> commandGroupsData, OneToManyDictionary<string, Command> commands,

+ 1 - 1
src/PixiEditor/ViewModels/SubViewModels/Document/DocumentManagerViewModel.cs

@@ -11,7 +11,7 @@ using PixiEditor.Views.UserControls.SymmetryOverlay;
 
 namespace PixiEditor.ViewModels.SubViewModels.Document;
 #nullable enable
-[Command.Group("PixiEditor.Document", "Image")]
+[Command.Group("PixiEditor.Document", "IMAGE")]
 internal class DocumentManagerViewModel : SubViewModel<ViewModelMain>
 {
     public ObservableCollection<DocumentViewModel> Documents { get; } = new ObservableCollection<DocumentViewModel>();

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

@@ -72,7 +72,7 @@
                 <StackPanel Grid.Row="2" HorizontalAlignment="Center" Margin="0,30,0,0">
                     <TextBlock FontSize="23" FontWeight="SemiBold" HorizontalAlignment="Center"
                                views:Translator.Key="RECENT_FILES"/>
-                    <TextBlock Margin="0,12.5,0,0" Foreground="LightGray" HorizontalAlignment="Center"
+                    <TextBlock Margin="0,12.5,0,0" Foreground="LightGray" HorizontalAlignment="Center" 
                                views:Translator.Key="RECENT_EMPTY_TEXT">
                         <TextBlock.Visibility>
                             <Binding Path="RecentlyOpened.Count"

+ 6 - 3
src/PixiEditor/Views/Dialogs/ShortcutPopup.xaml

@@ -11,6 +11,7 @@
         xmlns:usercontrols="clr-namespace:PixiEditor.Views.UserControls"
         xmlns:cmds="clr-namespace:PixiEditor.Models.Commands.XAML"
         xmlns:commands1="clr-namespace:PixiEditor.Models.Commands.Commands"
+        xmlns:views="clr-namespace:PixiEditor.Views"
         mc:Ignorable="d"
         WindowStartupLocation="CenterScreen"
         SizeToContent="Height"
@@ -84,9 +85,11 @@
         <DockPanel Grid.Row="3">
             <TextBlock FontSize="14" Margin="10" Foreground="LightGray" HorizontalAlignment="Left" DockPanel.Dock="Bottom">
                 <Hyperlink Style="{StaticResource SettingsLink}"
-                            Command="{cmds:Command PixiEditor.Window.OpenSettingsWindow, UseProvided=True}"
-                            CommandParameter="Keybinds">
-                    <Run Text="Edit"/>
+                            Command="{cmds:Command PixiEditor.Window.OpenSettingsWindow, UseProvided=True}">
+                    <Hyperlink.CommandParameter>
+                        <s:Int32>2</s:Int32>
+                    </Hyperlink.CommandParameter>
+                    <Run views:Translator.Key="EDIT"/>
                     <Run Text="" FontFamily="{StaticResource Feather}"/>
                 </Hyperlink>
             </TextBlock>

+ 6 - 5
src/PixiEditor/Views/UserControls/Layers/ReferenceLayer.xaml

@@ -10,6 +10,7 @@
              xmlns:local1="clr-namespace:PixiEditor.Views.UserControls" 
              xmlns:cmds="clr-namespace:PixiEditor.Models.Commands.XAML"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
+             xmlns:views="clr-namespace:PixiEditor.Views"
              mc:Ignorable="d" 
              d:DesignHeight="60" d:DesignWidth="350" VerticalAlignment="Center" Name="uc">
     <Border BorderBrush="{StaticResource DarkerAccentColor}" BorderThickness="0 2 0 0" MinWidth="60"
@@ -70,7 +71,7 @@
 
                             <TextBlock IsEnabled="{Binding ElementName=uc, Path=IsEnabled}" 
                                         Margin="0 0 5 0" Foreground="White" 
-                                        FontSize="15" VerticalAlignment="Center">Add Reference Layer</TextBlock>
+                                        FontSize="15" VerticalAlignment="Center" views:Translator.Key="ADD_REFERENCE_LAYER"/>
                         </StackPanel>
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="MouseUp">
@@ -92,7 +93,7 @@
                     <Button Cursor="Hand" DockPanel.Dock="Left"
                             Command="{cmds:Command PixiEditor.Layer.ToggleReferenceLayerTopMost}"
                             Style="{StaticResource ImageButtonStyle}" 
-                            ToolTip="{Binding Document.ReferenceLayerViewModel.IsTopMost, ElementName=uc, Converter={converters:BoolToValueConverter FalseValue='Put reference layer above', TrueValue='Put reference layer below'}}"
+                            ToolTip="{Binding Document.ReferenceLayerViewModel.IsTopMost, ElementName=uc, Converter={converters:BoolToValueConverter FalseValue='localized:PUT_REFERENCE_LAYER_ABOVE', TrueValue='localized:PUT_REFERENCE_LAYER_BELOW'}}"
                             RenderOptions.BitmapScalingMode="HighQuality"
                             Width="20" Height="20" HorizontalAlignment="Right">
                         <Button.Background>
@@ -122,7 +123,7 @@
                     <Button Cursor="Hand" DockPanel.Dock="Right"
                             Command="{cmds:Command PixiEditor.Layer.ResetReferenceLayerPosition}"
                             Style="{StaticResource ImageButtonStyle}" 
-                            ToolTip="Reset reference layer position"
+                            views:Translator.TooltipKey="RESET_REFERENCE_LAYER_POS"
                             RenderOptions.BitmapScalingMode="HighQuality"
                             Width="20" Height="20" HorizontalAlignment="Right">
                         <Button.Background>
@@ -132,7 +133,7 @@
                     <Button Cursor="Hand" DockPanel.Dock="Right"
                             Command="{cmds:Command PixiEditor.Layer.TransformReferenceLayer}"
                             Style="{StaticResource ImageButtonStyle}" 
-                            ToolTip="Transform reference layer"
+                            views:Translator.TooltipKey="TRANSFORM_REFERENCE_LAYER"
                             RenderOptions.BitmapScalingMode="HighQuality"
                             Width="20" Height="20" HorizontalAlignment="Right">
                         <Button.Background>
@@ -141,7 +142,7 @@
                     </Button>
                     <TextBlock IsEnabled="{Binding ElementName=uc, Path=IsEnabled}" HorizontalAlignment="Center"
                                Margin="0 0 5 0" Foreground="White" 
-                               FontSize="15" VerticalAlignment="Center">Reference</TextBlock>
+                               FontSize="15" VerticalAlignment="Center" views:Translator.Key="REFERENCE"/>
                 </DockPanel>
             </Grid>
         </DockPanel>

+ 1 - 2
src/PixiEditor/Views/UserControls/SizeInput.xaml

@@ -42,8 +42,7 @@
                      x:Name="textBox"
                      Text="{Binding Size, ElementName=uc, Converter={converters:ToolSizeToIntConverter}}"
                      d:Text="22"
-                     MaxLength = "6"
-                     >
+                     MaxLength = "6">
                 <i:Interaction.Behaviors>
                     <behaviors:GlobalShortcutFocusBehavior/>
                     <behaviors:TextBoxFocusBehavior 

+ 2 - 2
src/PixiEditor/Views/UserControls/SizePicker.xaml

@@ -32,7 +32,7 @@
             <Grid Height="60" HorizontalAlignment="Center" DockPanel.Dock="Top"
                   Visibility="{Binding SizeUnitSelectionVisibility, ElementName=uc}">
                 <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="100"/>
+                    <ColumnDefinition Width="120"/>
                     <ColumnDefinition/>
                 </Grid.ColumnDefinitions>
                 <Grid.RowDefinitions>
@@ -84,7 +84,7 @@
 
             <Grid Height="90" HorizontalAlignment="Center" DockPanel.Dock="Top">
                 <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="40"/>
+                    <ColumnDefinition Width="60"/>
                     <ColumnDefinition/>
                 </Grid.ColumnDefinitions>
                 <Grid.RowDefinitions>

+ 6 - 6
src/PixiEditor/Views/UserControls/Viewport.xaml

@@ -47,7 +47,7 @@
                                         PassEventArgsToCommand="True"/>
             </i:EventTrigger>
         </i:Interaction.Triggers>
-        <views:TogglableFlyout Margin="5" IconPath="/Images/Settings.png" ToolTip="Viewport settings"
+        <views:TogglableFlyout Margin="5" IconPath="/Images/Settings.png" views:Translator.TooltipKey="VIEWPORT_SETTINGS"
                                Panel.ZIndex="2" HorizontalAlignment="Right" VerticalAlignment="Top">
             <views:TogglableFlyout.Child>
                 <Border BorderThickness="1" CornerRadius="5" Padding="5" Background="#C8202020" Panel.ZIndex="2">
@@ -57,7 +57,7 @@
                        Text="{Binding Path=Angle, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, 
              Converter={converters:RadiansToDegreesConverter}, StringFormat={}{0}°}"
                        Width="35" Foreground="White" VerticalAlignment="Center" FontSize="16"/>
-            <Button Width="32" Height="32" ToolTip="Reset viewport"
+            <Button Width="32" Height="32" views:Translator.TooltipKey="RESET_VIEWPORT"
                     Style="{StaticResource OverlayButton}"
                     Click="ResetViewportClicked"
                     Cursor="Hand">
@@ -68,7 +68,7 @@
         </StackPanel>
             <Separator/>
             <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
-                <ToggleButton Width="32" Height="32" ToolTip="Toggle vertical symmetry"
+                <ToggleButton Width="32" Height="32" views:Translator.TooltipKey="TOGGLE_VERTICAL_SYMMETRY"
                         Style="{StaticResource OverlayToggleButton}"
                         IsChecked="{Binding Document.VerticalSymmetryAxisEnabledBindable, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=TwoWay}"
                         Cursor="Hand">
@@ -76,7 +76,7 @@
                         <Image Width="28" Height="28" Source="/Images/SymmetryVertical.png"/>
                     </ToggleButton.Content>
                 </ToggleButton>
-                <ToggleButton Margin="10 0 0 0" Width="32" Height="32" ToolTip="Toggle horizontal symmetry"
+                <ToggleButton Margin="10 0 0 0" Width="32" Height="32" views:Translator.TooltipKey="TOGGLE_HORIZONTAL_SYMMETRY"
                               Style="{StaticResource OverlayToggleButton}"
                               IsChecked="{Binding Document.HorizontalSymmetryAxisEnabledBindable, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=TwoWay}"
                               Cursor="Hand">
@@ -91,7 +91,7 @@
             </StackPanel>
             <Separator/>
             <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
-                <ToggleButton Width="32" Height="32" ToolTip="Flip Horizontally"
+                <ToggleButton Width="32" Height="32" views:Translator.TooltipKey="FLIP_VIEWPORT_HORIZONTALLY"
                               Style="{StaticResource OverlayToggleButton}"
                               IsChecked="{Binding FlipX, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=TwoWay}"
                               Cursor="Hand">
@@ -99,7 +99,7 @@
                         <Image Width="28" Height="28" Source="/Images/FlipHorizontal.png"/>
                     </ToggleButton.Content>
                 </ToggleButton>
-                <ToggleButton Margin="10 0 0 0" Width="32" Height="32" ToolTip="Flip Vertically"
+                <ToggleButton Margin="10 0 0 0" Width="32" Height="32" views:Translator.TooltipKey="FLIP_VIEWPORT_VERTICALLY"
                               Style="{StaticResource OverlayToggleButton}"
                               IsChecked="{Binding FlipY, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=TwoWay}"
                               Cursor="Hand">