Skip to content

Commit

Permalink
Moved localization for track list item
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Nov 12, 2024
1 parent 73d993d commit ae75c48
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
4 changes: 4 additions & 0 deletions AudioCuesheetEditor/AudioCuesheetEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
<Content Remove="Resources\Localization\TrackLinkControl\en.json" />
<Content Remove="Resources\Localization\TrackListItemControlColumn\de.json" />
<Content Remove="Resources\Localization\TrackListItemControlColumn\en.json" />
<Content Remove="Resources\Localization\TrackListItem\de.json" />
<Content Remove="Resources\Localization\TrackListItem\en.json" />
<Content Remove="Resources\Localization\TrackSelection\de.json" />
<Content Remove="Resources\Localization\TrackSelection\en.json" />
<Content Remove="Resources\Localization\ValidationMessage\de.json" />
Expand Down Expand Up @@ -96,6 +98,8 @@
<EmbeddedResource Include="Resources\Localization\TrackLinkControl\en.json" />
<EmbeddedResource Include="Resources\Localization\TrackListItemControlColumn\de.json" />
<EmbeddedResource Include="Resources\Localization\TrackListItemControlColumn\en.json" />
<EmbeddedResource Include="Resources\Localization\TrackListItem\de.json" />
<EmbeddedResource Include="Resources\Localization\TrackListItem\en.json" />
<EmbeddedResource Include="Resources\Localization\TrackList\de.json" />
<EmbeddedResource Include="Resources\Localization\TrackList\en.json" />
<EmbeddedResource Include="Resources\Localization\CultureSelector\de.json" />
Expand Down
4 changes: 1 addition & 3 deletions AudioCuesheetEditor/Resources/Localization/TrackList/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
"Begin": "Beginn",
"End": "Ende",
"Length": "Länge",
"Current track is played": "Dieser Track wird aktuell wiedergegeben",
"Position": "Position",
"Abort": "Abbrechen",
"Save changes": "Änderungen speichern",
"Confirmation required": "Bestätigung erforderlich",
"Do you really want to delete all tracks?": "Möchten Sie wirklich alle Titel löschen?",
"Edit selected tracks": "Ausgewählte Titel bearbeiten",
"Validation errors": "Validierungsfehler",
"A split point is currently set at the time of this track": "Ein Aufteilungspunkt ist aktuell in dem Zeitfenster dieses Titels gesetzt"
"Validation errors": "Validierungsfehler"
}
}
4 changes: 1 addition & 3 deletions AudioCuesheetEditor/Resources/Localization/TrackList/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
"Begin": "Begin",
"End": "End",
"Length": "Length",
"Current track is played": "Current track is played",
"Position": "Position",
"Abort": "Abort",
"Save changes": "Save changes",
"Confirmation required": "Confirmation required",
"Do you really want to delete all tracks?": "Do you really want to delete all tracks?",
"Edit selected tracks": "Edit selected tracks",
"Validation errors": "Validation errors",
"A split point is currently set at the time of this track": "A split point is currently set at the time of this track"
"Validation errors": "Validation errors"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"culture": "de",
"translations": {
"Current track is played": "Dieser Track wird aktuell wiedergegeben",
"A split point is currently set at the time of this track": "Ein Aufteilungspunkt ist aktuell in dem Zeitfenster dieses Titels gesetzt"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"culture": "en",
"translations": {
"Current track is played": "Current track is played",
"A split point is currently set at the time of this track": "A split point is currently set at the time of this track"
}
}
28 changes: 18 additions & 10 deletions AudioCuesheetEditor/Shared/TrackList/TrackListItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ along with Foobar. If not, see
<Virtualize TItem="Track" Items="Cuesheet.Tracks.ToList()" Context="track" SpacerElement="tr">
<TrackLinkControl TrackReference="track" TrackSelectionVisible="TrackSelectionVisible" />
<TableRow Color="((AudioPlayer != null) && (AudioPlayer.CurrentlyPlayingTrack != null) && (AudioPlayer.CurrentlyPlayingTrack == track)) ? Color.Primary : Color.Default">
<TrackSelection Visible="TrackSelectionVisible" Selected="SelectedTracks.Contains(track)" SelectedChanged="(selected) => SelectedTrackChanged(track, selected)" />
<TrackSelection Visible="TrackSelectionVisible" Selected="SelectedTracks?.Contains(track) == true" SelectedChanged="(selected) => SelectedTrackChanged(track, selected)" />
<TrackListItemControlColumn TrackReference="track" AudioPlayer="AudioPlayer" TrackDeleted="() => TrackDeleted(track)" />
<TableRowCell>
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer != null) && (AudioPlayer.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer?.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Autocomplete TItem="MusicBrainzArtist" TValue="Guid" Data="autocompleteTrackArtists" FreeTyping TextField="@((item) => item.Name)" ValueField="@((item) => item.Id)" @bind-SelectedText="track.Artist" ReadData="OnReadDataAutocompleteTrackArtist" AsyncValidator="(args, token) => ValidatorUtility<Track>.Validate(args, track, x => x.Artist, _validationMessageLocalizer, token)">
<ItemContent>
@if (context.Item.Disambiguation != null)
Expand All @@ -51,7 +51,7 @@ along with Foobar. If not, see
</Tooltip>
</TableRowCell>
<TableRowCell>
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer != null) && (AudioPlayer.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer?.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Autocomplete TItem="MusicBrainzTrack" TValue="Guid" Data="autocompleteTrackTitles" FreeTyping TextField="@((item) => item.Title)" ValueField="@((item) => item.Id)" @bind-SelectedText="track.Title" ReadData="(args) => OnReadDataAutocompleteTrackTitle(args, track)" SelectedValueChanged="(value) => OnSelectedValueChangedTrackTitle(value, track)" AsyncValidator="(args, token) => ValidatorUtility<Track>.Validate(args, track, x => x.Title, _validationMessageLocalizer, token)">
<ItemContent>
@if (context.Item.Disambiguation != null)
Expand Down Expand Up @@ -87,7 +87,7 @@ along with Foobar. If not, see
</Badge>
</Tooltip>
}
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer != null) && (AudioPlayer.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer?.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Validation AsyncValidator="(args, token) => ValidatorUtility<Track>.Validate(args, track, x => x.Begin, _validationMessageLocalizer, token)">
<TextEdit Text="@track.Begin?.ToString()" TextChanged="(value) => _applicationOptionsTimeSpanParser.TimespanTextChanged<Track, TimeSpan?>(track, x => x.Begin, value)" Immediate="false">
<Feedback>
Expand All @@ -99,7 +99,7 @@ along with Foobar. If not, see
</Div>
</TableRowCell>
<TableRowCell>
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer != null) && (AudioPlayer.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer?.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Validation AsyncValidator="(args, token) => ValidatorUtility<Track>.Validate(args, track, x => x.End, _validationMessageLocalizer, token)">
<TextEdit Text="@track.End?.ToString()" TextChanged="(value) => _applicationOptionsTimeSpanParser.TimespanTextChanged<Track, TimeSpan?>(track, x => x.End, value)" Immediate="false">
<Feedback>
Expand All @@ -110,7 +110,7 @@ along with Foobar. If not, see
</Tooltip>
</TableRowCell>
<TableRowCell Display="Display.TableCell.OnDesktop.None.OnTablet.None.OnMobile">
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer != null) && (AudioPlayer.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Tooltip Placement="TooltipPlacement.Top" Text="@GetLocalizedString((AudioPlayer?.AudioIsPlaying == true) && (AudioPlayer.CurrentlyPlayingTrack == track),"Current track is played")">
<Validation AsyncValidator="(args, token) => ValidatorUtility<Track>.Validate(args, track, x => x.Length, _validationMessageLocalizer, token)">
<TextEdit Text="@track.Length?.ToString()" TextChanged="(value) => _applicationOptionsTimeSpanParser.TimespanTextChanged<Track, TimeSpan?>(track, x => x.Length, value)" Immediate="false">
<Feedback>
Expand All @@ -130,7 +130,7 @@ along with Foobar. If not, see
<EditTrackModal @ref="modalTrackEdit" SaveClicked="() => StateHasChanged()" />

@code {
//TODO: Localization
//TODO: Split point display doesn't work
EditTrackModal? modalTrackEdit;
Validations? validations;
IEnumerable<MusicBrainzArtist>? autocompleteTrackArtists;
Expand All @@ -147,7 +147,7 @@ along with Foobar. If not, see
public Boolean TrackSelectionVisible { get; set; }

[Parameter, EditorRequired]
public IReadOnlyCollection<Track> SelectedTracks { get; set; } = new List<Track>();
public IReadOnlyCollection<Track>? SelectedTracks { get; set; }

[Parameter]
public EventCallback<List<Track>> SelectedTracksChanged { get; set; }
Expand Down Expand Up @@ -219,7 +219,11 @@ along with Foobar. If not, see

void SelectedTrackChanged(Track track, bool selected)
{
var selectedTracks = new List<Track>(SelectedTracks);
var selectedTracks = new List<Track>();
if (SelectedTracks != null)
{
selectedTracks.AddRange(SelectedTracks);
}
if (selected)
{
selectedTracks.Add(track);
Expand Down Expand Up @@ -276,7 +280,11 @@ along with Foobar. If not, see

void TrackDeleted(Track track)
{
var selectedTracks = new List<Track>(SelectedTracks);
var selectedTracks = new List<Track>();
if (SelectedTracks != null)
{
selectedTracks.AddRange(SelectedTracks);
}
selectedTracks.Remove(track);
SelectedTracksChanged.InvokeAsync(selectedTracks);
}
Expand Down

0 comments on commit ae75c48

Please sign in to comment.