Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add English support #118

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SubRenamer

Subtitle files renaming tool

字幕重命名工具。

支持使用[Sushi](https://github.com/tp7/Sushi)来自动进行字幕调轴。
Expand Down
12 changes: 6 additions & 6 deletions SubRenamer/App.xaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Application x:Class="SubRenamer.App"
<Application x:Uid="Application_1" x:Class="SubRenamer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary x:Uid="ResourceDictionary_1">
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="Fonts.xaml"></ResourceDictionary>
<ResourceDictionary x:Uid="ResourceDictionary_2" Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary x:Uid="ResourceDictionary_3" Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary x:Uid="ResourceDictionary_4" Source="Fonts.xaml"></ResourceDictionary>
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Steel.xaml" />
<ResourceDictionary x:Uid="ResourceDictionary_5" Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Steel.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
16 changes: 8 additions & 8 deletions SubRenamer/Fonts.xaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary x:Uid="ResourceDictionary_1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SubRenamer">
<FontFamily x:Key="DefaultFont">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Key="MahApps.Fonts.Family.Button">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Key="MahApps.Fonts.Family.Header">Segoe UI Light, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Key="MahApps.Fonts.Family.Window.Title">Segoe UI Light, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Key="MahApps.Fonts.Family.Control">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Key="MahApps.Fonts.Family.ToggleSwitch">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Key="MahApps.Fonts.Family.ToggleSwitch.Header">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Uid="FontFamily_1" x:Key="DefaultFont">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Uid="FontFamily_2" x:Key="MahApps.Fonts.Family.Button">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Uid="FontFamily_3" x:Key="MahApps.Fonts.Family.Header">Segoe UI Light, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Uid="FontFamily_4" x:Key="MahApps.Fonts.Family.Window.Title">Segoe UI Light, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Uid="FontFamily_5" x:Key="MahApps.Fonts.Family.Control">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Uid="FontFamily_6" x:Key="MahApps.Fonts.Family.ToggleSwitch">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
<FontFamily x:Uid="FontFamily_7" x:Key="MahApps.Fonts.Family.ToggleSwitch.Header">Segoe UI, Microsoft YaHei UI, Lucida Sans Unicode, Verdana</FontFamily>
</ResourceDictionary>
51 changes: 26 additions & 25 deletions SubRenamer/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
<controls:MetroWindow x:Class="SubRenamer.MainWindow"
<controls:MetroWindow x:Uid="controls:MetroWindow_1" x:Class="SubRenamer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:strings="clr-namespace:SubRenamer.Properties"
mc:Ignorable="d"
BorderBrush="{DynamicResource AccentColorBrush}"
BorderThickness="1"
WindowStartupLocation="CenterScreen"
Title="SubRenamer" Height="700" Width="1400" FontFamily="{DynamicResource DefaultFont}"
>
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
<BooleanToVisibilityConverter x:Uid="BooleanToVisibilityConverter_1" x:Key="BoolToVis" />
</Window.Resources>
<DockPanel LastChildFill="True">
<StackPanel DockPanel.Dock="Bottom">
<WrapPanel Margin="0,5" HorizontalAlignment="Left">
<CheckBox Content="复制字幕到视频目录" Margin="10,0" IsChecked="{Binding CopySub, Mode=TwoWay}"/>
<CheckBox Content="使用sushi自动调轴" Margin="10,0" IsChecked="{Binding EatSushi, Mode=TwoWay}"/>
<TextBox Margin="10,0" Text="{Binding SubtitleFileExtension, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" controls:TextBoxHelper.Watermark="自定义字幕扩展名" Width="200"/>
<DockPanel x:Uid="DockPanel_1" LastChildFill="True">
<StackPanel x:Uid="StackPanel_1" DockPanel.Dock="Bottom">
<WrapPanel x:Uid="WrapPanel_1" Margin="0,5" HorizontalAlignment="Left">
<CheckBox x:Uid="CheckBox_1" Content="{x:Static strings:Resources.复制字幕到视频目录}" Margin="10,0" IsChecked="{Binding CopySub, Mode=TwoWay}"/>
<CheckBox x:Uid="CheckBox_2" Content="{x:Static strings:Resources.使用sushi自动调轴}" Margin="10,0" IsChecked="{Binding EatSushi, Mode=TwoWay}"/>
<TextBox x:Uid="TextBox_1" Margin="10,0" Text="{Binding SubtitleFileExtension, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" controls:TextBoxHelper.Watermark="{x:Static strings:Resources.自定义字幕扩展名}" Width="200"/>
</WrapPanel>
<WrapPanel Margin="0,5" HorizontalAlignment="Left">
<WrapPanel x:Uid="WrapPanel_2" Margin="0,5" HorizontalAlignment="Left">
<WrapPanel.Resources>
<ResourceDictionary>
<ResourceDictionary x:Uid="ResourceDictionary_1">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
<ResourceDictionary x:Uid="ResourceDictionary_2" Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</WrapPanel.Resources>
<Button x:Name="BtnSelectOriginalMovie" Content="选择原视频" Width="100" Margin="10,0" Click="BtnSelectOriginalMovie_OnClick" Visibility="{Binding Path=EatSushi, Converter={StaticResource BoolToVis}, Mode=TwoWay}"/>
<Button x:Name="BtnSelectMovie" Content="选择视频" Width="100" Margin="10,0" Click="BtnSelectMovie_OnClick"/>
<Button x:Name="BtnSelectSub" Content="选择字幕" Width="100" Margin="10,0" Click="BtnSelectSub_OnClick"/>
<Button x:Name="BtnRename" Content="执行重命名" Width="100" Margin="10,0" Click="BtnRename_OnClick"/>
<Button x:Name="BtnClearList" Content="清空列表" Width="100" Margin="10,0" Click="BtnClearList_OnClick"/>
<Button x:Uid="BtnSelectOriginalMovie" x:Name="BtnSelectOriginalMovie" Content="{x:Static strings:Resources.选择原视频}" Width="150" Margin="10,0" Click="BtnSelectOriginalMovie_OnClick" Visibility="{Binding Path=EatSushi, Converter={StaticResource BoolToVis}, Mode=TwoWay}"/>
<Button x:Uid="BtnSelectMovie" x:Name="BtnSelectMovie" Content="{x:Static strings:Resources.选择视频}" Width="150" Margin="10,0" Click="BtnSelectMovie_OnClick"/>
<Button x:Uid="BtnSelectSub" x:Name="BtnSelectSub" Content="{x:Static strings:Resources.选择字幕}" Width="150" Margin="10,0" Click="BtnSelectSub_OnClick"/>
<Button x:Uid="BtnRename" x:Name="BtnRename" Content="{x:Static strings:Resources.执行重命名}" Width="150" Margin="10,0" Click="BtnRename_OnClick"/>
<Button x:Uid="BtnClearList" x:Name="BtnClearList" Content="{x:Static strings:Resources.清空列表}" Width="150" Margin="10,0" Click="BtnClearList_OnClick"/>
</WrapPanel>
</StackPanel>
<ListView x:Name="ListInfo" ItemsSource="{Binding Path=ModelList.Models}" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Visible" AllowDrop="True" Drop="ListInfo_OnDrop">
<ListView x:Uid="ListInfo" x:Name="ListInfo" ItemsSource="{Binding Path=ModelList.Models}" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Visible" AllowDrop="True" Drop="ListInfo_OnDrop">
<ListView.View>
<GridView x:Name="GridView">
<GridViewColumn Header="原视频文件名" Width="350" DisplayMemberBinding="{Binding OriginalMovieFileName}"/>
<GridViewColumn Header="视频文件名" Width="350" DisplayMemberBinding="{Binding MovieFileName}"/>
<GridViewColumn Header="字幕文件名" Width="350" DisplayMemberBinding="{Binding SubFileName}"/>
<GridViewColumn Header="最终文件名" Width="700" DisplayMemberBinding="{Binding RenamedSubFileName}"/>
<GridView x:Uid="GridView" x:Name="GridView">
<GridViewColumn x:Uid="GridViewColumn_1" Header="{x:Static strings:Resources.原视频文件名}" Width="350" DisplayMemberBinding="{Binding OriginalMovieFileName}"/>
<GridViewColumn x:Uid="GridViewColumn_2" Header="{x:Static strings:Resources.视频文件名}" Width="350" DisplayMemberBinding="{Binding MovieFileName}"/>
<GridViewColumn x:Uid="GridViewColumn_3" Header="{x:Static strings:Resources.字幕文件名}" Width="350" DisplayMemberBinding="{Binding SubFileName}"/>
<GridViewColumn x:Uid="GridViewColumn_4" Header="{x:Static strings:Resources.最终文件名}" Width="700" DisplayMemberBinding="{Binding RenamedSubFileName}"/>
</GridView>
</ListView.View>
</ListView>
</DockPanel>
<controls:MetroWindow.WindowButtonCommands>
<controls:WindowButtonCommands Style="{DynamicResource MahApps.Metro.Styles.WindowButtonCommands.Win10}" />
<controls:WindowButtonCommands x:Uid="controls:WindowButtonCommands_1" Style="{DynamicResource MahApps.Metro.Styles.WindowButtonCommands.Win10}" />
</controls:MetroWindow.WindowButtonCommands>
<controls:MetroWindow.LeftWindowCommands>
<controls:WindowCommands>
<iconPacks:PackIconMaterial Kind="RenameBox" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" />
<controls:WindowCommands x:Uid="controls:WindowCommands_1">
<iconPacks:PackIconMaterial x:Uid="iconPacks:PackIconMaterial_1" Kind="RenameBox" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" />
</controls:WindowCommands>
</controls:MetroWindow.LeftWindowCommands>
</controls:MetroWindow>
8 changes: 4 additions & 4 deletions SubRenamer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private async void BtnRename_OnClick(object sender, RoutedEventArgs e)
ProgressDialogController controller = null;
if (EatSushi)
{
controller = await this.ShowProgressAsync("正在处理", "正在处理第1个字幕");
controller = await this.ShowProgressAsync(Properties.Resources.正在处理, "正在处理第1个字幕");
controller.Minimum = 0;
controller.Maximum = 1;
}
Expand Down Expand Up @@ -178,12 +178,12 @@ private async void BtnRename_OnClick(object sender, RoutedEventArgs e)
}

if (EatSushi && controller != null) await controller.CloseAsync();
Logger.Info("重命名完成");
Logger.Info(Properties.Resources.重命名完成);
var message = sb.ToString();
if (string.IsNullOrWhiteSpace(message))
await this.ShowMessageAsync("成功", "重命名成功");
await this.ShowMessageAsync(Properties.Resources.成功, Properties.Resources.重命名成功);
else
await this.ShowMessageAsync("错误", message);
await this.ShowMessageAsync(Properties.Resources.错误, message);
ModelList.Models.Clear();
}

Expand Down
4 changes: 2 additions & 2 deletions SubRenamer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.4.0.0")]
[assembly: AssemblyFileVersion("4.4.0.0")]
Loading