public static string GetResourceFromFile(string filePath, MutiLanguage.Languages language)
 {
     string lang = MutiLanguage.EnumToString(language);
     string text = "";
     FileInfo fi = new FileInfo(filePath);
     string postfix;
     if (lang == MutiLanguage.EnumToString(MutiLanguage.Languages.en_us)) postfix = fi.Extension;
     else postfix = string.Concat(".", lang, fi.Extension);
     filePath = fi.FullName.Replace(fi.Extension, postfix);
     if (File.Exists(filePath))
     {
         text = File.ReadAllText(filePath, Encoding.UTF8);
     }
     return text;
 }
Exemple #2
0
 public static string FormatDateToString(object xDateTime, DateFormat xDateFormat, MutiLanguage.Languages lang)
 {
     return FormatDateTimeToString(Convert.ToDateTime(xDateTime), xDateFormat, lang);
 }
Exemple #3
0
 public static string FormatDateTimeToString(DateTime xDateTime, DateFormat xDateFormat, MutiLanguage.Languages lang)
 {
     if (xDateTime == null || Convert.ToDateTime(xDateTime) == DateTime.MinValue) return "";
     string langstr = MutiLanguage.EnumToString(lang);
     //System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(Date));
     //System.Resources.ResourceSet rs = rm.GetResourceSet(new System.Globalization.CultureInfo(langstr), false, false);
     //return xDateTime.ToString(rs.GetString(xDateFormat.ToString()), System.Globalization.DateTimeFormatInfo.InvariantInfo);
     return xDateTime.ToString(Date.ResourceManager.GetString(xDateFormat.ToString(), new System.Globalization.CultureInfo(langstr)), System.Globalization.DateTimeFormatInfo.InvariantInfo);
 }