Skip to content

Commit

Permalink
perf: 补全本地化
Browse files Browse the repository at this point in the history
  • Loading branch information
textGamex committed Nov 30, 2024
1 parent e534f38 commit e9acf54
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Moder.Core/Models/StateCategory/StateCategoryLeafVo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Moder.Core.Services.GameResources;
using Moder.Language.Strings;

// ReSharper disable once CheckNamespace
namespace Moder.Core.Models.Vo;
Expand All @@ -10,9 +11,7 @@ public StateCategoryLeafVo(string key, string value, GameValueType type, NodeVo?
: base(key, value, type, parent)
{
StateCategory.OnResourceChanged += (_, _) =>
App.Current.DispatcherQueue.TryEnqueue(
() => OnPropertyChanged(nameof(StateCategories))
);
App.Current.DispatcherQueue.TryEnqueue(() => OnPropertyChanged(nameof(StateCategories)));
}

public override string Value
Expand All @@ -29,12 +28,13 @@ public override string Value

public IReadOnlyCollection<StateCategory> StateCategories => StateCategory.StateCategories;

private static readonly StateCategoryService StateCategory = App.Current.Services.GetRequiredService<StateCategoryService>();
private static readonly StateCategoryService StateCategory =
App.Current.Services.GetRequiredService<StateCategoryService>();

private string GetStateCategoryUiDescription()
{
return StateCategory.TryGetValue(Value, out var stateCategory)
? $"{stateCategory.TypeNameDescription} 建筑槽位 [{stateCategory.LocalBuildingSlots}]"
: $"未知的 {Key}";
? $"{stateCategory.TypeNameDescription} {Resource.StateFile_BuildingsSlot} [{stateCategory.LocalBuildingSlots}]"
: $"{Resource.Common_Unknown} {Key}";
}
}
18 changes: 18 additions & 0 deletions Moder.Language/Strings/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Moder.Language/Strings/Resource.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,7 @@
<data name="Common.Warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="Common.Unknown" xml:space="preserve">
<value>Unknown</value>
</data>
</root>
6 changes: 6 additions & 0 deletions Moder.Language/Strings/Resource.resx
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,10 @@
<data name="Menu.LoadingCompletedTip" xml:space="preserve">
<value>初始化完成, 耗时: {0:F3} s</value>
</data>
<data name="StateFile.BuildingsSlot" xml:space="preserve">
<value>建筑槽位</value>
</data>
<data name="Common.Unknown" xml:space="preserve">
<value>未知的</value>
</data>
</root>

0 comments on commit e9acf54

Please sign in to comment.