2022-11-14 19:32:41 +00:00
|
|
|
|
using DataModel.Database.Common;
|
|
|
|
|
|
|
|
|
|
namespace DataModel.Database;
|
2022-06-12 19:42:47 +00:00
|
|
|
|
|
|
|
|
|
public sealed class Translation
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
2022-11-06 20:07:41 +00:00
|
|
|
|
|
2023-01-22 20:39:36 +00:00
|
|
|
|
public Guid UniqueId { get; set; } = Guid.NewGuid();
|
2022-06-12 19:42:47 +00:00
|
|
|
|
|
2023-01-22 18:35:57 +00:00
|
|
|
|
public TextElement TextElement { get; set; } = new();
|
2022-06-12 19:42:47 +00:00
|
|
|
|
|
|
|
|
|
public string Culture { get; set; } = "en-US";
|
|
|
|
|
|
|
|
|
|
public string Text { get; set; } = string.Empty;
|
2022-09-21 20:52:17 +00:00
|
|
|
|
|
|
|
|
|
public bool TranslateManual { get; set; } = false;
|
2022-11-14 19:32:41 +00:00
|
|
|
|
|
2023-01-22 20:07:02 +00:00
|
|
|
|
internal DataContext.JsonUniqueId JsonUniqueId => new($"{this.TextElement.Code}@{this.Culture}", this.UniqueId, "Trans");
|
2022-11-14 19:32:41 +00:00
|
|
|
|
|
|
|
|
|
internal DataContext.JsonTranslation ToJsonTranslation() => new()
|
|
|
|
|
{
|
|
|
|
|
UniqueId = this.JsonUniqueId,
|
|
|
|
|
Culture = this.Culture,
|
|
|
|
|
TranslateManual = this.TranslateManual,
|
|
|
|
|
TextElementUniqueId = this.TextElement.JsonUniqueId,
|
|
|
|
|
Text = this.Text,
|
|
|
|
|
};
|
2023-01-22 18:35:57 +00:00
|
|
|
|
|
|
|
|
|
internal static Translation FromJsonTranslation(DataContext.JsonTranslation jsonTranslation) => new()
|
|
|
|
|
{
|
|
|
|
|
UniqueId = jsonTranslation.UniqueId.UniqueId,
|
|
|
|
|
Culture = jsonTranslation.Culture,
|
|
|
|
|
TranslateManual = jsonTranslation.TranslateManual,
|
|
|
|
|
Text = jsonTranslation.Text,
|
|
|
|
|
TextElement = new(),
|
|
|
|
|
};
|
2022-06-12 19:42:47 +00:00
|
|
|
|
}
|