MOD未加载时支持翻译

This commit is contained in:
ZouJin 2023-07-26 09:32:31 +10:00
parent 2ae8314154
commit 646d7398ef
3 changed files with 21 additions and 5 deletions

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using VPet_Simulator.Core;
using VPet_Simulator.Windows.Interface;
@ -81,6 +82,18 @@ namespace VPet_Simulator.Windows
else
ItemID = 0;
CacheDate = modlps.GetDateTime("cachedate", DateTime.MinValue);
//MOD未加载时支持翻译
foreach (var line in modlps.FindAllLine("lang"))
{
List<ILine> ls = new List<ILine>();
foreach (var sub in line)
{
ls.Add(new Line(sub.Name, sub.info));
}
LocalizeCore.AddCulture(line.info, ls);
}
if (!IsOnMOD(mw))
{
//Content = "该模组已停用".Translate();

View File

@ -610,7 +610,10 @@
</TextBlock>
</StackPanel>
</Grid>
<ScrollViewer VerticalScrollBarVisibility="Auto" Height="60" Margin="0,7,0,0"
<Label Content="{ll:Str MOD介绍}" HorizontalAlignment="Left" Margin="-5,0,0,0"
VerticalAlignment="Center" FontSize="18" FontWeight="Bold" Background="{x:Null}"
Padding="5,5,5,0" />
<ScrollViewer VerticalScrollBarVisibility="Auto" Height="80"
pu:ScrollViewerHelper.ScrollBarThickness="10" HorizontalAlignment="Left"
VerticalAlignment="Top">
<TextBlock x:Name="GameInfo" TextWrapping="Wrap" FontSize="14"
@ -622,7 +625,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel>
<Label Content="{ll:Str MOD介绍}" HorizontalAlignment="Left" Margin="-5,0,0,0"
<Label Content="{ll:Str 内容}" HorizontalAlignment="Left" Margin="-5,0,0,0"
VerticalAlignment="Center" FontSize="18" FontWeight="Bold" Background="{x:Null}" />
<ScrollViewer VerticalScrollBarVisibility="Auto" Height="140" Margin="0,0,0,0"
pu:ScrollViewerHelper.ScrollBarThickness="10" HorizontalAlignment="Left"
@ -633,7 +636,7 @@
</ScrollViewer>
</StackPanel>
<StackPanel Grid.Column="1">
<Label Content="{ll:Str 内容}" HorizontalAlignment="Left" Margin="-5,0,0,0"
<Label Content="{ll:Str 操作}" HorizontalAlignment="Left" Margin="-5,0,0,0"
VerticalAlignment="Top" FontSize="18" FontWeight="Bold" Background="{x:Null}" />
<TextBlock x:Name="ButtonOpenModFolder" Cursor="Hand" HorizontalAlignment="Left"
Margin="0,0,0,0" TextWrapping="Wrap" Text="{ll:Str '所在文件夹'}"

View File

@ -185,7 +185,7 @@ namespace VPet_Simulator.Windows
private void ShowMod(string modname)
{
mod = mw.CoreMODs.Find(x => x.Name == modname);
LabelModName.Content = mod.Name;
LabelModName.Content = mod.Name.Translate();
runMODAuthor.Text = mod.Author;
runMODGameVer.Text = CoreMOD.INTtoVER(mod.GameVer);
runMODGameVer.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText);
@ -272,7 +272,7 @@ namespace VPet_Simulator.Windows
ButtonSteam.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
}
runMODVer.Text = CoreMOD.INTtoVER(mod.Ver);
GameInfo.Text = mod.Intro;
GameInfo.Text = mod.Intro.Translate();
string content = "";
foreach (string tag in mod.Tag)
{