small bug fixes
This commit is contained in:
@@ -65,6 +65,7 @@ public class AppearanceService
|
||||
public async Task ResetAsync()
|
||||
{
|
||||
await _appearanceRepository.ResetAsync();
|
||||
await SyncLocalizedStatusTextsAsync();
|
||||
await _appearanceRepository.EnsureDefaultsAsync();
|
||||
await ApplyAsync();
|
||||
}
|
||||
@@ -96,6 +97,26 @@ public class AppearanceService
|
||||
return fallback;
|
||||
}
|
||||
|
||||
public async Task SyncLocalizedStatusTextsAsync()
|
||||
{
|
||||
var map = await _appearanceRepository.GetMapAsync();
|
||||
|
||||
foreach (var key in GetStatusTextKeys())
|
||||
{
|
||||
var currentValue = map.TryGetValue(key, out var storedValue)
|
||||
? storedValue
|
||||
: string.Empty;
|
||||
|
||||
var normalized = LocalizationService.NormalizeStatusTextForCulture(
|
||||
key,
|
||||
currentValue,
|
||||
LocalizationService.GetCurrentCulture());
|
||||
|
||||
if (!string.Equals((currentValue ?? string.Empty).Trim(), normalized, StringComparison.Ordinal))
|
||||
await _appearanceRepository.SaveAsync(key, normalized);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyValue(ResourceDictionary resources, string key, string value, string fallback)
|
||||
{
|
||||
if (IsColorKey(key))
|
||||
@@ -138,4 +159,12 @@ public class AppearanceService
|
||||
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetStatusTextKeys()
|
||||
{
|
||||
yield return AppearanceKeys.StatusGreenText;
|
||||
yield return AppearanceKeys.StatusYellowText;
|
||||
yield return AppearanceKeys.StatusRedText;
|
||||
yield return AppearanceKeys.StatusGrayText;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user