private void DeprecateUnusedTranslations(CancellationToken cancellationToken) { _semaphore.Wait(cancellationToken); _logger.LogDebug(_localizer.GetString("Deprecating unused translations")); var sw = Stopwatch.StartNew(); var count = 0; try { var names = _translations.SelectMany(x => x.Value).ToHashSet(); foreach (var entry in _store.GetAllTranslations(cancellationToken)) { if (!names.Contains(entry.Key)) { _store.MarkAsUnused(entry.Key, cancellationToken); count++; } } } finally { _semaphore.Release(); _logger.LogDebug(_localizer.GetString("Finished deprecating {Count} unused translation(s), took {Elapsed}"), count, sw.Elapsed); } }
public IActionResult GetAll(CancellationToken cancellationToken) { var all = _store.GetAllTranslations(cancellationToken); var models = all.Select(x => new LocalizationViewModel(x.Culture, x.Scope, x.Key, x.Value)); return(Ok(models)); }