27 lines
445 B
C#
27 lines
445 B
C#
using UnityEngine;
|
|
|
|
namespace OHM.UnityToolkit.Localization
|
|
{
|
|
public static class LocalizationUtils
|
|
{
|
|
public static string Localize(LocaleDef locale, string key)
|
|
{
|
|
if (string.IsNullOrEmpty(key))
|
|
{
|
|
return string.Empty;
|
|
}
|
|
if (locale == null)
|
|
{
|
|
return "#####";
|
|
}
|
|
string value;
|
|
if (locale.keys != null && locale.keys.TryGetValue(key, out value))
|
|
{
|
|
return value;
|
|
}
|
|
return "#" + key + "#";
|
|
}
|
|
|
|
}
|
|
}
|