38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using DataModel.Database.Common;
|
|
|
|
namespace DataModel.Database;
|
|
|
|
public sealed class Translation
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
public Guid UniqueId { get; set; } = Guid.NewGuid();
|
|
|
|
public TextElement TextElement { get; set; } = new();
|
|
|
|
public string Culture { get; set; } = "en-US";
|
|
|
|
public string Text { get; set; } = string.Empty;
|
|
|
|
public bool TranslateManual { get; set; } = false;
|
|
|
|
internal DataContext.JsonUniqueId JsonUniqueId => new($"{this.TextElement.Code}@{this.Culture}", this.UniqueId, "Trans");
|
|
|
|
internal DataContext.JsonTranslation ToJsonTranslation() => new()
|
|
{
|
|
UniqueId = this.JsonUniqueId,
|
|
Culture = this.Culture,
|
|
TranslateManual = this.TranslateManual,
|
|
TextElementUniqueId = this.TextElement.JsonUniqueId,
|
|
Text = this.Text,
|
|
};
|
|
|
|
internal static Translation FromJsonTranslation(DataContext.JsonTranslation jsonTranslation) => new()
|
|
{
|
|
UniqueId = jsonTranslation.UniqueId.UniqueId,
|
|
Culture = jsonTranslation.Culture,
|
|
TranslateManual = jsonTranslation.TranslateManual,
|
|
Text = jsonTranslation.Text,
|
|
TextElement = new(),
|
|
};
|
|
} |