Commit 3cff491d LN

1

1 个父辈 ef8df7fc
...@@ -223,6 +223,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -223,6 +223,7 @@ namespace OnlineStore.AutoInOutStore
ResourceCulture.SetCurrentCulture(ResourceCulture.China); ResourceCulture.SetCurrentCulture(ResourceCulture.China);
ConfigAppSettings.SaveValue(Setting_Init.Default_Language, ResourceCulture.China); ConfigAppSettings.SaveValue(Setting_Init.Default_Language, ResourceCulture.China);
} }
// ResourceCulture.LoaAllRes();
GetVersion(); GetVersion();
LogUtil.logBox = this.richTextBox1; LogUtil.logBox = this.richTextBox1;
this.ShowInTaskbar = true; this.ShowInTaskbar = true;
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Resources; using System.Resources;
...@@ -44,7 +46,53 @@ namespace OnlineStore.AutoInOutStore ...@@ -44,7 +46,53 @@ namespace OnlineStore.AutoInOutStore
CurrLanguage = name; CurrLanguage = name;
Thread.CurrentThread.CurrentCulture = new CultureInfo(name); Thread.CurrentThread.CurrentCulture = new CultureInfo(name);
} }
public static void LoaAllRes()
{
if (rm == null)
{
rm = new ResourceManager("OnlineStore.AutoInOutStore.Properties.Resource", assembly);
}
//CultureInfo ci = Thread.CurrentThread.CurrentCulture;
Dictionary<string, string> chinaMap = GetRMap(China);
Dictionary<string, string> englishMap = GetRMap(English);
List<string> resulList = new List<string>();
foreach(string key in chinaMap.Keys)
{
string china = chinaMap[key];
string english = "";
englishMap.TryGetValue(key, out english);
if (String.IsNullOrEmpty(english))
{
english = "";
}
resulList.Add(key + "," + china.Replace(',', '&') + "," + english.Replace(',', '&'));
}
File.WriteAllLines("D:\\storeResource.csv", resulList.ToArray());
}
private static Dictionary<string ,string > GetRMap(string lan)
{
Dictionary<string, string> chinaMap = new Dictionary<string, string>();
CultureInfo ci = new CultureInfo(lan);
ResourceSet resourceSet = rm.GetResourceSet(ci, true, true);
IDictionaryEnumerator dictNumerator = resourceSet.GetEnumerator();
// Get all string resources
while (dictNumerator.MoveNext())
{
// Only string resources
if (dictNumerator.Value is string)
{
var key = (string)dictNumerator.Key;
var value = (string)dictNumerator.Value;
// yield return new KeyValuePair<string, string>(key, value);
if (!chinaMap.ContainsKey(key))
{
chinaMap.Add(key, value);
}
}
}
return chinaMap;
}
private static string CodeResourceControl_GetLanguageEvent() private static string CodeResourceControl_GetLanguageEvent()
{ {
return CurrLanguage; return CurrLanguage;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!