Skip to content

Commit

Permalink
Fix for localizing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Apr 2, 2024
1 parent 1b196cf commit 44260ca
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 44 deletions.
1 change: 0 additions & 1 deletion AudioCuesheetEditor/Model/IO/Export/ExportfileGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ protected override ValidationResult Validate(string property)
}
if (validationResults.Any(x => x.Value.Status == ValidationStatus.Error))
{
//TODO: Für jedes Objekt eine Nachricht erstellen und den Objektnamen voranstellen!
var messages = validationResults.Values.Where(x => x.ValidationMessages != null).SelectMany(x => x.ValidationMessages!);
validationResult = ValidationResult.Create(ValidationStatus.Error, messages);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Undo last change": "Letzte Änderung Rückgängig machen",
"Redo last change": "Letzte Änderung wiederherstellen",
"Export": "Export",
"Please check processinghints for errors, otherwise the file is not exportable": "Bitte prüfen sie die Bearbeitungshinweise auf Fehler. Andernfalls ist Datei nicht exportierbar.",
"Please check processinghints for errors, otherwise the file is not exportable: {0}": "Bitte prüfen sie die Bearbeitungshinweise auf Fehler. Andernfalls ist Datei nicht exportierbar: {0}",
"Download cuesheet": "Cuesheet herunterladen",
"Save project": "Projekt speichern",
"Open exportprofiles": "Export Profile anzeigen",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Undo last change": "Undo last change",
"Redo last change": "Redo last change",
"Export": "Export",
"Please check processinghints for errors, otherwise the file is not exportable": "Please check processing hints for errors. Otherwise the file is not exportable.",
"Please check processinghints for errors, otherwise the file is not exportable: {0}": "Please check processinghints for errors, otherwise the file is not exportable: {0}",
"Download cuesheet": "Download cuesheet",
"Save project": "Save project",
"Open exportprofiles": "Display Export Profiles",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Download this file": "Diese Datei herunterladen",
"Generate export files": "Exportdateien generieren",
"Abort": "Abbrechen",
"Export files can not be generated. Please check validationerrors and solve errors in order to download export.": "Exportdateien können nicht generiert werden. Bitte prüfen Sie die Validierungsfehler und beheben Sie diese, um die Exportdateien herunterladen zu können.",
"Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}": "Exportdateien können nicht generiert werden. Bitte prüfen Sie die Validierungsfehler und beheben Sie diese, um die Exportdateien herunterladen zu können: {0}",
"Close": "Schließen",
"Download split audio file": "Verarbeitete Audiodatei herunterladen",
"Generation in progress, please stand by ...": "Export wird durchgeführt, bitte warten Sie ...."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Download this file": "Download this file",
"Generate export files": "Generate export files",
"Abort": "Abort",
"Export files can not be generated. Please check validationerrors and solve errors in order to download export.": "Export files can not be generated. Please check validationerrors and solve errors in order to download export.",
"Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}": "Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}",
"Close": "Close",
"Download split audio file": "Download split audio file",
"Generation in progress, please stand by ...": "Generation in progress, please stand by ..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
"SchemeType": "Schematyp",
"Scheme": "Schema",
"ENTER REGULAR EXPRESSION HERE": "Hier regulären Ausdruck eingeben",
"SchemeCuesheet": "Schema Cuesheet",
"SchemeTracks": "Schema Titel",
"SchemeHead": "Kopfschema",
"SchemeTracks": "Titelschema",
"SchemeFooter": "Fußschema",
"Moment": "Zeitpunkt",
"{0} must end with '{1}'!": "{0} musss mit '{1}' enden!",
"{0} must have a filename!": "{0} muss einen Dateinamen haben!",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
"SchemeType": "Schemetype",
"Scheme": "Scheme",
"ENTER REGULAR EXPRESSION HERE": "Enter regular expression here",
"SchemeCuesheet": "Scheme cuesheet",
"SchemeTracks": "Scheme tracks",
"SchemeHead": "Headerscheme",
"SchemeTracks": "Trackscheme",
"SchemeFooter": "Footerscheme",
"Moment": "Moment",
"{0} must end with '{1}'!": "{0} must end with '{1}'!",
"{0} must have a filename!": "{0} must have a filename!",
Expand Down
30 changes: 2 additions & 28 deletions AudioCuesheetEditor/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ along with Foobar. If not, see
<Button Color="Color.Primary" Clicked="() => ControlModalDialog(modalDownloadProjectfile, true)">@_localizer["Save project"]</Button>
</BarDropdownItem>
<BarDropdownItem>
<Tooltip Placement="TooltipPlacement.Right" Text="@IsExportprofileExportableTooltip">
<Button Color="Color.Primary" Clicked="OnDisplayExportProfilesClicked" Disabled="!IsExportprofileExportable">@_localizer["Open exportprofiles"]</Button>
</Tooltip>
<Button Color="Color.Primary" Clicked="OnDisplayExportProfilesClicked">@_localizer["Open exportprofiles"]</Button>
</BarDropdownItem>
</BarDropdownMenu>
</BarDropdown>
Expand Down Expand Up @@ -430,7 +428,7 @@ along with Foobar. If not, see
{
foreach (var validationMessage in validationResult.ValidationMessages)
{
detailText += String.Format("{0}{1}", _validationMessageLocalizer[validationMessage.Message, validationMessage.Parameter], Environment.NewLine);
detailText += String.Format("{0}{1}", validationMessage.GetMessageLocalized(_validationMessageLocalizer), Environment.NewLine);
}
}
return _localizer["Please check processinghints for errors, otherwise the file is not exportable: {0}", detailText];
Expand All @@ -441,30 +439,6 @@ along with Foobar. If not, see

Boolean IsCuesheetExportable => IsCuesheetExportableTooltip == null;

string? IsExportprofileExportableTooltip
{
get
{
var generator = new ExportfileGenerator(ExportType.Exportprofile, _sessionStateContainer.Cuesheet, SelectedExportProfile, audioConverterService: _audioConverterService);
var validationResult = generator.Validate();
if (validationResult.Status == Model.Entity.ValidationStatus.Error)
{
string? detailText = null;
if (validationResult.ValidationMessages != null)
{
foreach (var validationMessage in validationResult.ValidationMessages)
{
detailText += String.Format("{0}{1}", _validationMessageLocalizer[validationMessage.Message, validationMessage.Parameter], Environment.NewLine);
}
}
return _localizer["Please check processinghints for errors, otherwise the file is not exportable: {0}", detailText];
}
return null;
}
}

Boolean IsExportprofileExportable => IsExportprofileExportableTooltip == null;

Boolean ModalExportdialogCuesheetLockUserInput
{
get
Expand Down
9 changes: 2 additions & 7 deletions AudioCuesheetEditor/Shared/ModalExportdialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ along with Foobar. If not, see
{
foreach (var validationMessage in validationResult.ValidationMessages)
{
detailText += String.Format("{0}{1}", _validationMessageLocalizer[validationMessage.Message, validationMessage.Parameter], Environment.NewLine);
detailText += String.Format("{0}{1}", validationMessage.GetMessageLocalized(_validationMessageLocalizer), Environment.NewLine);
}
}
return _localizer["Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}", detailText];
Expand All @@ -205,12 +205,7 @@ along with Foobar. If not, see
{
exportPossible = Validations.ValidateAll().GetAwaiter().GetResult();
}
//TODO: Warum nur bei exportPossible == false?
if (exportPossible == false)
{
exportPossible = ExportPossibleTooltip == null;
}
return exportPossible;
return exportPossible && ExportPossibleTooltip == null;
}
}

Expand Down

0 comments on commit 44260ca

Please sign in to comment.