public SaveResponse Update(TranslationUpdateRequest request) { if (request.Translations == null) { throw new ArgumentNullException("translations"); } var translations = List(new TranslationListRequest { SourceLanguageID = request.TargetLanguageID, }).Entities.ToDictionary(x => x.Key, x => x.CustomText); foreach (var item in request.Translations) { translations[item.Key] = item.Value; } var result = new SortedDictionary <string, string>(StringComparer.OrdinalIgnoreCase); foreach (var pair in translations) { if (!pair.Value.IsEmptyOrNull()) { result.Add(pair.Key, pair.Value); } } string json = JSON.StringifyIndented(result); var textsFilePath = GetUserTextsFilePath(request.TargetLanguageID); Directory.CreateDirectory(Path.GetDirectoryName(textsFilePath)); File.WriteAllText(textsFilePath, json); Dependency.Resolve <IDependencyRegistrar>().RegisterInstance <ILocalTextRegistry>(new LocalTextRegistry()); CommonInitialization.InitializeLocalTexts(); TwoLevelCache.ExpireGroupItems(UserRow.Fields.GenerationKey); DynamicScriptManager.Reset(); return(new SaveResponse()); }
public void Update() { TwoLevelCache.ExpireGroupItems(this.groupKey); }