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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/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}"
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
ScrollViewer.CanContentScroll="False"
|
ScrollViewer.CanContentScroll="False"
|
||||||
Loaded="OnLoaded">
|
Loaded="OnLoaded"
|
||||||
|
Unloaded="OnUnloaded">
|
||||||
<Grid Margin="24">
|
<Grid Margin="24">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@@ -17,20 +19,20 @@
|
|||||||
<ui:Button x:Name="DeleteButton"
|
<ui:Button x:Name="DeleteButton"
|
||||||
DockPanel.Dock="Right"
|
DockPanel.Dock="Right"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
Content="Löschen"
|
Content="{l:Tr Library_Delete}"
|
||||||
Icon="{ui:SymbolIcon Delete24}"
|
Icon="{ui:SymbolIcon Delete24}"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Click="OnDelete" />
|
Click="OnDelete" />
|
||||||
<ui:Button x:Name="EditButton"
|
<ui:Button x:Name="EditButton"
|
||||||
DockPanel.Dock="Right"
|
DockPanel.Dock="Right"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
Content="Bearbeiten"
|
Content="{l:Tr Library_Edit}"
|
||||||
Icon="{ui:SymbolIcon Edit24}"
|
Icon="{ui:SymbolIcon Edit24}"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Click="OnEdit" />
|
Click="OnEdit" />
|
||||||
<ui:TextBox x:Name="SearchBox"
|
<ui:TextBox x:Name="SearchBox"
|
||||||
AutomationProperties.Name="Songs suchen"
|
AutomationProperties.Name="{l:Tr Library_SearchName}"
|
||||||
PlaceholderText="Titel oder Interpret suchen"
|
PlaceholderText="{l:Tr Library_SearchPlaceholder}"
|
||||||
Icon="{ui:SymbolIcon Search24}"
|
Icon="{ui:SymbolIcon Search24}"
|
||||||
TextChanged="OnSearchChanged" />
|
TextChanged="OnSearchChanged" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
@@ -38,15 +40,15 @@
|
|||||||
<ui:ListView x:Name="SongList"
|
<ui:ListView x:Name="SongList"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
AutomationProperties.Name="Songs"
|
AutomationProperties.Name="{l:Tr Library_ListName}"
|
||||||
SelectionChanged="OnSelectionChanged"
|
SelectionChanged="OnSelectionChanged"
|
||||||
MouseDoubleClick="OnEdit"
|
MouseDoubleClick="OnEdit"
|
||||||
KeyDown="OnListKeyDown">
|
KeyDown="OnListKeyDown">
|
||||||
<ui:ListView.View>
|
<ui:ListView.View>
|
||||||
<ui:GridView>
|
<ui:GridView>
|
||||||
<ui:GridViewColumn Width="220" Header="Titel" DisplayMemberBinding="{Binding Title}" />
|
<ui:GridViewColumn Width="220" Header="{l:Tr Song_Title}" DisplayMemberBinding="{Binding Title}" />
|
||||||
<ui:GridViewColumn Width="160" Header="Interpret" DisplayMemberBinding="{Binding Artist}" />
|
<ui:GridViewColumn Width="160" Header="{l:Tr Song_Artist}" DisplayMemberBinding="{Binding Artist}" />
|
||||||
<ui:GridViewColumn Width="80" Header="Dauer">
|
<ui:GridViewColumn Width="80" Header="{l:Tr Song_Duration}">
|
||||||
<ui:GridViewColumn.DisplayMemberBinding>
|
<ui:GridViewColumn.DisplayMemberBinding>
|
||||||
<Binding Path="Duration" StringFormat="m\:ss" />
|
<Binding Path="Duration" StringFormat="m\:ss" />
|
||||||
</ui:GridViewColumn.DisplayMemberBinding>
|
</ui:GridViewColumn.DisplayMemberBinding>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Radiosender.Controllers;
|
using Radiosender.Controllers;
|
||||||
using Radiosender.Models;
|
using Radiosender.Models;
|
||||||
|
using Radiosender.Services.Localization;
|
||||||
using Wpf.Ui.Controls;
|
using Wpf.Ui.Controls;
|
||||||
using MessageBox = Wpf.Ui.Controls.MessageBox;
|
using MessageBox = Wpf.Ui.Controls.MessageBox;
|
||||||
|
|
||||||
@@ -19,7 +20,15 @@ public partial class LibraryPage : Page
|
|||||||
|
|
||||||
private Song? Selected => SongList.SelectedItem as Song;
|
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();
|
private void OnSearchChanged(object sender, TextChangedEventArgs e) => Refresh();
|
||||||
|
|
||||||
@@ -31,12 +40,13 @@ public partial class LibraryPage : Page
|
|||||||
var songs = _controller.Search(SearchBox.Text);
|
var songs = _controller.Search(SearchBox.Text);
|
||||||
SongList.ItemsSource = songs;
|
SongList.ItemsSource = songs;
|
||||||
GridColumns.Fit(SongList);
|
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;
|
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)
|
private void OnListKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == System.Windows.Input.Key.Enter) OnEdit(sender, 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
|
var result = await new MessageBox
|
||||||
{
|
{
|
||||||
Title = "Song löschen",
|
Title = Loc.T("Library_DeleteTitle"),
|
||||||
Content = $"\"{song.Title}\" von {song.Artist} aus der Bibliothek löschen?",
|
Content = Loc.F("Library_DeleteConfirm", song.Title, song.Artist),
|
||||||
PrimaryButtonText = "Löschen",
|
PrimaryButtonText = Loc.T("Library_Delete"),
|
||||||
CloseButtonText = "Abbrechen",
|
CloseButtonText = Loc.T("Library_Cancel"),
|
||||||
}.ShowDialogAsync();
|
}.ShowDialogAsync();
|
||||||
|
|
||||||
if (result != Wpf.Ui.Controls.MessageBoxResult.Primary)
|
if (result != Wpf.Ui.Controls.MessageBoxResult.Primary)
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/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"
|
Width="460" SizeToContent="Height"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
@@ -11,30 +12,30 @@
|
|||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
FocusManager.FocusedElement="{Binding ElementName=TitleBox}">
|
FocusManager.FocusedElement="{Binding ElementName=TitleBox}">
|
||||||
<StackPanel>
|
<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">
|
<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" />
|
<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" />
|
<ui:TextBox x:Name="ArtistBox" Margin="0,0,0,12" />
|
||||||
|
|
||||||
<Label Content="_Lizenz" Target="{Binding ElementName=LicenseBox}" />
|
<Label Content="{l:Tr SongEdit_LabelLicense}" Target="{Binding ElementName=LicenseBox}" />
|
||||||
<ui:TextBox x:Name="LicenseBox" Margin="0,0,0,12" PlaceholderText="Optional, z. B. CC BY 4.0" />
|
<ui:TextBox x:Name="LicenseBox" Margin="0,0,0,12" PlaceholderText="{l:Tr SongEdit_LicensePlaceholder}" />
|
||||||
|
|
||||||
<Label Content="_Namensnennung" Target="{Binding ElementName=AttributionBox}" />
|
<Label Content="{l:Tr SongEdit_LabelAttribution}" Target="{Binding ElementName=AttributionBox}" />
|
||||||
<ui:TextBox x:Name="AttributionBox" PlaceholderText="Optional" />
|
<ui:TextBox x:Name="AttributionBox" PlaceholderText="{l:Tr SongEdit_Optional}" />
|
||||||
|
|
||||||
<TextBlock x:Name="ErrorText"
|
<TextBlock x:Name="ErrorText"
|
||||||
Margin="0,12,0,0"
|
Margin="0,12,0,0"
|
||||||
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
|
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
|
||||||
Text="Titel und Interpret sind erforderlich."
|
Text="{l:Tr SongEdit_Required}"
|
||||||
Visibility="Collapsed" />
|
Visibility="Collapsed" />
|
||||||
|
|
||||||
<StackPanel Margin="0,24,0,0" HorizontalAlignment="Right" Orientation="Horizontal">
|
<StackPanel Margin="0,24,0,0" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
<ui:Button Content="Speichern" Appearance="Primary" IsDefault="True" MinWidth="90" Click="OnSave" />
|
<ui:Button Content="{l:Tr SongEdit_Save}" Appearance="Primary" IsDefault="True" MinWidth="90" Click="OnSave" />
|
||||||
<ui:Button Margin="8,0,0,0" Content="Abbrechen" IsCancel="True" MinWidth="90" />
|
<ui:Button Margin="8,0,0,0" Content="{l:Tr Library_Cancel}" IsCancel="True" MinWidth="90" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
Reference in new issue
Block a user