2017-06-22 06:12:06 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2018-07-21 03:22:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// String Translation Utility
|
|
|
|
|
/// </summary>
|
2017-06-22 06:12:06 +00:00
|
|
|
|
public static class RibbonStrings
|
|
|
|
|
{
|
|
|
|
|
private static readonly Dictionary<string, string> RibbonNames = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resets the Ribbon Dictionary to use the supplied set of Ribbon (Property) Names.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="lines">Array of strings that are tab separated with Property Name, \t, and Display Name.</param>
|
|
|
|
|
public static void ResetDictionary(IEnumerable<string> lines)
|
|
|
|
|
{
|
|
|
|
|
foreach (var line in lines)
|
|
|
|
|
{
|
|
|
|
|
string[] split = line.Split('\t');
|
|
|
|
|
if (split.Length != 2)
|
|
|
|
|
continue;
|
2017-08-20 01:43:36 +00:00
|
|
|
|
if (RibbonNames.ContainsKey(split[0]))
|
|
|
|
|
RibbonNames[split[0]] = split[1];
|
|
|
|
|
else
|
|
|
|
|
RibbonNames.Add(split[0], split[1]);
|
2017-06-22 06:12:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the Ribbon Display Name for the corresponding <see cref="PKM"/> ribbon property name.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="propertyName">Ribbon property name</param>
|
|
|
|
|
/// <returns>Ribbon display name</returns>
|
|
|
|
|
public static string GetName(string propertyName)
|
|
|
|
|
{
|
|
|
|
|
if (RibbonNames.TryGetValue(propertyName, out string value))
|
|
|
|
|
return value;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|