feat(i18n): translate the library page and song editor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d1790d164
commit
8f483640cd
3 files changed
+42
-29
No files matched your search
@@ -2,10 +2,12 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="Bibliothek"
|
||||
xmlns:l="clr-namespace:Radiosender.Views"
|
||||
Title="{l:Tr Library_Title}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
Loaded="OnLoaded">
|
||||
Loaded="OnLoaded"
|
||||
Unloaded="OnUnloaded">
|
||||
<Grid Margin="24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -17,20 +19,20 @@
|
||||
<ui:Button x:Name="DeleteButton"
|
||||
DockPanel.Dock="Right"
|
||||
Margin="8,0,0,0"
|
||||
Content="Löschen"
|
||||
Content="{l:Tr Library_Delete}"
|
||||
Icon="{ui:SymbolIcon Delete24}"
|
||||
IsEnabled="False"
|
||||
Click="OnDelete" />
|
||||
<ui:Button x:Name="EditButton"
|
||||
DockPanel.Dock="Right"
|
||||
Margin="8,0,0,0"
|
||||
Content="Bearbeiten"
|
||||
Content="{l:Tr Library_Edit}"
|
||||
Icon="{ui:SymbolIcon Edit24}"
|
||||
IsEnabled="False"
|
||||
Click="OnEdit" />
|
||||
<ui:TextBox x:Name="SearchBox"
|
||||
AutomationProperties.Name="Songs suchen"
|
||||
PlaceholderText="Titel oder Interpret suchen"
|
||||
AutomationProperties.Name="{l:Tr Library_SearchName}"
|
||||
PlaceholderText="{l:Tr Library_SearchPlaceholder}"
|
||||
Icon="{ui:SymbolIcon Search24}"
|
||||
TextChanged="OnSearchChanged" />
|
||||
</DockPanel>
|
||||
@@ -38,15 +40,15 @@
|
||||
<ui:ListView x:Name="SongList"
|
||||
Grid.Row="2"
|
||||
SelectionMode="Single"
|
||||
AutomationProperties.Name="Songs"
|
||||
AutomationProperties.Name="{l:Tr Library_ListName}"
|
||||
SelectionChanged="OnSelectionChanged"
|
||||
MouseDoubleClick="OnEdit"
|
||||
KeyDown="OnListKeyDown">
|
||||
<ui:ListView.View>
|
||||
<ui:GridView>
|
||||
<ui:GridViewColumn Width="220" Header="Titel" DisplayMemberBinding="{Binding Title}" />
|
||||
<ui:GridViewColumn Width="160" Header="Interpret" DisplayMemberBinding="{Binding Artist}" />
|
||||
<ui:GridViewColumn Width="80" Header="Dauer">
|
||||
<ui:GridViewColumn Width="220" Header="{l:Tr Song_Title}" DisplayMemberBinding="{Binding Title}" />
|
||||
<ui:GridViewColumn Width="160" Header="{l:Tr Song_Artist}" DisplayMemberBinding="{Binding Artist}" />
|
||||
<ui:GridViewColumn Width="80" Header="{l:Tr Song_Duration}">
|
||||
<ui:GridViewColumn.DisplayMemberBinding>
|
||||
<Binding Path="Duration" StringFormat="m\:ss" />
|
||||
</ui:GridViewColumn.DisplayMemberBinding>
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Radiosender.Controllers;
|
||||
using Radiosender.Models;
|
||||
using Radiosender.Services.Localization;
|
||||
using Wpf.Ui.Controls;
|
||||
using MessageBox = Wpf.Ui.Controls.MessageBox;
|
||||
|
||||
@@ -19,7 +20,15 @@ public partial class LibraryPage : Page
|
||||
|
||||
private Song? Selected => SongList.SelectedItem as Song;
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs e) => Refresh();
|
||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Loc.Changed += OnLanguageChanged;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void OnUnloaded(object sender, RoutedEventArgs e) => Loc.Changed -= OnLanguageChanged;
|
||||
|
||||
private void OnLanguageChanged(object? sender, EventArgs e) => ShowEmptyText();
|
||||
|
||||
private void OnSearchChanged(object sender, TextChangedEventArgs e) => Refresh();
|
||||
|
||||
@@ -31,12 +40,13 @@ public partial class LibraryPage : Page
|
||||
var songs = _controller.Search(SearchBox.Text);
|
||||
SongList.ItemsSource = songs;
|
||||
GridColumns.Fit(SongList);
|
||||
EmptyText.Text = string.IsNullOrWhiteSpace(SearchBox.Text)
|
||||
? "Noch keine Songs. Musik auf der Seite Import hinzufĂĽgen."
|
||||
: "Kein Song passt zur Suche.";
|
||||
EmptyText.Visibility = songs.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
|
||||
ShowEmptyText();
|
||||
}
|
||||
|
||||
private void ShowEmptyText() =>
|
||||
EmptyText.Text = Loc.T(string.IsNullOrWhiteSpace(SearchBox.Text) ? "Library_Empty" : "Library_NoMatch");
|
||||
|
||||
private void OnListKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == System.Windows.Input.Key.Enter) OnEdit(sender, e);
|
||||
@@ -61,10 +71,10 @@ public partial class LibraryPage : Page
|
||||
|
||||
var result = await new MessageBox
|
||||
{
|
||||
Title = "Song löschen",
|
||||
Content = $"\"{song.Title}\" von {song.Artist} aus der Bibliothek löschen?",
|
||||
PrimaryButtonText = "Löschen",
|
||||
CloseButtonText = "Abbrechen",
|
||||
Title = Loc.T("Library_DeleteTitle"),
|
||||
Content = Loc.F("Library_DeleteConfirm", song.Title, song.Artist),
|
||||
PrimaryButtonText = Loc.T("Library_Delete"),
|
||||
CloseButtonText = Loc.T("Library_Cancel"),
|
||||
}.ShowDialogAsync();
|
||||
|
||||
if (result != Wpf.Ui.Controls.MessageBoxResult.Primary)
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="Song bearbeiten"
|
||||
xmlns:l="clr-namespace:Radiosender.Views"
|
||||
Title="{l:Tr SongEdit_Title}"
|
||||
Width="460" SizeToContent="Height"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
@@ -11,30 +12,30 @@
|
||||
WindowStartupLocation="CenterOwner"
|
||||
FocusManager.FocusedElement="{Binding ElementName=TitleBox}">
|
||||
<StackPanel>
|
||||
<ui:TitleBar Title="Song bearbeiten" ShowMinimize="False" ShowMaximize="False" />
|
||||
<ui:TitleBar Title="{l:Tr SongEdit_Title}" ShowMinimize="False" ShowMaximize="False" />
|
||||
|
||||
<StackPanel Margin="24,8,24,24">
|
||||
<Label Content="_Titel" Target="{Binding ElementName=TitleBox}" />
|
||||
<Label Content="{l:Tr SongEdit_LabelTitle}" Target="{Binding ElementName=TitleBox}" />
|
||||
<ui:TextBox x:Name="TitleBox" Margin="0,0,0,12" />
|
||||
|
||||
<Label Content="_Interpret" Target="{Binding ElementName=ArtistBox}" />
|
||||
<Label Content="{l:Tr SongEdit_LabelArtist}" Target="{Binding ElementName=ArtistBox}" />
|
||||
<ui:TextBox x:Name="ArtistBox" Margin="0,0,0,12" />
|
||||
|
||||
<Label Content="_Lizenz" Target="{Binding ElementName=LicenseBox}" />
|
||||
<ui:TextBox x:Name="LicenseBox" Margin="0,0,0,12" PlaceholderText="Optional, z. B. CC BY 4.0" />
|
||||
<Label Content="{l:Tr SongEdit_LabelLicense}" Target="{Binding ElementName=LicenseBox}" />
|
||||
<ui:TextBox x:Name="LicenseBox" Margin="0,0,0,12" PlaceholderText="{l:Tr SongEdit_LicensePlaceholder}" />
|
||||
|
||||
<Label Content="_Namensnennung" Target="{Binding ElementName=AttributionBox}" />
|
||||
<ui:TextBox x:Name="AttributionBox" PlaceholderText="Optional" />
|
||||
<Label Content="{l:Tr SongEdit_LabelAttribution}" Target="{Binding ElementName=AttributionBox}" />
|
||||
<ui:TextBox x:Name="AttributionBox" PlaceholderText="{l:Tr SongEdit_Optional}" />
|
||||
|
||||
<TextBlock x:Name="ErrorText"
|
||||
Margin="0,12,0,0"
|
||||
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
|
||||
Text="Titel und Interpret sind erforderlich."
|
||||
Text="{l:Tr SongEdit_Required}"
|
||||
Visibility="Collapsed" />
|
||||
|
||||
<StackPanel Margin="0,24,0,0" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<ui:Button Content="Speichern" Appearance="Primary" IsDefault="True" MinWidth="90" Click="OnSave" />
|
||||
<ui:Button Margin="8,0,0,0" Content="Abbrechen" IsCancel="True" MinWidth="90" />
|
||||
<ui:Button Content="{l:Tr SongEdit_Save}" Appearance="Primary" IsDefault="True" MinWidth="90" Click="OnSave" />
|
||||
<ui:Button Margin="8,0,0,0" Content="{l:Tr Library_Cancel}" IsCancel="True" MinWidth="90" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
Reference in new issue
Block a user