feat: implement localization support and add language settings

This commit is contained in:
kitbyte
2025-12-14 18:57:30 +02:00
parent a943b91f5f
commit d02b84a414
26 changed files with 964 additions and 19 deletions
+10 -8
View File
@@ -50,7 +50,7 @@
ToolTip="Click to update"
Command="{Binding UpdateCommand}"
Visibility="{Binding IsUpdateAvailable, Converter={StaticResource ToVisibilityConverter}}"
Content="A new version is available"/>
Content="{DynamicResource mw_update_available}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
@@ -59,6 +59,7 @@
Width="25" Height="25" Padding="5.5"
Style="{StaticResource IconButton}"
Tag="{StaticResource CogIcon}"
Command="{Binding OpenSettingsCommand}"
/>
<Button
Margin="9 0 15 0"
@@ -95,9 +96,9 @@
<Grid Margin="10" Cursor="Hand" Background="Transparent">
<TextBox Style="{StaticResource TitledTextBox}"
Uid="Folder path" IsReadOnly="True"
IsReadOnly="True"
Text="{Binding WeModInfo.RootDirectory, Mode=OneWay}"
VerticalAlignment="Center" Tag="Folder not found">
VerticalAlignment="Center">
</TextBox>
<Grid.InputBindings>
<MouseBinding Gesture="LeftClick" Command="{Binding SetFolderPathCommand}" />
@@ -169,14 +170,15 @@
<Button Style="{StaticResource ColoredButton}"
IsEnabled="{Binding IsPatchEnabled}"
FontWeight="Bold" FontSize="16" Width="200"
Command="{Binding ApplyPatchCommand}">Patch</Button>
Command="{Binding ApplyPatchCommand}"
Content="{DynamicResource mw_patch}"/>
</Grid>
<Button HorizontalAlignment="Right"
Command="{Binding RestoreBackupCommand }"
FontWeight="Bold" FontSize="16" Width="200"
Style="{StaticResource ColoredButton}"
Visibility="{Binding AlreadyPatched, Converter={StaticResource ToVisibilityConverter}}"
Content="Restore"/>
Content="{DynamicResource mw_restore}"/>
</Grid>
</StackPanel>
@@ -194,13 +196,13 @@
</Viewbox>
<Grid>
<TextBlock Margin="8 0 0 0" FontSize="10" Foreground="{DynamicResource AccentForeground}">
<Hyperlink Foreground="{DynamicResource AccentForeground}">Source code </Hyperlink>
<Hyperlink Foreground="{DynamicResource AccentForeground}"><Run Text="{DynamicResource mw_source_code}"/></Hyperlink>
<LineBreak/>
<Run>Made with ❤️ by k1tbyte</Run>
<Run Text="{DynamicResource mw_made_by}"/>
<LineBreak/>
<Run Foreground="{DynamicResource MutedForeground}">Put a star if you found this helpful ;)</Run>
<Run Foreground="{DynamicResource MutedForeground}" Text="{DynamicResource mw_star_hint}"/>
</TextBlock>
</Grid>
</StackPanel>
+9 -2
View File
@@ -72,6 +72,7 @@ namespace WeModPatcher.View.MainWindow
public RelayCommand ApplyPatchCommand { get; }
public RelayCommand RestoreBackupCommand { get; }
public RelayCommand UpdateCommand { get; }
public RelayCommand OpenSettingsCommand { get; }
private void OnFolderPathSelection(object obj)
{
@@ -162,7 +163,7 @@ namespace WeModPatcher.View.MainWindow
IsPatchEnabled = true;
}
});
}), "What are we gonna patch?");
}), Application.Current.FindResource("pv_popup_title") as string);
}
private void Log(string message, ELogType logType)
@@ -199,7 +200,12 @@ namespace WeModPatcher.View.MainWindow
Log("WeModPatcher updated successfully. Restarting...", ELogType.Success);
});
}), "Update available!");
}), Application.Current.FindResource("up_popup_title") as string);
}
private void OnOpenSettings(object param)
{
MainWindow.Instance.OpenPopup(new SettingsPopup(), Application.Current.FindResource("settings_title") as string);
}
public MainWindowVm(MainWindow view)
@@ -210,6 +216,7 @@ namespace WeModPatcher.View.MainWindow
ApplyPatchCommand = new RelayCommand(OnPatching);
RestoreBackupCommand = new RelayCommand(OnBackupRestoring);
UpdateCommand = new RelayCommand(OnUpdate);
OpenSettingsCommand = new RelayCommand(OnOpenSettings);
WeModInfo = Extensions.FindWeMod();
if (WeModInfo == null)