protected async Task LoadLocalizationRecords(LocalizationRecordKey key) { if (key != null) { try { if (currentKey != null) { currentKey.LocalizationRecords = null; } currentKey = key; localizationApiClient.ClearEntitiesCache(); var result = await localizationApiClient.GetLocalizationRecords(key); currentKey.LocalizationRecords = new List <LocalizationRecord>(result); LocalizationCultures.Clear(); LocalizationCultures.AddRange(SupportedCultures .Where(i => !currentKey.LocalizationRecords.Any(l => l.Culture == i))); if (LocalizationCultures.Count > 0) { newLocalizationRecord = new LocalizationRecord() { ContextId = currentKey.ContextId, MsgId = currentKey.MsgId, Culture = LocalizationCultures[0] } } ; viewNotifier.Show(L["One item found", Plural.From("{0} items found", result.Count())], ViewNotifierType.Success, L["Operation Successful"]); } catch (Exception ex) { viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]); } } StateHasChanged(); }
protected async Task LoadLocalizationRecords(LocalizationRecordKey key) { if (key != null) { try { currentKey = key; localizationApiClient.ClearEntitiesCache(); var result = await localizationApiClient.GetLocalizationRecords(key); localizationRecords = new List <LocalizationRecord>(result); LocalizationCultures.Clear(); LocalizationCultures.AddRange(BlazorBoilerplate.Shared.Localizer.Settings.SupportedCultures .Where(i => !localizationRecords.Any(l => l.Culture == i))); if (LocalizationCultures.Count > 0) { newLocalizationRecord = new LocalizationRecord() { ContextId = currentKey.ContextId, MsgId = currentKey.MsgId, Culture = LocalizationCultures[0] } } ; matToaster.Add(L["One item found", Plural.From("{0} items found", result.Count())], MatToastType.Success, L["Operation Successful"]); } catch (Exception ex) { matToaster.Add(ex.GetBaseException().Message, MatToastType.Danger, L["Operation Failed"]); } } else { localizationRecords = new List <LocalizationRecord>(); } StateHasChanged(); }
protected async Task LoadLocalizationRecords(string key) { if (key != null) { try { currentKey = key; localizationApiClient.ClearEntitiesCache(); var result = await localizationApiClient.GetLocalizationRecords(key); localizationRecords = new List <ILocalizationRecord>(result); LocalizationCultures.Clear(); LocalizationCultures.AddRange(BlazorBoilerplate.Shared.SqlLocalizer.Settings.SupportedCultures .Where(i => !localizationRecords.Any(l => l.LocalizationCulture == i))); if (LocalizationCultures.Count > 0) { newLocalizationRecord = new LocalizationRecord() { Key = currentKey, LocalizationCulture = LocalizationCultures[0] } } ; matToaster.Add($"Total Items: {localizationRecords.Count}", MatToastType.Success, L["Operation Successful"]); } catch (Exception ex) { matToaster.Add(ex.GetBaseException().Message, MatToastType.Danger, L["Operation Failed"]); } } else { localizationRecords = new List <ILocalizationRecord>(); } StateHasChanged(); }
protected async Task LoadPluralFormRules() { PluralFormRules = new List <PluralFormRule>(); try { localizationApiClient.ClearEntitiesCache(); var result = await localizationApiClient.GetPluralFormRules(); PluralFormRules = new List <PluralFormRule>(result); LocalizationCultures.Clear(); LocalizationCultures.AddRange(BlazorBoilerplate.Shared.Localizer.Settings.SupportedCultures .Where(i => !PluralFormRules.Any(l => l.Language == i))); matToaster.Add(L["One item found", Plural.From("{0} items found", PluralFormRules.Count)], MatToastType.Success, L["Operation Successful"]); } catch (Exception ex) { matToaster.Add(ex.GetBaseException().Message, MatToastType.Danger, L["Operation Failed"]); } }
protected async Task LoadPluralFormRules() { PluralFormRules = new List <PluralFormRule>(); try { localizationApiClient.ClearEntitiesCache(); var result = await localizationApiClient.GetPluralFormRules(); PluralFormRules = new List <PluralFormRule>(result); LocalizationCultures.Clear(); LocalizationCultures.AddRange(SupportedCultures .Where(i => !PluralFormRules.Any(l => l.Language == i))); viewNotifier.Show(L["One item found", Plural.From("{0} items found", PluralFormRules.Count)], ViewNotifierType.Success, L["Operation Successful"]); } catch (Exception ex) { viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]); } }