Ejemplo n.º 1
0
        public Task WriteAsync(string culture, string key, string value)
        {
            LocaleDictionary dict = InMemoryLocalizationStore
                                    .GetCultureDictionary(culture);

            dict.TryAdd(key, value);

            return(Task.CompletedTask);
        }
Ejemplo n.º 2
0
        public Task DeleteAsync(string culture, string key)
        {
            LocaleDictionary dict = InMemoryLocalizationStore
                                    .GetCultureDictionary(culture);

            string value = string.Empty;

            dict.TryRemove(key, out value);

            return(Task.CompletedTask);
        }
Ejemplo n.º 3
0
        public Task <string> GetAsync(string culture, string name)
        {
            LocaleDictionary dict = InMemoryLocalizationStore
                                    .GetCultureDictionary(culture);

            if (dict.ContainsKey(name))
            {
                return(Task.FromResult(dict[name]));
            }

            return(Task.FromResult <string>(null));
        }
Ejemplo n.º 4
0
        public Task WriteAsync(string culture,
                               IDictionary <string, string> dictionary)
        {
            LocaleDictionary dict = InMemoryLocalizationStore
                                    .GetCultureDictionary(culture);

            foreach (KeyValuePair <string, string> pair in dictionary)
            {
                dict.TryAdd(pair.Key, pair.Value);
            }

            return(Task.CompletedTask);
        }
Ejemplo n.º 5
0
        public Task DeleteAsync(string culture, IEnumerable <string> keys)
        {
            LocaleDictionary dict = InMemoryLocalizationStore
                                    .GetCultureDictionary(culture);

            string value = string.Empty;

            foreach (string key in keys)
            {
                dict.TryRemove(key, out value);
            }

            return(Task.CompletedTask);
        }