I18n через jsonb-поля

This commit is contained in:
2025-04-24 15:53:05 +04:00
parent 35b571eb57
commit 31ad99ade5
33 changed files with 409 additions and 264 deletions
+3 -2
View File
@@ -5,6 +5,7 @@ using Pf2eModel;
using Pf2eModel.Model;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Common.I18n;
using Pf2eModel.Model.Structure;
using System.ComponentModel;
@@ -70,11 +71,11 @@ internal class EntityConverter : JsonConverter
private void ProcessTrait(Dictionary<string, object?> dictionary, Trait trait)
{
string name = trait.Entity?.Name ?? _context.Entities.Where(e => e.Id == trait.Id).Select(e => e.Name).FirstOrDefault()!;
LocaleString name = trait.Entity?.Name ?? _context.Entities.Where(e => e.Id == trait.Id).Select(e => e.Name).FirstOrDefault()!;
dictionary.Remove("Entity");
dictionary.Remove("Entities");
dictionary.Add("Name", name);
dictionary.Add("Name", name.ToString());
}
private void ProcessEntity(Dictionary<string, object?> dictionary, Entity entity)
+1 -1
View File
@@ -296,7 +296,7 @@ public partial class MainViewForm : Form
private class EntityGridRow(Entity e)
{
public int Id { get; set; } = e.Id;
public string Name { get; set; } = e.Name;
public string Name { get; set; } = e.Name.ToString();
public EntityRarity Rarity { get; set; } = e.Rarity;
private readonly Entity _e = e;