public static void AddDictionaryFromResx(Stream stream,
                                          string collectionName,
                                          Culture culture,
                                          MessageType msgmode = MessageType.General)
 {
     LocalizerCore.AddDictionaryFromResX(stream, collectionName, culture, msgmode);
 }
 public static string GetBodyByKey(string key,
                                   string collectionName = "",
                                   Culture culture       = null,
                                   MessageType msgmode   = MessageType.General)
 {
     return(LocalizerCore.GetByKey(key, collectionName, culture, msgmode).Body);
 }
 public static void AddDictionary(Dictionary <string, string> dic,
                                  string collectionName,
                                  Culture culture,
                                  MessageType msgmode = MessageType.General)
 {
     LocalizerCore.AddDictionary(true, dic, collectionName, culture, msgmode);
 }
Exemplo n.º 4
0
 public static void Init(string cachefolder,
                         Guid guid,
                         GetCultureMode mode     = GetCultureMode.Web,
                         Culture preferedculture = null)
 {
     LocalizerCore.Init(cachefolder, guid, mode, preferedculture);
 }
        public static void AddDictionaryFromResx(string filePath, Culture culture, string collectionName = "", MessageType msgmode = MessageType.General)
        {
            FileStream stream = null;

            try
            {
                stream = LocalizerCore.SafeOpenAndLockForRead(IO.PathHelper.Helper.MapPath(filePath));
                AddDictionaryFromResx(stream, collectionName, culture, msgmode);
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
            }
        }
        public static void AddMessages(bool cacheit, IEnumerable <Message> msgs, string collectionname, Culture culture)
        {
            SortedList <MessageType, SortedList <string, string> > lst =
                new SortedList <MessageType, SortedList <string, string> >();

            foreach (var message in msgs)
            {
                if (!lst.ContainsKey(message.MessageType))
                {
                    lst.Add(message.MessageType, new SortedList <string, string>());
                }
                lst[message.MessageType].Add(message.Key, message.Title + ";" + message.Body);
            }
            foreach (var kp in lst)
            {
                LocalizerCore.AddDictionary(cacheit, kp.Value, collectionname, culture, kp.Key);
            }
        }
 public static bool HasKey(this string key, string collectionname = "",
                           Culture culture     = null,
                           MessageType msgmode = MessageType.General)
 {
     return(LocalizerCore.HasKey(key, collectionname, culture, msgmode));
 }
 public static ConcurrentDictionary <string, Message> GetDictionary(Culture culture,
                                                                    MessageType msgmode = MessageType.General)
 {
     return(LocalizerCore.GetDictionary("", culture, msgmode));
 }
Exemplo n.º 9
0
 public static bool SetCurrentCulture(Guid guid, Culture culture)
 {
     return(LocalizerCore.SetCurrentCulture(guid, culture));
 }