15 lines
718 B
C#
15 lines
718 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using JD.Oasis.Service.API;
|
|
|
|
namespace JD.Guinness.WPF.Module.Extension
|
|
{
|
|
public static class LocalizedLineExtension
|
|
{
|
|
public static LocalizedLine GetLineFrom(this LocalizedLine line, IReadOnlyDictionary<int, LocalizedLine> lines) => line != null && lines.TryGetValue(line.Id, out LocalizedLine newLine) ? newLine : line;
|
|
|
|
public static string GetMasterText(this LocalizedLine line) => line?.Translations.FirstOrDefault(t => t.Key.IsMaster).Value;
|
|
|
|
public static string GetTranslation(this LocalizedLine line, Language language) => line != null && line.Translations.TryGetValue(language, out string value) ? value : null;
|
|
}
|
|
}
|