Skip to content

Commit

Permalink
Merge pull request #2 from hhhxiao/er_dlc
Browse files Browse the repository at this point in the history
elden ring DLC support & DB merge tool
  • Loading branch information
hhhxiao authored Jun 30, 2024
2 parents 4b1c101 + 6ecd991 commit 64ab2d9
Show file tree
Hide file tree
Showing 5 changed files with 40,129 additions and 55 deletions.
198 changes: 147 additions & 51 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,49 @@
xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI"
PlaceTitleBarOverContent="False"
Title="魂友MOD翻译工具v2.0"
Height="615" Width="820"
Height="615"
Width="820"
FontSize="14"
ShrinkTitleBarWhenMaximized="True">

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" />
<ColumnDefinition />
<ColumnDefinition Width="140"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="0" Padding="0">
<GroupBox Grid.Column="0"
Padding="0">
<StackPanel>
<Border Height="{Binding Path=TitleBarActualHeight, RelativeSource={RelativeSource AncestorType={x:Type adonisControls:AdonisWindow}}}" />
<Button Name="TranslateTab" Click="TranslateTab_OnClick" Height="40" Content="翻译"
<Border Height="{Binding Path=TitleBarActualHeight, RelativeSource={RelativeSource AncestorType={x:Type adonisControls:AdonisWindow}}}"/>
<Button Name="TranslateTab"
Click="TranslateTab_OnClick"
Height="40"
Content="翻译"
Style="{DynamicResource {x:Static adonisUi:Styles.ToolbarButton}}">
</Button>
<Button Name="ToolTab" Click="TranslateTab_OnClick" Height="40" Content="工具"
<Button Name="ToolTab"
Click="TranslateTab_OnClick"
Height="40"
Content="工具"
Style="{DynamicResource {x:Static adonisUi:Styles.ToolbarButton}}">
</Button>
<Button Name="AboutTab" Click="TranslateTab_OnClick" Height="40" Content="关于"
<Button Name="AboutTab"
Click="TranslateTab_OnClick"
Height="40"
Content="关于"
Style="{DynamicResource {x:Static adonisUi:Styles.ToolbarButton}}">
</Button>
</StackPanel>
</GroupBox>

<StackPanel Grid.Column="1">

<StackPanel Name="TranslateStackPanel" Margin="10">
<Label Margin="8" VerticalContentAlignment="Center" FontSize="20" FontWeight="Normal">基本设置</Label>
<StackPanel Name="TranslateStackPanel"
Margin="10">
<Label Margin="8"
VerticalContentAlignment="Center"
FontSize="20"
FontWeight="Normal">基本设置</Label>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
Expand All @@ -44,19 +59,44 @@
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>

<Label Margin="2" Grid.Row="0" Grid.Column="0" Content="选择msg目录" VerticalContentAlignment="Center" FontWeight="Normal"></Label>
<TextBox Margin="2" Grid.Row="0" Grid.Column="1" Name="ModPathTextBox" VerticalContentAlignment="Center" MaxLines="1"></TextBox>
<Button Margin="2" Grid.Row="0" Grid.Column="2"
<Label Margin="2"
Grid.Row="0"
Grid.Column="0"
Content="选择msg目录"
VerticalContentAlignment="Center"
FontWeight="Normal"></Label>
<TextBox Margin="2"
Grid.Row="0"
Grid.Column="1"
Name="ModPathTextBox"
VerticalContentAlignment="Center"
MaxLines="1"></TextBox>
<Button Margin="2"
Grid.Row="0"
Grid.Column="2"
Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}"
Click="SelectPathButton_Click">
浏览
</Button>
<Label Margin="2" Grid.Row="1" Grid.Column="0" VerticalContentAlignment="Center" FontWeight="Normal">选择数据库</Label>
<ComboBox Margin="2" Name="DbComboBox" VerticalContentAlignment="Center" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"></ComboBox>
<Label Margin="2"
Grid.Row="1"
Grid.Column="0"
VerticalContentAlignment="Center"
FontWeight="Normal">选择数据库</Label>
<ComboBox Margin="2"
Name="DbComboBox"
VerticalContentAlignment="Center"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="2"></ComboBox>
</Grid>

<Label Margin="8" VerticalContentAlignment="Center" FontSize="20" FontWeight="Normal">术语表</Label>
<CheckBox Name="UseGlossaryCheckBox" Margin="2">启用术语表(导出时使用词汇表替换未翻译文本内的专有名词)</CheckBox>
<Label Margin="8"
VerticalContentAlignment="Center"
FontSize="20"
FontWeight="Normal">术语表</Label>
<CheckBox Name="UseGlossaryCheckBox"
Margin="2">启用术语表(导出时使用词汇表替换未翻译文本内的专有名词)</CheckBox>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
Expand All @@ -66,81 +106,137 @@
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="180"></RowDefinition>
</Grid.RowDefinitions>
<Button Margin="2" Grid.Row="0" Grid.Column="0" Click="GlossaryAdd_onClick">添加词汇表</Button>
<Button Margin="2" Grid.Row="0" Grid.Column="1" Click="GlossaryRemove_onClick">删除选中词汇表</Button>
<ListBox Margin="2" SelectionMode="Extended" Name="GlossaryListBox"
Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
<Button Margin="2"
Grid.Row="0"
Grid.Column="0"
Click="GlossaryAdd_onClick">添加词汇表</Button>
<Button Margin="2"
Grid.Row="0"
Grid.Column="1"
Click="GlossaryRemove_onClick">删除选中词汇表</Button>
<ListBox Margin="2"
SelectionMode="Extended"
Name="GlossaryListBox"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2">
</ListBox>
</Grid>

<Label Margin="8" VerticalContentAlignment="Center" FontSize="20" FontWeight="Normal">生成</Label>
<CheckBox Name="UseExcelCheckBox" Margin="2">将未翻译文本以.xlsx格式导出(方便上传到谷歌翻译)</CheckBox>
<CheckBox Name="SplitCheckBox" Margin="2" IsEnabled="False">未翻译文本过多(大于50K行时)时拆分为多个文件(防止谷歌翻译失败)</CheckBox>
<CheckBox Name="UseCompactCheckBox" Margin="2" IsEnabled="False">使用压缩+索引的存储格式(导出文本较少,机翻结果更统一,但是逻辑性更弱)</CheckBox>
<StackPanel Orientation="Horizontal" FlowDirection="RightToLeft" Height="50">
<Button Name="GenerateBtn" Click="GenerateBtn_onClick" Margin="2" Width="120"
<Label Margin="8"
VerticalContentAlignment="Center"
FontSize="20"
FontWeight="Normal">生成</Label>
<CheckBox Name="UseExcelCheckBox"
Margin="2">将未翻译文本以.xlsx格式导出(方便上传到谷歌翻译)</CheckBox>
<CheckBox Name="SplitCheckBox"
Margin="2"
IsEnabled="False">未翻译文本过多(大于50K行时)时拆分为多个文件(防止谷歌翻译失败)</CheckBox>
<CheckBox Name="UseCompactCheckBox"
Margin="2"
IsEnabled="False">使用压缩+索引的存储格式(导出文本较少,机翻结果更统一,但是逻辑性更弱)</CheckBox>
<StackPanel Orientation="Horizontal"
FlowDirection="RightToLeft"
Height="50">
<Button Name="GenerateBtn"
Click="GenerateBtn_onClick"
Margin="2"
Width="120"
Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}">
生成翻译文件
</Button>
<Button Name="ExportBtn" Click="ExportBtn_onClick" Margin="2" Width="120" Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}">导出未翻译文本</Button>
<Button Name="ExportBtn"
Click="ExportBtn_onClick"
Margin="2"
Width="120"
Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}">导出未翻译文本</Button>
</StackPanel>
</StackPanel>

<StackPanel Name="ToolStackPanel" Margin="10">
<Button Margin="2" Height="40" Name="ExportDbBtn" Click="ExportDbBtn_OnClick">从已有翻译中导出对照数据库</Button>
<StackPanel Name="ToolStackPanel"
Margin="10">
<Button Margin="2"
Height="40"
Name="ExportDbBtn"
Click="ExportDbBtn_OnClick">从原版文本或已有翻译中导出对照数据库</Button>
<Button Margin="2"
Height="40"
Name="MergeDbBtn"
Click="MergeDbBtn_OnClick">合并多个对照数据库(请置于同一个文件夹)</Button>
</StackPanel>

<StackPanel Name="AboutStackPanel" Margin="10">
<Label Name="AboutTitleLabel" Margin="8" VerticalContentAlignment="Center" FontSize="20" FontWeight="Normal">SOFTWARE_NAME by hhhxiao_</Label>
<TextBlock Margin="16,0" TextWrapping="Wrap">
<StackPanel Name="AboutStackPanel"
Margin="10">
<Label Name="AboutTitleLabel"
Margin="8"
VerticalContentAlignment="Center"
FontSize="20"
FontWeight="Normal">SOFTWARE_NAME by hhhxiao_</Label>
<TextBlock Margin="16,0"
TextWrapping="Wrap">
本软件可以导出mod新增的所有文本,并导入翻译后的新增文本以生成.msgbng.dcx的标准文本文件。可以
帮助没有相关技术基础的玩家高效机翻Mod,同时也能帮助人工翻译者省去繁杂的额外步骤,专注翻于译。
</TextBlock>
<TextBlock Margin="16,0" TextWrapping="Wrap">
<TextBlock Margin="16,0"
TextWrapping="Wrap">
本软件目前支持艾尔登法环,只狼和黑暗之魂3,采用GPL v3.0协议,所有代码完全开源。
</TextBlock>
<Label Margin="8" VerticalContentAlignment="Center" FontSize="20" FontWeight="Normal">作者信息</Label>
<Label Margin="8"
VerticalContentAlignment="Center"
FontSize="20"
FontWeight="Normal">作者信息</Label>
<TextBlock Margin="16,0">
作者Github:
<Hyperlink NavigateUri="https://github.com/hhhxiao" RequestNavigate="Hyperlink_RequestNavigate">https://github.com/hhhxiao</Hyperlink>
<Hyperlink NavigateUri="https://github.com/hhhxiao"
RequestNavigate="Hyperlink_RequestNavigate">https://github.com/hhhxiao</Hyperlink>
</TextBlock>
<TextBlock Margin="16,0">
作者Bilibili:
<Hyperlink NavigateUri="https://space.bilibili.com/34227664" RequestNavigate="Hyperlink_RequestNavigate">https://space.bilibili.com/34227664</Hyperlink>
<Hyperlink NavigateUri="https://space.bilibili.com/34227664"
RequestNavigate="Hyperlink_RequestNavigate">https://space.bilibili.com/34227664</Hyperlink>
</TextBlock>
<TextBlock Margin="16,0">
作者爱发电:
<Hyperlink NavigateUri="https://afdian.net/@hhhxiao" RequestNavigate="Hyperlink_RequestNavigate">https://afdian.net/@hhhxiao</Hyperlink>
<Hyperlink NavigateUri="https://afdian.net/@hhhxiao"
RequestNavigate="Hyperlink_RequestNavigate">https://afdian.net/@hhhxiao</Hyperlink>
</TextBlock>

<Label Margin="8" VerticalContentAlignment="Center" FontSize="20" FontWeight="Normal">教程与反馈</Label>
<Label Margin="8"
VerticalContentAlignment="Center"
FontSize="20"
FontWeight="Normal">教程与反馈</Label>
<TextBlock Margin="16,0">
使用教程:
<Hyperlink NavigateUri="https://www.bilibili.com/video/BV17p421Q7qJ/" RequestNavigate="Hyperlink_RequestNavigate">https://www.bilibili.com/video/BV17p421Q7qJ/</Hyperlink>
<Hyperlink NavigateUri="https://www.bilibili.com/video/BV17p421Q7qJ/"
RequestNavigate="Hyperlink_RequestNavigate">https://www.bilibili.com/video/BV17p421Q7qJ/</Hyperlink>
</TextBlock>
<TextBlock Margin="16,0">
前往Github反馈:
<Hyperlink NavigateUri="https://github.com/hhhxiao/SoulsModTranslator/issues" RequestNavigate="Hyperlink_RequestNavigate">https://github.com/hhhxiao/SoulsModTranslator/issues</Hyperlink>
<Hyperlink NavigateUri="https://github.com/hhhxiao/SoulsModTranslator/issues"
RequestNavigate="Hyperlink_RequestNavigate">https://github.com/hhhxiao/SoulsModTranslator/issues</Hyperlink>
</TextBlock>
<TextBlock Margin="16,0">
<TextBlock Margin="16,0">
更新日志:
<Hyperlink NavigateUri="https://github.com/hhhxiao/SoulsModTranslator/blob/main/changelog.md" RequestNavigate="Hyperlink_RequestNavigate">https://github.com/hhhxiao/SoulsModTranslator/blob/main/changelog.md</Hyperlink>
<Hyperlink NavigateUri="https://github.com/hhhxiao/SoulsModTranslator/blob/main/changelog.md"
RequestNavigate="Hyperlink_RequestNavigate">https://github.com/hhhxiao/SoulsModTranslator/blob/main/changelog.md</Hyperlink>
</TextBlock>



<Label Margin="8" VerticalContentAlignment="Center" FontSize="20" FontWeight="Normal">第三方库</Label>
<Label Margin="8"
VerticalContentAlignment="Center"
FontSize="20"
FontWeight="Normal">第三方库</Label>
<TextBlock Margin="16,0">
FromSoftware引擎dcx文件读写:
<Hyperlink NavigateUri="https://github.com/JKAnderson/SoulsFormats" RequestNavigate="Hyperlink_RequestNavigate">SoulsFormats</Hyperlink>
<Hyperlink NavigateUri="https://github.com/JKAnderson/SoulsFormats"
RequestNavigate="Hyperlink_RequestNavigate">SoulsFormats</Hyperlink>
</TextBlock>
<TextBlock Margin="16,0">
UI界面设计:
<Hyperlink NavigateUri="https://github.com/benruehl/adonis-ui" RequestNavigate="Hyperlink_RequestNavigate">adonis-ui</Hyperlink>(MIT License)
<Hyperlink NavigateUri="https://github.com/benruehl/adonis-ui"
RequestNavigate="Hyperlink_RequestNavigate">adonis-ui</Hyperlink>(MIT License)
</TextBlock>
<TextBlock Margin="16,0">
Excel表格文件读写:
<Hyperlink NavigateUri="https://github.com/nissl-lab/npoi" RequestNavigate="Hyperlink_RequestNavigate"> npoi</Hyperlink> (Apache License Version 2.0)
<Hyperlink NavigateUri="https://github.com/nissl-lab/npoi"
RequestNavigate="Hyperlink_RequestNavigate"> npoi</Hyperlink> (Apache License Version 2.0)
</TextBlock>
</StackPanel>
</StackPanel>
Expand Down
23 changes: 21 additions & 2 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class MainWindow : AdonisWindow
{
private static readonly string DbPath = Path.Combine(Directory.GetCurrentDirectory(), "db");
private static readonly string GlossaryPath = Path.Combine(Directory.GetCurrentDirectory(), "glossaries");
private static readonly string SoftwareName = "魂游MOD翻译工具 v2.2";
private static readonly string SoftwareName = "魂游MOD翻译工具 v2.3";



Expand Down Expand Up @@ -128,9 +128,28 @@ private async void ExportDbBtn_OnClick(object sender, RoutedEventArgs e)
savePath = saveDialog.FileName;
var res = await Task.Run(() => DbTool.CreateDb(keyPath, valuePath, savePath));
ShowTaskResult(res, "导出成功", "导出失败");
}

}

private async void MergeDbBtn_OnClick(object sender, RoutedEventArgs e)
{
var dialog = new System.Windows.Forms.OpenFileDialog();
dialog.InitialDirectory = DbPath;
dialog.Filter = "Json 文件 (*.json)|*.json|所有文件|*.*";
dialog.Multiselect = true;
var result = dialog.ShowDialog();
if (result != System.Windows.Forms.DialogResult.OK) return;
//save path
var savePath = "";
var saveDialog = new SaveFileDialog();
saveDialog.Filter = "Json文件(*.json)|*";
saveDialog.FileName = "Untitled.json";
var saveResult = saveDialog.ShowDialog();
if (saveResult != System.Windows.Forms.DialogResult.OK) return;
savePath = saveDialog.FileName;
var res = await Task.Run(() => DbTool.MergeDB(dialog.FileNames, savePath));
ShowTaskResult(res, "合并成功", "合并失败");
}
private void TranslateTab_OnClick(object sender, RoutedEventArgs e)
{
if (sender is Button btn)
Expand Down
Loading

0 comments on commit 64ab2d9

Please sign in to comment.