@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
@@ -12,7 +13,7 @@ public static class StaticData
|
||||
|
||||
public static Dictionary<string, string> Zh_CN_Dic = new Dictionary<string, string>();
|
||||
|
||||
public static Dictionary<string, string> Log_Locoalize_Dic = new Dictionary<string, string>();
|
||||
public static Dictionary<string, string> Localizer_Dev_Dic = new Dictionary<string, string>();
|
||||
|
||||
|
||||
#region 国际化
|
||||
@@ -33,44 +34,21 @@ public static class StaticData
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static string International(string key, params object?[] args)
|
||||
public static string I18n(string key, params object?[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
return string.Format(GetLanguageDictionary(key), args);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
var isEn_US = System.Globalization.CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||
|
||||
return string.Empty;
|
||||
if (isEn_US)
|
||||
{
|
||||
return En_US_Dic[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return Zh_CN_Dic[key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static string GetLanguageDictionary(string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
var type = Thread.CurrentThread.CurrentUICulture.Name;
|
||||
if (type == "zh-CN")
|
||||
{
|
||||
return Zh_CN_Dic[key];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return En_US_Dic[key];
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 字典表项固定值
|
||||
|
||||
Reference in New Issue
Block a user