diff --git a/src/Radiosender/Controllers/UploadController.cs b/src/Radiosender/Controllers/UploadController.cs index 0b3cc66..15c71ca 100644 --- a/src/Radiosender/Controllers/UploadController.cs +++ b/src/Radiosender/Controllers/UploadController.cs @@ -8,7 +8,7 @@ public record UploadResult(bool Success, string Message, Song? Song = null); public class UploadController(SongImportService importService) { - public static string FileDialogFilter { get; } = "Audio files (*.mp3;*.wav)|*.mp3;*.wav"; + public static string FileDialogFilter { get; } = "Audiodateien (*.mp3;*.wav)|*.mp3;*.wav"; /// Imports one file; failures come back as a result, so a batch can go on with the next file. public UploadResult Upload(string filePath) @@ -16,7 +16,7 @@ public class UploadController(SongImportService importService) try { var song = importService.Import(filePath); - return new UploadResult(true, $"\"{song.Title}\" ({(int)song.Duration.TotalMinutes}:{song.Duration.Seconds:00}) was added to the library.", song); + return new UploadResult(true, $"\"{song.Title}\" ({(int)song.Duration.TotalMinutes}:{song.Duration.Seconds:00}) wurde zur Bibliothek hinzugefügt.", song); } catch (SongImportException e) { @@ -24,7 +24,7 @@ public class UploadController(SongImportService importService) } catch (Exception e) { - return new UploadResult(false, $"The song could not be saved: {e.Message}"); + return new UploadResult(false, $"Der Song konnte nicht gespeichert werden: {e.Message}"); } } } diff --git a/src/Radiosender/Services/MusicPlayer.cs b/src/Radiosender/Services/MusicPlayer.cs index eb51a31..f4d5b09 100644 --- a/src/Radiosender/Services/MusicPlayer.cs +++ b/src/Radiosender/Services/MusicPlayer.cs @@ -80,7 +80,7 @@ public sealed class MusicPlayer : IAudioPlayer Release(); if (!File.Exists(filePath)) - throw new FileNotFoundException($"Audio file not found: {filePath}", filePath); + throw new FileNotFoundException($"Audiodatei nicht gefunden: {filePath}", filePath); try { @@ -88,7 +88,7 @@ public sealed class MusicPlayer : IAudioPlayer } catch (Exception ex) when (ex is not OutOfMemoryException) { - throw new InvalidDataException($"Cannot read audio file: {filePath}", ex); + throw new InvalidDataException($"Audiodatei kann nicht gelesen werden: {filePath}", ex); } try diff --git a/src/Radiosender/Services/SongImportService.cs b/src/Radiosender/Services/SongImportService.cs index 00caad6..4787c32 100644 --- a/src/Radiosender/Services/SongImportService.cs +++ b/src/Radiosender/Services/SongImportService.cs @@ -19,7 +19,7 @@ public class SongImportService(SongRepository songs, string musicDirectory) public Song Import(string sourcePath) { if (!SupportedExtensions.Contains(Path.GetExtension(sourcePath).ToLowerInvariant())) - throw new SongImportException("Only MP3 and WAV files are supported."); + throw new SongImportException("Nur MP3- und WAV-Dateien werden unterstützt."); Directory.CreateDirectory(musicDirectory); var targetPath = GetUniqueTargetPath(Path.GetFileName(sourcePath)); @@ -29,7 +29,7 @@ public class SongImportService(SongRepository songs, string musicDirectory) } catch (Exception e) when (e is IOException or UnauthorizedAccessException) { - throw new SongImportException($"The file could not be read: {e.Message}", e); + throw new SongImportException($"Die Datei konnte nicht gelesen werden: {e.Message}", e); } try @@ -75,11 +75,11 @@ public class SongImportService(SongRepository songs, string musicDirectory) catch (Exception e) { // NAudio and Media Foundation throw many unrelated exception types for corrupt files. - throw new SongImportException("The file is not a readable MP3 or WAV file.", e); + throw new SongImportException("Die Datei ist keine lesbare MP3- oder WAV-Datei.", e); } if (duration <= TimeSpan.Zero) - throw new SongImportException("The file contains no audio."); + throw new SongImportException("Die Datei enthält kein Audio."); return duration; } diff --git a/tests/Radiosender.Tests/SongImportServiceTests.cs b/tests/Radiosender.Tests/SongImportServiceTests.cs index 5628463..2c1c240 100644 --- a/tests/Radiosender.Tests/SongImportServiceTests.cs +++ b/tests/Radiosender.Tests/SongImportServiceTests.cs @@ -126,6 +126,6 @@ public sealed class SongImportServiceTests : IDisposable Assert.Equal([true, false, true], results.Select(r => r.Success)); Assert.Equal("first", results[0].Song!.Title); Assert.Null(results[1].Song); - Assert.Contains("MP3 and WAV", results[1].Message); + Assert.Contains("MP3- und WAV", results[1].Message); Assert.Equal(2, _repository.GetAll().Count); }}