2018-05-05 16:36:26 -04:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
2018-04-22 16:04:18 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace SharedLibraryCore.Localization
|
|
|
|
|
{
|
|
|
|
|
public class Layout
|
|
|
|
|
{
|
|
|
|
|
public string LocalizationName { get; set; }
|
2018-05-05 16:36:26 -04:00
|
|
|
|
public Index LocalizationIndex { get; set; }
|
|
|
|
|
|
|
|
|
|
public Layout(Dictionary<string, string> set)
|
|
|
|
|
{
|
|
|
|
|
LocalizationIndex = new Index()
|
|
|
|
|
{
|
|
|
|
|
Set = set
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Index
|
|
|
|
|
{
|
|
|
|
|
public Dictionary<string, string> Set { get; set; }
|
|
|
|
|
|
|
|
|
|
public string this[string key]
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (!Set.TryGetValue(key, out string value))
|
2018-08-28 17:32:59 -04:00
|
|
|
|
{
|
|
|
|
|
// throw new Exception($"Invalid locale key {key}");
|
|
|
|
|
return $"unknown locale key {key}";
|
|
|
|
|
}
|
2018-05-05 16:36:26 -04:00
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-22 16:04:18 -04:00
|
|
|
|
}
|
2018-05-05 16:36:26 -04:00
|
|
|
|
|
2018-04-22 16:04:18 -04:00
|
|
|
|
}
|