feat(i18n): translate import and player messages to German
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
44d07a10df
commit
b8f5a3e469
4 files changed
+10
-10
No files matched your search
@@ -8,7 +8,7 @@ public record UploadResult(bool Success, string Message, Song? Song = null);
|
|||||||
|
|
||||||
public class UploadController(SongImportService importService)
|
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";
|
||||||
|
|
||||||
/// <summary>Imports one file; failures come back as a result, so a batch can go on with the next file.</summary>
|
/// <summary>Imports one file; failures come back as a result, so a batch can go on with the next file.</summary>
|
||||||
public UploadResult Upload(string filePath)
|
public UploadResult Upload(string filePath)
|
||||||
@@ -16,7 +16,7 @@ public class UploadController(SongImportService importService)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var song = importService.Import(filePath);
|
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)
|
catch (SongImportException e)
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ public class UploadController(SongImportService importService)
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
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}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ public sealed class MusicPlayer : IAudioPlayer
|
|||||||
Release();
|
Release();
|
||||||
|
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
throw new FileNotFoundException($"Audio file not found: {filePath}", filePath);
|
throw new FileNotFoundException($"Audiodatei nicht gefunden: {filePath}", filePath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ public sealed class MusicPlayer : IAudioPlayer
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
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
|
try
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class SongImportService(SongRepository songs, string musicDirectory)
|
|||||||
public Song Import(string sourcePath)
|
public Song Import(string sourcePath)
|
||||||
{
|
{
|
||||||
if (!SupportedExtensions.Contains(Path.GetExtension(sourcePath).ToLowerInvariant()))
|
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);
|
Directory.CreateDirectory(musicDirectory);
|
||||||
var targetPath = GetUniqueTargetPath(Path.GetFileName(sourcePath));
|
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)
|
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
|
try
|
||||||
@@ -75,11 +75,11 @@ public class SongImportService(SongRepository songs, string musicDirectory)
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// NAudio and Media Foundation throw many unrelated exception types for corrupt files.
|
// 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)
|
if (duration <= TimeSpan.Zero)
|
||||||
throw new SongImportException("The file contains no audio.");
|
throw new SongImportException("Die Datei enthält kein Audio.");
|
||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,6 @@ public sealed class SongImportServiceTests : IDisposable
|
|||||||
Assert.Equal([true, false, true], results.Select(r => r.Success));
|
Assert.Equal([true, false, true], results.Select(r => r.Success));
|
||||||
Assert.Equal("first", results[0].Song!.Title);
|
Assert.Equal("first", results[0].Song!.Title);
|
||||||
Assert.Null(results[1].Song);
|
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);
|
Assert.Equal(2, _repository.GetAll().Count);
|
||||||
}}
|
}}
|
||||||
Reference in new issue
Block a user